diff --git a/src/game.cc b/src/game.cc index b4d28ea..5c6de38 100644 --- a/src/game.cc +++ b/src/game.cc @@ -131,16 +131,15 @@ void load_game() { add_mouse_button_listener(SDL_BUTTON_RMASK, &on_erase); add_mouse_button_listener(SDL_BUTTON_MMASK, &on_middle_mouse); add_mouse_listener(0, &on_drag_world); - } void start_game() { g_active_view.width = 21; + on_clear_key(1); } void update_game() { if(drawing == 1) drawing = 2; - update_input(); mouse_world_position(&cursor.x, &cursor.y); cursor.x += 0.1f; cursor.y += 0.1f; @@ -175,26 +174,27 @@ void update_game() { } void update_ui() { - rectshape_t shape = (rectshape_t){ - 0.0f, 0.0f, 1.f, 0.015f, 0, RLAYER_UI, - {100,100,100,255}, {0,0,0,0} - }; - int w = world_sheet.w / world_sheet.tile_width, - h = world_sheet.h / world_sheet.tile_height, - offset_selected = cursor_tile - 1; + update_input(); + + const int offset_selected = cursor_tile - 1; + rectshape_t selected_tile_rect = (rectshape_t) { offset_selected * 0.015f, 0.f, 0.015f, 0.015f, 0.001f, RLAYER_UI-10, {0,0,0,0}, {255, 255, 255, 255} }; draw_rect(&selected_tile_rect); + + rectshape_t shape = (rectshape_t) { + 0.0f, 0.0f, 1.f, 0.015f, 0, RLAYER_UI, + {100,100,100,255}, {0,0,0,0} + }; draw_rect(&shape); - int i = 0; float mx, my; mouse_screen_position(&mx, &my); - for(auto& original: g_tilemap.tileset.set) { + for(int i=0;i