2023-12-20 00:07:54 -05:00
|
|
|
#include "game.h"
|
2023-12-21 13:03:16 -05:00
|
|
|
#include "render.h"
|
2023-12-20 00:07:54 -05:00
|
|
|
#include "engine.h"
|
|
|
|
#include "menu.h"
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-22 02:09:39 -05:00
|
|
|
#include <stdio.h>
|
2023-12-23 10:53:45 -05:00
|
|
|
#include <raylib.h>
|
2023-12-22 02:09:39 -05:00
|
|
|
|
|
|
|
extern int snprintf (char *, unsigned long, const char *, ...);
|
|
|
|
|
|
|
|
static void limit (int * pointer, int minimum, int maximum) {
|
|
|
|
if (* pointer < minimum) { * pointer = minimum; }
|
|
|
|
if (* pointer > maximum) { * pointer = maximum; }
|
|
|
|
}
|
|
|
|
|
|
|
|
static void debug (void) {
|
|
|
|
char string [64] = "";
|
|
|
|
snprintf (string, 64, "%i -- %i", camera_x, camera_y);
|
|
|
|
render_string (string, 0, 0);
|
|
|
|
}
|
|
|
|
|
2023-12-19 20:58:08 -05:00
|
|
|
int main (void) {
|
2023-12-20 00:07:54 -05:00
|
|
|
game_configure ();
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-21 13:03:16 -05:00
|
|
|
render_configure ();
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-20 00:07:54 -05:00
|
|
|
menu_configure ();
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-23 10:53:45 -05:00
|
|
|
chad_world_model [0] [0] = 44;
|
|
|
|
chad_world_model_x [0] [0] = 2;
|
|
|
|
chad_world_model_y [0] [0] = 2;
|
|
|
|
chad_world_model [0] [1] = 44;
|
|
|
|
chad_world_model_x [0] [1] = 3;
|
|
|
|
chad_world_model_y [0] [1] = 3;
|
|
|
|
chad_world_model [0] [2] = 44;
|
|
|
|
chad_world_model_x [0] [2] = 3;
|
|
|
|
chad_world_model_y [0] [2] = 2;
|
|
|
|
chad_world_model [0] [3] = 44;
|
|
|
|
chad_world_model_x [0] [3] = 2;
|
|
|
|
chad_world_model_y [0] [3] = 3;
|
|
|
|
|
2023-12-19 20:58:08 -05:00
|
|
|
while (! WindowShouldClose ()) {
|
2023-12-21 23:08:09 -05:00
|
|
|
Color tint = { 0, 0, 0, 0 };
|
|
|
|
|
2023-12-23 10:53:45 -05:00
|
|
|
if (IsKeyPressed (KEY_RIGHT)) { camera_x++; limit (& camera_x, 0, CHAD_WORLD_WIDTH - (render_width () / (int) (BASE_SIZE * render_zoom))); }
|
|
|
|
if (IsKeyPressed (KEY_LEFT)) { camera_x--; limit (& camera_x, 0, CHAD_WORLD_WIDTH - (render_width () / (int) (BASE_SIZE * render_zoom))); }
|
|
|
|
if (IsKeyPressed (KEY_DOWN)) { camera_y++; limit (& camera_y, 0, CHAD_WORLD_HEIGHT - (render_height () / (int) (BASE_SIZE * render_zoom))); }
|
|
|
|
if (IsKeyPressed (KEY_UP)) { camera_y--; limit (& camera_y, 0, CHAD_WORLD_HEIGHT - (render_height () / (int) (BASE_SIZE * render_zoom))); }
|
|
|
|
|
|
|
|
if (IsKeyPressed (KEY_T)) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; }
|
|
|
|
if (IsKeyPressed (KEY_S)) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; }
|
|
|
|
if (IsKeyPressed (KEY_V)) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; }
|
|
|
|
if (IsKeyPressed (KEY_R)) { menu_show [menu_resources] = menu_show [menu_resources] ? 0 : 1; }
|
|
|
|
|
|
|
|
/*if (IsKeyPressed (KEY_P)) { dump_world_screenshot (); }*/
|
|
|
|
|
2023-12-19 20:58:08 -05:00
|
|
|
BeginDrawing ();
|
|
|
|
|
2023-12-21 23:08:09 -05:00
|
|
|
ClearBackground (tint);
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-22 02:09:39 -05:00
|
|
|
view_map (camera_x, camera_y);
|
2023-12-23 10:53:45 -05:00
|
|
|
/*
|
2023-12-21 23:08:09 -05:00
|
|
|
view_base_1 (0, 32, 128);
|
|
|
|
view_base_1 (1, 32, 512);
|
|
|
|
|
|
|
|
view_base_2 (0, 1024, 128);
|
|
|
|
view_base_2 (1, 1024, 512);
|
2023-12-23 10:53:45 -05:00
|
|
|
|
2023-12-21 23:08:09 -05:00
|
|
|
for (int i = 0; i < 18; ++i) {
|
|
|
|
view_unit (orc, i, 900 + 32 * i, 32);
|
|
|
|
view_unit (human, i, 900 + 32 * i, 64);
|
|
|
|
view_unit (elf, i, 900 + 32 * i, 96);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
view_hud (0, SIDE_SIZE, render_height (), render_width () - SIDE_SIZE, 0);
|
|
|
|
view_hud (1, render_width () - SIDE_SIZE, render_height (), 0, 0);
|
2023-12-22 02:09:39 -05:00
|
|
|
debug ();
|
2023-12-21 16:59:45 -05:00
|
|
|
view_neon_menu (menu_resources, 1, 0, 0);
|
|
|
|
|
2023-12-21 20:19:30 -05:00
|
|
|
view_neon_menu (menu_traits, 1, 0, 0);
|
|
|
|
view_neon_menu (menu_skills, 1, 0, 0);
|
|
|
|
view_neon_menu (menu_values, 1, 0, 0);
|
2023-12-21 23:08:09 -05:00
|
|
|
/*
|
|
|
|
Rectangle source = { 0, 0, BASE_SIZE * 15, BASE_SIZE * 10 };
|
|
|
|
Rectangle destination = { 128, 128, BASE_SIZE * 15 * zoom, BASE_SIZE * 10 * zoom };
|
2023-12-19 20:58:08 -05:00
|
|
|
|
2023-12-21 23:08:09 -05:00
|
|
|
DrawTexturePro (vvv, source, destination, (Vector2) { 0, 0 }, 0.0F, WHITE);
|
|
|
|
*/
|
2023-12-19 20:58:08 -05:00
|
|
|
EndDrawing ();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|