From 57fe8f3c4124819b95164547333a33f4c45eac8d Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 10 Mar 2019 12:07:40 -0400 Subject: Editor now allows tile placement You can scroll through the three layers (map, track, object) with Z/X. You can swap between focusing on the map and the tileset with TAB. You can place tiles with enter or space. Pretty rudimentary, but it's a start. --- src/editor.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/editor.h') diff --git a/src/editor.h b/src/editor.h index dc908b9..dbf50c0 100644 --- a/src/editor.h +++ b/src/editor.h @@ -3,10 +3,26 @@ #include "state.h" #include "vector.h" +#include "level.h" +#include "input.h" +#include "input_lag.h" class Editor : public State { public: + Editor(SDL_Renderer* ren) : level_(ren) + { + surface_ptr bgSurf(IMG_Load("../res/editor_bg.png")); + + if (!bgSurf) + { + throw img_error(); + } + + background_.reset(SDL_CreateTextureFromSurface(ren, bgSurf.get())); + bgSize_ = { bgSurf->w, bgSurf->h }; + } + void tick( double dt, const Uint8* keystate) override; @@ -15,9 +31,23 @@ public: private: + Level level_; + texture_ptr background_; vec2i bgSize_; + texture_ptr renderedMap_; + + bool mapFocus_ = true; + vec2s cursor_; + + size_t selectedTile_ = 0; + + Input input_; + InputLag inputLag_; + + Layer layer_ = Layer::map; + }; #endif /* end of include guard: EDITOR_H_8BB54FE3 */ -- cgit 1.4.1