generated from sigonasr2/CPlusPlusProjectTemplate
Ability to delete objects from the map as well.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
ba5039b59c
commit
2385741840
Binary file not shown.
10
main.cpp
10
main.cpp
@ -378,7 +378,15 @@ public:
|
||||
GAME_STATE=GameState::OBJ_SELECT;
|
||||
}
|
||||
if (EDITING_LAYER==layer::OBJECT&&GetMouse(0).bPressed) {
|
||||
OBJECTS.push_back(CreateObject(SELECTED_OBJ_ID,GetMousePos()+cameraPos));
|
||||
OBJECTS.push_back(CreateObject(SELECTED_OBJ_ID,HIGHLIGHTED_TILE*32));
|
||||
} else
|
||||
if (EDITING_LAYER==layer::OBJECT&&GetMouse(1).bReleased) {
|
||||
for (int i=0;i<OBJECTS.size();i++) {
|
||||
if (OBJECTS[i]->pos==HIGHLIGHTED_TILE*32) {
|
||||
delete OBJECTS[i];
|
||||
OBJECTS.erase(OBJECTS.begin()+i--);
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case GameState::OBJ_SELECT:{
|
||||
|
Loading…
x
Reference in New Issue
Block a user