Switched from 64 tile dimension to 32
64 didn't look very nice on a regular HD screen. Only on my tricky hiDPI laptop.
This commit is contained in:
parent
a1c57b62d0
commit
cdf4949eea
|
@ -2,12 +2,16 @@
|
|||
#define DEFINES_H_
|
||||
|
||||
/* Room/Map dimensions */
|
||||
#define MAP_ROOM_HEIGHT 12
|
||||
#define MAP_ROOM_WIDTH 16
|
||||
#define MAP_ROOM_HEIGHT 12
|
||||
|
||||
#define MAP_V_ROOM_COUNT 10
|
||||
#define MAP_H_ROOM_COUNT 10
|
||||
|
||||
#define TILE_DIMENSION 64
|
||||
#define TILE_DIMENSION 32
|
||||
|
||||
/* Display stuff */
|
||||
#define SCREEN_WIDTH MAP_ROOM_WIDTH * TILE_DIMENSION
|
||||
#define SCREEN_HEIGHT MAP_ROOM_HEIGHT * TILE_DIMENSION
|
||||
|
||||
#endif // DEFINES_H_
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
#include "timer.h"
|
||||
#include "roommatrix.h"
|
||||
|
||||
#define SCREEN_WIDTH 1024
|
||||
#define SCREEN_HEIGHT 768
|
||||
|
||||
static SDL_Window *gWindow = NULL;
|
||||
static SDL_Renderer *gRenderer = NULL;
|
||||
static Sprite *gPlayer = NULL;
|
||||
|
|
|
@ -101,9 +101,9 @@ Sprite* player_create(class_t class, SDL_Renderer *renderer)
|
|||
}
|
||||
|
||||
sprite_load_texture(player, asset, renderer);
|
||||
player->pos = (Position) { 64, 64 };
|
||||
player->pos = (Position) { TILE_DIMENSION, TILE_DIMENSION };
|
||||
player->texture->clip = (SDL_Rect) { 0, 0, 16, 16 };
|
||||
player->texture->dim = (Dimension) { 64, 64 };
|
||||
player->texture->dim = (Dimension) { TILE_DIMENSION, TILE_DIMENSION };
|
||||
player->handle_event = &handle_player_input;
|
||||
|
||||
return player;
|
||||
|
|
|
@ -57,7 +57,7 @@ static void
|
|||
set_light_for_tile(RoomMatrix *matrix, int x, int y)
|
||||
{
|
||||
int x_max, x_min, y_max, y_min, i, j;
|
||||
int lightval;
|
||||
int lightval, distance_modifier;
|
||||
RoomSpace *space;
|
||||
|
||||
space = &matrix->spaces[x][y];
|
||||
|
@ -74,7 +74,8 @@ set_light_for_tile(RoomMatrix *matrix, int x, int y)
|
|||
for (i = x_min; i <= x_max; ++i) {
|
||||
for (j = y_min; j <= y_max; ++j) {
|
||||
lightval = matrix->spaces[i][j].light;
|
||||
lightval += 255 - (max(abs(x-i), abs(y-j)) * 50);
|
||||
distance_modifier = abs(x-i) == abs(y-j) ? abs(x-i) + 1 : max(abs(x-i), abs(y-j));
|
||||
lightval += 255 - (distance_modifier * 50);
|
||||
lightval = min(255, lightval);
|
||||
lightval = max(0, lightval);
|
||||
matrix->spaces[i][j].light = lightval;
|
||||
|
@ -104,7 +105,12 @@ roommatrix_render_lightmap(RoomMatrix *matrix, Camera *cam)
|
|||
light = max(0, 230 - matrix->spaces[i][j].light);
|
||||
SDL_SetRenderDrawColor(cam->renderer,
|
||||
0, 0, 0, light);
|
||||
SDL_Rect box = (SDL_Rect) { i*64, j*64, 64, 64 };
|
||||
SDL_Rect box = (SDL_Rect) {
|
||||
i*TILE_DIMENSION,
|
||||
j*TILE_DIMENSION,
|
||||
TILE_DIMENSION,
|
||||
TILE_DIMENSION
|
||||
};
|
||||
SDL_RenderFillRect(cam->renderer, &box);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue