test tiles

This commit is contained in:
2025-06-16 20:46:03 -05:00
parent ba6ecf9006
commit c9f795e55c
10 changed files with 188 additions and 84 deletions

View File

@ -9,6 +9,7 @@
#include "assert/assert.h"
#include "input.h"
#include "display/render.h"
#include "world/world.h"
void playerInit() {
entity_t *ent = &ENTITIES[0];
@ -16,8 +17,8 @@ void playerInit() {
entityInit(ent, ENTITY_TYPE_PLAYER);
ent->id = PLAYER_ENTITY_ID;
ent->x = 32;
ent->y = 32;
ent->x = WORLD_PLAYER_SPAWN_X;
ent->y = WORLD_PLAYER_SPAWN_Y;
}
void playerNPCInit(entity_t *entity) {

View File

@ -47,6 +47,7 @@ void drawOverworldDraw(void) {
};
uint8_t colorCount = sizeof(colors) / sizeof(Color);
BeginBlendMode(BLEND_ALPHA_PREMULTIPLY);
do {
// Base layer
for(uint8_t i = 0; i < CHUNK_TILE_COUNT; i++) {
@ -98,6 +99,7 @@ void drawOverworldDraw(void) {
chunk++;
} while(chunk < CHUNK_MAP.chunks + CHUNK_MAP_COUNT);
EndBlendMode();
// Entities
entity_t *entity = ENTITIES;

View File

@ -45,7 +45,7 @@ void renderDraw(void) {
// Draw the render texture to the screen.
BeginDrawing();
ClearBackground(WHITE);
ClearBackground(RED);
// Keep aspect and center the render
int32_t renderWidth, renderHeight, renderX, renderY;
const int32_t width = GetScreenWidth();
@ -74,6 +74,8 @@ void renderDraw(void) {
void renderDispose(void) {
UnloadRenderTexture(RENDER_SCREEN_TEXTURE);
UnloadTexture(RENDER_TILEMAP_TEXTURE);
UnloadTexture(RENDER_ENTITIES_TEXTURE);
CloseWindow();
}