|
|
@ -84,11 +84,12 @@ public: |
|
|
|
state::GameState GAME_STATE = state::EDITOR; |
|
|
|
state::GameState GAME_STATE = state::EDITOR; |
|
|
|
vi2d SELECTED_TILE={0,0}; |
|
|
|
vi2d SELECTED_TILE={0,0}; |
|
|
|
vi2d HIGHLIGHTED_TILE={0,0}; |
|
|
|
vi2d HIGHLIGHTED_TILE={0,0}; |
|
|
|
|
|
|
|
int EDITING_LAYER=2; |
|
|
|
|
|
|
|
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
bool MOUSE_PRESSED_DOWN=false,MOUSE_DOWN=false,MOUSE_RELEASED=false; //TODO Implement Mouse things.
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<std::vector<TILE*>> MAP; |
|
|
|
std::vector<std::vector<TILE*>> MAP; //The foreground layer.
|
|
|
|
std::vector<std::vector<TILE*>> MAP2; //The foreground layer.
|
|
|
|
std::vector<std::vector<TILE*>> MAP2; |
|
|
|
std::map<Reference,Decal*> SPRITES; |
|
|
|
std::map<Reference,Decal*> SPRITES; |
|
|
|
std::map<Reference,Animation*> ANIMATIONS; |
|
|
|
std::map<Reference,Animation*> ANIMATIONS; |
|
|
|
std::map<int,Object*> OBJ_INFO; |
|
|
|
std::map<int,Object*> OBJ_INFO; |
|
|
@ -162,6 +163,12 @@ public: |
|
|
|
if (TabHeld()) { |
|
|
|
if (TabHeld()) { |
|
|
|
GAME_STATE=state::TILE_SELECT; |
|
|
|
GAME_STATE=state::TILE_SELECT; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (GetKey(K1).bHeld) { |
|
|
|
|
|
|
|
EDITING_LAYER=2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (GetKey(K2).bHeld) { |
|
|
|
|
|
|
|
EDITING_LAYER=3; |
|
|
|
|
|
|
|
} |
|
|
|
if (UpHeld()) { |
|
|
|
if (UpHeld()) { |
|
|
|
cameraPos.y-=CAMERA_MOVESPD; |
|
|
|
cameraPos.y-=CAMERA_MOVESPD; |
|
|
|
} |
|
|
|
} |
|
|
@ -180,9 +187,18 @@ public: |
|
|
|
HIGHLIGHTED_TILE={selectedTileX,selectedTileY}; |
|
|
|
HIGHLIGHTED_TILE={selectedTileX,selectedTileY}; |
|
|
|
} |
|
|
|
} |
|
|
|
if (GetMouse(0).bHeld) { |
|
|
|
if (GetMouse(0).bHeld) { |
|
|
|
TILE*tile=MAP[HIGHLIGHTED_TILE.y][HIGHLIGHTED_TILE.x]; |
|
|
|
switch (EDITING_LAYER) { |
|
|
|
tile->tileX=SELECTED_TILE.x; |
|
|
|
case 2:{ |
|
|
|
tile->tileY=SELECTED_TILE.y; |
|
|
|
TILE*tile=MAP[HIGHLIGHTED_TILE.y][HIGHLIGHTED_TILE.x]; |
|
|
|
|
|
|
|
tile->tileX=SELECTED_TILE.x; |
|
|
|
|
|
|
|
tile->tileY=SELECTED_TILE.y; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
case 3:{ |
|
|
|
|
|
|
|
TILE*tile=MAP2[HIGHLIGHTED_TILE.y][HIGHLIGHTED_TILE.x]; |
|
|
|
|
|
|
|
tile->tileX=SELECTED_TILE.x; |
|
|
|
|
|
|
|
tile->tileY=SELECTED_TILE.y; |
|
|
|
|
|
|
|
}break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
} |
|
|
|
} |
|
|
@ -231,7 +247,9 @@ public: |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SetDrawTarget(nullptr); |
|
|
|
DrawRectDecal((HIGHLIGHTED_TILE)*32-cameraPos,{32,32},YELLOW); |
|
|
|
DrawRectDecal((HIGHLIGHTED_TILE)*32-cameraPos,{32,32},YELLOW); |
|
|
|
|
|
|
|
DrawStringPropDecal({2,2},"Editing Layer "+std::to_string(EDITING_LAYER)); |
|
|
|
}break; |
|
|
|
}break; |
|
|
|
case state::TILE_SELECT:{ |
|
|
|
case state::TILE_SELECT:{ |
|
|
|
//14x14 pixels per tile.
|
|
|
|
//14x14 pixels per tile.
|
|
|
|