1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-02-10 06:04:03 +00:00
Aquaria/Aquaria/SceneEditor.h
fgenesis 49b9e0f05a Rework & cleanup CMake project files
- Building with CMake for development is now actually sane
- Split deps into projects and extra files
- Building against external deps should still work but needs testing
- Can now build out of the box without further adjustments as long as SDL(2) is found properly
- Build Lua in C++ mode (so it can use exceptions instead of setjmp/longjmp)
  - Unfortunately we need to enable exceptions for this :(

- Remove these defines:
  * AQUARIA_BUILD_SCENEEDITOR (now always on)
  * AQUARIA_BUILD_CONSOLE (now always on)
  * BBGE_BUILD_ACHIEVEMENTS_INTERNAL (now always on unless BBGE_BUILD_STEAMWORKS is defined)
  * BBGE_BUILD_OPENGL_DYNAMIC (now always on, define BBGE_BUILD_OPENGL_STATIC if needed)
  * BBGE_BUILD_FMOD_OPENAL_BRIDGE (now always on)
- BBGE_BUILD_STEAMWORKS is not actually implemented (any volunteers?)
- Prepare later removal of SDL & the old vc90 project from the repo. See #74 for extra notes.
2022-04-07 02:38:39 +02:00

242 lines
4.5 KiB
C++

#ifndef AQUARIA_SCENEEDITOR_H
#define AQUARIA_SCENEEDITOR_H
#include "Base.h"
#include "AquariaCompileConfig.h"
#include "DebugFont.h"
#include "ActionMapper.h"
#include "Quad.h"
class Element;
class Entity;
class Path;
struct EntityGroupEntity
{
std::string name;
std::string gfx;
};
typedef std::vector<EntityGroupEntity> EntityGroupEntities;
struct EntityGroup
{
std::string name;
EntityGroupEntities entities;
};
typedef std::vector<EntityGroup> EntityGroups;
enum EditTypes
{
ET_ELEMENTS =0,
ET_ENTITIES =1,
ET_PATHS =2,
ET_SELECTENTITY =4,
ET_MAX
};
enum EditorStates
{
ES_SELECTING =0,
ES_SCALING =1,
ES_ROTATING =2,
ES_MOVING =3,
ES_MAX
};
class SceneEditorMenuReceiver : public DebugButtonReceiver
{
public:
void buttonPress(DebugButton *db);
};
struct SelectedEntity
{
SelectedEntity();
void clear();
void setIndex(int idx);
void setName(const std::string &name, const std::string &prevGfx);
void setSelectEntity(const SelectedEntity &ent);
bool nameBased;
int index, typeListIndex;
std::string name;
std::string prevGfx;
float prevScale;
};
class SceneEditor : public ActionMapper
{
public:
SceneEditor();
void init();
void shutdown();
void toggle();
void toggle(bool on);
void update(float dt);
void prevElement();
void nextElement();
void doPrevElement();
Element *cycleElementNext(Element *e);
Element *cycleElementPrev(Element *e);
void selectZero();
void selectEnd();
void placeElement();
void flipElementHorz();
void flipElementVert();
void deleteSelectedElement();
void deleteElement(int selectedIdx);
virtual void action(int id, int state, int source, InputDevice device);
void scaleElementUp();
void scaleElementDown();
void scaleElement1();
void placeAvatar();
void executeButtonID(int bid);
void openMainMenu();
void closeMainMenu();
void setBackgroundGradient();
bool isOn();
void generateLevel();
void skinLevel(int minX, int minY, int maxX, int maxY);
void skinLevel();
void regenLevel();
void updateSaveFileEnemyPosition(Entity *ent);
void startMoveEntity();
void endMoveEntity();
void down();
void up();
void exitMoveState();
void alignHorz();
void alignVert();
EditTypes editType;
EditorStates state;
Element *getElementAtCursor();
Entity *getEntityAtCursor();
void mouseButtonLeftUp();
void mouseButtonRightUp();
void moveToBack();
void moveToFront();
int bgLayer;
Element *editingElement;
Entity *editingEntity;
Path *editingPath;
size_t selectedIdx;
size_t selectedNode;
Path *getSelectedPath();
void changeDepth();
void updateEntitySaveData(Entity *editingEntity);
void moveLayer();
void moveElementToLayer(Element *e, int bgLayer);
void toggleElementRepeat();
bool multiSelecting;
Vector multiSelectPoint;
std::vector <Element*> selectedElements;
Vector groupCenter;
Vector getSelectedElementsCenter();
Quad dummy;
void updateSelectedElementPosition(Vector position);
int selectedEntityType;
SelectedEntity selectedEntity;
size_t entityPageNum;
void checkForRebuild();
void createAquarian();
void dumpObs();
DebugButton *btnMenu;
protected:
void reversePath();
void updateEntityPlacer();
void updateMultiSelect();
float autoSaveTimer;
int autoSaveFile;
void enterName();
void changeShape();
int skinMinX, skinMinY, skinMaxX, skinMaxY;
void setGridPattern(int gi);
void setGridPattern0();
void setGridPattern1();
void setGridPattern2();
void setGridPattern3();
void setGridPattern4();
void setGridPattern5();
void setGridPattern6();
void setGridPattern7();
void setGridPattern8();
void setGridPattern9();
void toggleElementSolid();
void toggleElementHurt();
void editModeElements();
void editModeEntities();
void editModePaths();
void deleteSelected();
void cloneSelectedElement();
void enterScaleState();
void enterRotateState();
void enterMoveState();
Vector oldPosition, oldRotation, oldScale, cursorOffset, oldRepeatScale;
Entity *movingEntity;
void nextEntityType();
void prevEntityType();
void removeEntity();
void selectEntityFromGroups();
Vector zoom;
void rotateElement();
void rotateElement2();
void updateText();
void saveScene();
void loadScene();
SceneEditorMenuReceiver menuReceiver;
void addMainMenuItem(const std::string &label, int bid);
void loadSceneByName();
void reloadScene();
void mouseButtonLeft();
void mouseButtonRight();
size_t curElement, selectedVariation, possibleSelectedIdx;
Quad *placer;
DebugFont *text;
bool on;
InterpolatedVector oldGlobalScale;
};
#endif // AQUARIA_SCENEEDITOR_H