diff --git a/src/game.cc b/src/game.cc index 61cca65..ea10e0f 100644 --- a/src/game.cc +++ b/src/game.cc @@ -2,6 +2,7 @@ #include "input.h" #include "render.h" #include "assets.h" +#include "layers.h" #include "tilemap.hpp" #include "SDL2/SDL_mouse.h" #include @@ -63,11 +64,11 @@ void load_game() { g_tilemap.width = g_tilemap.height = 10; player = make_sprite("tilemap.png", 0, 0); - player.depth = -10; current_tile_display = make_sprite("tilemap.png", 0, 0); - current_tile_display.sx = 0.3f; - current_tile_display.sy = 0.3f; + current_tile_display.depth = 0; + current_tile_display.sx = 0.15f; + current_tile_display.sy = 0.15f; world_sheet = make_spritesheet("tilemap.png", 16, 16); @@ -81,10 +82,9 @@ void load_game() { for(int i=0;irect.y * hm; } SDL_Color c = cmd->rect.background; - //SDL_SetRenderDrawBlendMode(g_context.renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawColor(g_context.renderer, c.r, c.g, c.b, c.a); SDL_RenderFillRectF(g_context.renderer, &rect); c = cmd->rect.line; @@ -161,9 +160,9 @@ void draw(const drawcmd_t* cmd) { if(top != bot) { while(bot <= top) { med = floor((float)(top + bot) / 2); - if(g_drawdata[med].ui > ui || g_drawdata[med].depth > cmd->depth) { + if(g_drawdata[med].ui < ui || g_drawdata[med].depth > cmd->depth) { bot = med+1; - } else if(g_drawdata[med].ui <= ui || g_drawdata[med].depth < cmd->depth) { + } else if(g_drawdata[med].ui >= ui || g_drawdata[med].depth < cmd->depth) { top = med-1; } else { break;