| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- /*
- Copyright (C) 2012 by Ivan Safrin
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- */
- #pragma once
- #include "PolycodeGlobals.h"
- #include "PolycodeUI.h"
- #include "Polycode.h"
- #include "OSBasics.h"
- using namespace Polycode;
- class PropProp : public UIElement {
- public:
- PropProp(String caption);
- ~PropProp();
-
- ScreenLabel *label;
- ScreenEntity *propContents;
- };
- class Vector2Prop : public PropProp {
- public:
- Vector2Prop(String caption);
- ~Vector2Prop();
- void handleEvent(Event *event);
- void set(Vector2 position);
- Vector2 get();
-
- UITextInput *positionX;
- UITextInput *positionY;
- };
- class SliderProp : public PropProp {
- public:
- SliderProp(String caption, Number min, Number max);
- ~SliderProp();
- void handleEvent(Event *event);
- void set(Number number);
- Number get();
-
- UIHSlider *slider;
- ScreenLabel *valueLabel;
- };
- class NumberProp : public PropProp {
- public:
- NumberProp(String caption);
- ~NumberProp();
- void handleEvent(Event *event);
- void set(Number number);
- Number get();
-
- UITextInput *numberEntry;
- };
- class StringProp : public PropProp {
- public:
- StringProp(String caption);
- ~StringProp();
- void handleEvent(Event *event);
- void set(String str);
- String get();
-
- UITextInput *stringEntry;
- };
- class ColorProp : public PropProp {
- public:
- ColorProp(String caption);
- ~ColorProp();
- void handleEvent(Event *event);
-
- void set(Color color);
- Color get();
-
- UIColorBox *colorEntry;
- };
- class ComboProp : public PropProp {
- public:
- ComboProp(String caption);
- ~ComboProp();
- void handleEvent(Event *event);
-
- void set(unsigned int index);
- unsigned int get();
-
- UIComboBox *comboEntry;
- };
- class BoolProp : public PropProp {
- public:
- BoolProp(String caption);
- ~BoolProp();
- void handleEvent(Event *event);
-
- void set(bool val);
- bool get();
-
- UICheckBox *checkEntry;
- };
- class SoundProp : public PropProp {
- public:
- SoundProp(String caption);
- ~SoundProp();
- void handleEvent(Event *event);
-
- void set(String soundPath);
- String get();
-
- Sound *previewSound;
- ScreenLabel *soundFile;
- UIButton *changeButton;
- UIButton *playButton;
- };
- class BezierRGBACurveProp : public PropProp {
- public:
- BezierRGBACurveProp(String caption);
- ~BezierRGBACurveProp();
- void handleEvent(Event *event);
-
- BezierCurve *curveR;
- BezierCurve *curveG;
- BezierCurve *curveB;
- BezierCurve *curveA;
- UIButton *changeButton;
- };
- class BezierCurveProp : public PropProp {
- public:
- BezierCurveProp(String caption, String curveName);
- ~BezierCurveProp();
- void handleEvent(Event *event);
-
- String curveName;
- BezierCurve *curve;
- UIButton *changeButton;
- };
- class TextureProp : public PropProp {
- public:
- TextureProp(String caption);
- ~TextureProp();
- void handleEvent(Event *event);
-
- void set(Texture *texture);
- Texture* get();
-
- ScreenShape *previewShape;
- UIButton *changeButton;
- };
- class ScreenSpriteProp : public PropProp {
- public:
- ScreenSpriteProp(String caption);
- ~ScreenSpriteProp();
- void handleEvent(Event *event);
-
- void set(String fileName);
- String get();
-
- ScreenSprite *previewSprite;
- UIButton *changeButton;
- };
- class ScreenEntityInstanceProp : public PropProp {
- public:
- ScreenEntityInstanceProp(String caption);
- ~ScreenEntityInstanceProp();
- void handleEvent(Event *event);
-
- void set(String fileName);
- String get();
-
- ScreenEntityInstance *previewInstance;
- UIButton *changeButton;
- };
- class PropSheet : public UIElement {
- public:
- PropSheet(String caption, String type);
- ~PropSheet();
- void Resize(Number width, Number height);
-
- void handleEvent(Event *event);
-
- void setCollapsed(bool val);
-
- void addProp(PropProp *prop);
-
- String caption;
- String type;
-
- Number propHeight;
- ScreenEntity *contents;
-
- ScreenShape *bg;
-
- UIImageButton *collapseButton;
- UIImageButton *expandButton;
-
- bool collapsed;
-
- std::vector<PropProp*> props;
- };
- class EntitySheet : public PropSheet {
- public:
- EntitySheet();
- ~EntitySheet();
-
- void handleEvent(Event *event);
- void Update();
-
- Entity *entity;
- Entity *lastEntity;
-
- StringProp *idProp;
- StringProp *tagProp;
- ColorProp *colorProp;
- ComboProp *blendingProp;
- };
- class ShapeSheet : public PropSheet {
- public:
- ShapeSheet();
- ~ShapeSheet();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenShape *shape;
-
- ComboProp *typeProp;
- Vector2Prop *shapeSize;
- BoolProp *strokeProp;
- ColorProp *strokeColorProp;
- NumberProp *strokeSize;
-
- bool lastStrokeVal;
- int lastShapeType;
- Vector2 lastShapeSize;
- Color lastStrokeColor;
- Number lastStrokeSize;
- };
- class ScreenLabelSheet : public PropSheet {
- public:
- ScreenLabelSheet();
- ~ScreenLabelSheet();
-
- void refreshFonts();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenLabel *label;
-
- int lastSize;
- String lastFont;
-
- StringProp *caption;
- NumberProp *size;
- ComboProp *font;
- BoolProp *enableAA;
- };
- class ScreenImageSheet : public PropSheet {
- public:
- ScreenImageSheet();
- ~ScreenImageSheet();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenImage *image;
-
- TextureProp *texture;
-
- };
- class ScreenSpriteSheet : public PropSheet {
- public:
- ScreenSpriteSheet();
- ~ScreenSpriteSheet();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenSprite *sprite;
- ScreenSpriteProp *spriteProp;
- ComboProp *defaultAnimationProp;
-
- ScreenSprite *lastAnimationCheck;
-
- };
- class ScreenEntityInstanceSheet : public PropSheet {
- public:
- ScreenEntityInstanceSheet();
- ~ScreenEntityInstanceSheet();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenEntityInstance *instance;
- ScreenEntityInstanceProp *instanceProp;
- };
- class SoundSheet : public PropSheet {
- public:
- SoundSheet();
- ~SoundSheet();
-
- void handleEvent(Event *event);
- void Update();
-
- ScreenSound *sound;
- SoundProp *soundProp;
- NumberProp *referenceDistance;
- NumberProp *maxDistance;
- NumberProp *volume;
- NumberProp *pitch;
-
- String lastSoundPath;
- Number lastReferenceDistance;
- Number lastMaxDistance;
- Number lastVolume;
- Number lastPitch;
- };
- class ScreenParticleSheet : public PropSheet {
- public:
- ScreenParticleSheet();
- ~ScreenParticleSheet();
-
- void handleEvent(Event *event);
-
- void Update();
- TextureProp *textureProp;
- ComboProp *blendingProp;
- NumberProp *numParticlesProp;
- NumberProp *lifespanProp;
- NumberProp *particleScaleProp;
- Vector2Prop *sizeProp;
- Vector2Prop *dirProp;
- Vector2Prop *gravProp;
- Vector2Prop *deviationProp;
- SliderProp *brightnessDeviationProp;
- BoolProp *perlinEnableProp;
- NumberProp *perlinModSizeProp;
- SliderProp *speedModProp;
- NumberProp *rotationSpeedProp;
- BoolProp *rotationFollowsPathProp;
- BoolProp *useScaleCurvesProp;
- BezierCurveProp *scaleCurveProp;
-
- BoolProp *useColorCurvesProp;
- BezierRGBACurveProp *colorCurveProp;
-
- Number lastParticleScale;
- Number lastRotationSpeed;
- Number lastNumParticles;
- Number lastLifespan;
- Vector3 lastSize;
- Vector3 lastDeviation;
- Vector3 lastDir;
- Vector3 lastGrav;
- Number lastBrightnessDeviation;
- bool lastEnableProp;
- Number lastPerlinSize;
- Number lastSpeedMod;
- bool lastRotationFollowsPath;
- bool lastUseScaleCurves;
- bool lastUseColorCurves;
- BezierCurve *lastScaleCurve;
-
- ScreenParticleEmitter *emitter;
- };
- class Transform2DSheet : public PropSheet {
- public:
- Transform2DSheet();
- ~Transform2DSheet();
-
- void handleEvent(Event *event);
-
- void Update();
-
- Vector2Prop *positionProp;
- Vector2Prop *scaleProp;
- NumberProp *rotationProp;
- BoolProp *topLeftProp;
-
- Vector2 lastPositon;
- Vector2 lastScale;
- Number lastRotation;
- int lastPositionMode;
-
- ScreenEntity *entity;
- };
- class PropList : public UIElement {
- public:
- PropList(String caption="PROPERTIES");
- ~PropList();
-
- void updateProps();
-
- void addPropSheet(PropSheet *sheet);
- void handleEvent(Event *event);
- void Resize(Number width, Number height);
-
- UIScrollContainer *scrollContainer;
- protected:
-
- ScreenEntity *propContents;
-
- std::vector<PropSheet*> props;
- ScreenShape *bg;
- ScreenShape *bg2;
- };
|