Add initial test file for tilemap collision
parent
5a0aa9e906
commit
462bbef59c
|
@ -18,3 +18,43 @@ endif ()
|
|||
|
||||
enable_testing()
|
||||
add_subdirectory(engine)
|
||||
|
||||
set(GAME_LIBS
|
||||
engine
|
||||
)
|
||||
macro(add_target_exe name)
|
||||
add_executable(${name}
|
||||
${name}.c
|
||||
#tracy/public/TracyClient.cpp
|
||||
)
|
||||
target_include_directories(${name}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
#PUBLIC
|
||||
#tracy/public/
|
||||
)
|
||||
if (RUN_PROFILER)
|
||||
target_compile_definitions(${name}
|
||||
PUBLIC
|
||||
TRACY_ENABLE
|
||||
TRACY_ON_DEMAND
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT EMSCRIPTEN)
|
||||
if (INCLUDE_ASAN)
|
||||
target_compile_options(${name} PRIVATE -fsanitize=address -gdwarf-4)
|
||||
target_link_options(${name} PRIVATE -fsanitize=address -gdwarf-4)
|
||||
endif ()
|
||||
if (EXPORT_MMAP)
|
||||
target_link_options(${name} PRIVATE -Xlinker -Map=scene_test.map)
|
||||
endif()
|
||||
endif ()
|
||||
target_link_libraries(${name}
|
||||
PUBLIC
|
||||
${GAME_LIBS}
|
||||
)
|
||||
endmacro()
|
||||
|
||||
add_target_exe(tile_test)
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
#include "raylib.h"
|
||||
enum TileType {
|
||||
TILE_EMPTY = 0,
|
||||
TILE_SOLID_FULL = 1,
|
||||
};
|
||||
|
||||
#define TILE_SIZE 32
|
||||
#define WINDOW_WIDTH 640
|
||||
#define WINDOW_HEIGHT 320
|
||||
#define TILEMAP_WIDTH (WINDOW_WIDTH / TILE_SIZE)
|
||||
#define TILEMAP_HEIGHT (WINDOW_HEIGHT / TILE_SIZE)
|
||||
#define N_TILES (TILEMAP_WIDTH * TILEMAP_HEIGHT)
|
||||
|
||||
static enum TileType tiles[N_TILES] = {0};
|
||||
|
||||
int main(void)
|
||||
{
|
||||
InitWindow(640, 320, "raylib");
|
||||
SetTargetFPS(60);
|
||||
|
||||
while(!WindowShouldClose())
|
||||
{
|
||||
// TODO: Get Click location and toggle the tile
|
||||
// TODO: Need to add feature to disable/enable tile edges and vertices
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
EndDrawing();
|
||||
}
|
||||
CloseWindow();
|
||||
}
|
Loading…
Reference in New Issue