Mario: set scene's background objects
This commit is contained in:
parent
0608202483
commit
e283b36229
@ -11,6 +11,7 @@
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <unordered_set>
|
||||
#include "global_vars.hpp"
|
||||
#include "objectids.hpp"
|
||||
#include "blocks.hpp"
|
||||
@ -251,6 +252,17 @@ int main() {
|
||||
scene->moveEverything( -mario->getDoubleRect().first.getX() + 0.2, 0 );
|
||||
update = true;
|
||||
moving_objects.push_back(mario);
|
||||
|
||||
std::unordered_set<uint64_t> background_ids = {
|
||||
HILL_INCLINE_ID, HILL_DECLINE_ID, HILL_DOTS_RIGHT_ID, HILL_DOTS_LEFT_ID,
|
||||
HILL_FILL_ID, HILL_TOP_ID, BUSH_LEFT_ID, BUSH_MIDDLE_ID, BUSH_RIGHT_ID,
|
||||
CLOUD_LEFT_BOTTOM_ID, CLOUD_MIDDLE_BOTTOM_ID, CLOUD_RIGHT_BOTTOM_ID,
|
||||
CLOUD_LEFT_TOP_ID, CLOUD_MIDDLE_TOP_ID, CLOUD_RIGHT_TOP_ID,
|
||||
CASTLE_LEFT_ID, CASTLE_RIGHT_ID, CASTLE_BLACK_ID, CASTLE_ENTRY_ID,
|
||||
CASTLE_TOWER_ID, CASTLE_TOWER_FILLED_ID, WATER_TOP_ID, WATER_FILL_ID };
|
||||
scene->setBackgroundObjectIDs(background_ids);
|
||||
scene->updateBackgroundObjectZIndex();
|
||||
|
||||
while ( !quit ) {
|
||||
SDL_PumpEvents();
|
||||
SDL_framerateDelay( &gFPS );
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
// TODO remove coin_block?
|
||||
coin_block = coin;
|
||||
_scene.addObject(coin);
|
||||
_scene.setZIndex(coin, 1);
|
||||
_scene.moveZJustAboveBackground(coin);
|
||||
}
|
||||
|
||||
bool hasCoinBlock() {
|
||||
@ -96,7 +96,7 @@ public:
|
||||
|
||||
void setMushroomBlock(std::shared_ptr<MarioBlock> &mushroom) {
|
||||
_scene.addObject(mushroom);
|
||||
_scene.setZIndex(mushroom, 1);
|
||||
_scene.moveZJustAboveBackground(mushroom);
|
||||
_moving_objects.push_back(mushroom);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user