diff --git a/source/engine.c b/source/engine.c index 46ccc42..6cc61bd 100644 --- a/source/engine.c +++ b/source/engine.c @@ -38,6 +38,10 @@ void view_menu (int menu, int align, int x, int y) { void view_neon_menu (int menu, int align, int x, int y) { int item; + if (menu_show [menu] == 0) { + return; + } + int width = (int) strlen (menu_text [menu] [0]) + 4; int height = menu_items [menu] + 4; @@ -59,7 +63,7 @@ void view_neon_menu (int menu, int align, int x, int y) { } for (int n = 1; n < height - 1; ++n) { - render_sprite (neonui, aligned_x, aligned_y + n * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE); + render_sprite (neonui, aligned_x, aligned_y + n * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE); render_sprite (neonui, aligned_x + ICON_SIZE * (width - 1), aligned_y + n * ICON_SIZE, 256, 128, ICON_SIZE, ICON_SIZE); } @@ -89,7 +93,15 @@ void view_map (void) { int index = chad_world [0] [x] [y]; int catch = (y * y + x + x / (y + 1) + y / (x + 1)) % chad_block_change [index]; - render_sprite (ashlands, x * BASE_SIZE, y * BASE_SIZE, catch * BASE_SIZE, index * BASE_SIZE, BASE_SIZE, BASE_SIZE); + render_sprite (ashlands, (int) (x * BASE_SIZE * render_zoom), (int) (y * BASE_SIZE * render_zoom), catch * BASE_SIZE, index * BASE_SIZE, BASE_SIZE, BASE_SIZE); } } } + +void view_base_1 (int index, int x, int y) { + render_sprite (base_1, x, y, 0, index * 7 * BASE_SIZE, 10 * BASE_SIZE, 7 * BASE_SIZE); +} + +void view_base_2 (int index, int x, int y) { + render_sprite (base_2, x, y, 0, index * 10 * BASE_SIZE, 15 * BASE_SIZE, 10 * BASE_SIZE); +} diff --git a/source/engine.h b/source/engine.h index 3c48bb7..35089f2 100644 --- a/source/engine.h +++ b/source/engine.h @@ -15,4 +15,7 @@ extern void view_neon_menu (int menu, int align, int x, int y); extern void view_map (void); +extern void view_base_1 (int index, int x, int y); +extern void view_base_2 (int index, int x, int y); + #endif diff --git a/source/main.c b/source/main.c index 66feb3f..624a4dd 100644 --- a/source/main.c +++ b/source/main.c @@ -17,28 +17,33 @@ int main (void) { view_map (); - menu_show [menu_resources] = 1; - menu_show [menu_traits] = 1; - //~menu_show [menu_skills] = 1; - //~menu_show [menu_values] = 1; + view_base_1 (0, 100, 100); + view_base_1 (1, 100, 400); + + view_base_2 (0, 1300, 100); + view_base_2 (1, 1300, 500); + + //~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); + //~} + + if (IsKeyPressed (KEY_RIGHT)) { menu_show [menu_traits] = menu_show [menu_traits] ? 0 : 1; } + if (IsKeyPressed (KEY_LEFT)) { menu_show [menu_skills] = menu_show [menu_skills] ? 0 : 1; } + if (IsKeyPressed (KEY_DOWN)) { menu_show [menu_values] = menu_show [menu_values] ? 0 : 1; } view_neon_menu (menu_resources, 1, 0, 0); - view_menu (menu_traits, 0, 0, 0); - view_menu (menu_skills, 0, 200, 0); - view_menu (menu_values, 0, 400, 0); + view_neon_menu (menu_traits, 1, 0, 0); + view_neon_menu (menu_skills, 1, 0, 0); + view_neon_menu (menu_values, 1, 0, 0); //~Rectangle source = { 0, 0, BASE_SIZE * 15, BASE_SIZE * 10 }; //~Rectangle destination = { 128, 128, BASE_SIZE * 15 * zoom, BASE_SIZE * 10 * zoom }; //~DrawTexturePro (vvv, source, destination, (Vector2) { 0, 0 }, 0.0F, WHITE); - 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); - } - EndDrawing (); } diff --git a/source/render.c b/source/render.c index 908cca6..4b51b00 100644 --- a/source/render.c +++ b/source/render.c @@ -1,5 +1,7 @@ #include "render.h" +float render_zoom = 2.0; + Texture2D render_texture [render_texture_count]; int render_width (void) { return (GetScreenWidth ()); } @@ -7,7 +9,7 @@ int render_height (void) { return (GetScreenHeight ()); } void render_sprite (int sprite, int x, int y, int u, int v, int width, int height) { Rectangle source = { u, v, width, height }; - Rectangle destination = { x, y, width, height }; + Rectangle destination = { x, y, width * ((sprite <= ui) ? 1 : render_zoom), height * ((sprite <= ui) ? 1 : render_zoom) }; Vector2 origin = { 0, 0 }; DrawTexturePro (render_texture [sprite], source, destination, origin, 0.0, WHITE); @@ -41,4 +43,6 @@ void render_configure (void) { render_texture [humans] = LoadTexture ("sprite/humans.png"); render_texture [elves] = LoadTexture ("sprite/elves.png"); render_texture [ashlands] = LoadTexture ("sprite/ashlands.png"); + render_texture [base_1] = LoadTexture ("sprite/base_1.png"); + render_texture [base_2] = LoadTexture ("sprite/base_2.png"); } diff --git a/source/render.h b/source/render.h index 4e93c72..cd90607 100644 --- a/source/render.h +++ b/source/render.h @@ -11,9 +11,12 @@ enum { neonui, ui, traits, skills, values, orcs, humans, elves, ashlands, + base_1, base_2, render_texture_count }; +extern float render_zoom; + extern Texture2D render_texture [render_texture_count]; extern int render_width (void); diff --git a/sprite/base_1.png b/sprite/base_1.png new file mode 100644 index 0000000..1acf1e1 Binary files /dev/null and b/sprite/base_1.png differ diff --git a/sprite/base_2.png b/sprite/base_2.png new file mode 100644 index 0000000..08f206e Binary files /dev/null and b/sprite/base_2.png differ