Work in progress grid rendering...

This commit is contained in:
Ognjen Milan Robovic 2024-02-17 18:13:17 -05:00
parent f735870207
commit b6e7a1153e
6 changed files with 52 additions and 6 deletions

View File

@ -179,6 +179,39 @@ package body core is
return result;
end uppercase;
------------------------------------------------------------------------------------------
procedure draw_central_grid (x, y, width, height : in integer) is
begin
render_vector (width / 2 + x, y, width / 2 + x, height + y);
render_vector ( x, height / 2 + y, width + x, height / 2 + y);
end draw_central_grid;
------------------------------------------------------------------------------------------
procedure draw_squared_grid (x, y, width, height : in integer) is
offset_x : constant integer := x + base + (width mod base) / 2;
offset_y : constant integer := y + base / 2 + (height mod base) / 2;
begin
for horizontal in 0 .. height / base
loop
render_vector (x, offset_y + horizontal * base, x + width, offset_y + horizontal * base);
--
for vertical in 0 .. width / base
loop
render_vector (offset_x + vertical * base, y, offset_x + vertical * base, y + height);
end loop;
end loop;
end draw_squared_grid;
------------------------------------------------------------------------------------------
procedure draw_hexagon_grid (x, y, width, height : in integer) is
begin
render_vector (width / 2 + x, y, width / 2 + x, height + y);
render_vector ( x, height / 2 + y, width + x, height / 2 + y);
end draw_hexagon_grid;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core;

View File

@ -72,6 +72,7 @@ package core is
procedure render_sprite (sprite, x, y, u, v, width, height : in integer) with import => true, convention => c;
procedure render_string (text : in string; x, y, colour : in integer; monospace : in boolean) with import => true, convention => c;
procedure render_vector (x1, y1, x2, y2 : in integer) with import => true, convention => c;
function import_sprite (file_path : in string) return integer with import => true, convention => c;
function sprite_width (index : in integer) return integer with import => true, convention => c;
@ -109,6 +110,10 @@ package core is
function lowercase (text : in string) return string;
function uppercase (text : in string) return string;
procedure draw_central_grid (x, y, width, height : in integer);
procedure draw_squared_grid (x, y, width, height : in integer);
procedure draw_hexagon_grid (x, y, width, height : in integer);
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
end core;

View File

@ -81,6 +81,9 @@ begin
--~construction.draw (this, 128 * (construction.codex'pos (this) mod 12) + 32, 128 * (construction.codex'pos (this) / 12) + 32);
--~end loop;
--
core.draw_central_grid (24, 24, core.window_width - 480 - 48, core.window_height - 48);
core.draw_squared_grid (24, 24, core.window_width - 480 - 48, core.window_height - 48);
--
ui.draw_menu (0, 0, core.window_width - 480, core.window_height, false);
ui.draw_tiny_menu (core.window_width - 480, 0, 480, core.window_height, true);
--
@ -99,8 +102,8 @@ begin
--
core.draw_state_box (1352, 32);
--
menu.draw (menu.attribute_information, 100, 100);
menu.draw (menu.resource_information, 600, 100);
--~menu.draw (menu.attribute_information, 100, 100);
--~menu.draw (menu.resource_information, 600, 100);
end loop gameplay;
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -54,6 +54,8 @@ extern int window_height (void);
extern void render_sprite (int sprite, int x, int y, int u, int v, int width, int height);
extern void render_string (char * string, int x, int y, int colour, char monospace);
extern void render_vector (int x1, int y1, int x2, int y2);
extern void engine_configure (void);
extern void engine_synchronize (void);
@ -103,6 +105,10 @@ void render_string (char * string, int x, int y, int colour, char monospace) {
DrawTextPro ((monospace != 0) ? mono : font, string, position, dump, 0.0, 18, 3, new_tint);
}
void render_vector (int x1, int y1, int x2, int y2) {
DrawLine (x1, y1, x2, y2, RED);
}
void engine_configure (void) {
engine_active = 1;

View File

@ -25,8 +25,8 @@ package body ui is
end load_ui;
begin
load_ui (default, "default/");
load_ui (yd, "yd/");
load_ui (steam, "steam/");
--~load_ui (yd, "yd/");
--
active := default;
end configure;

View File

@ -5,7 +5,7 @@ package ui is
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
type style is (
default, yd, steam
default, steam, yd
);
type codex is (
@ -19,8 +19,7 @@ package ui is
frame_left, frame_middle, frame_right,
frame_lower_left, frame_lower, frame_lower_right,
cursor,
fill_bar_left, fill_bar_horizontal, fill_bar_right,
fill_in_left, fill_in_horizontal, fill_in_right,
fill_bar_left, fill_bar_horizontal, fill_bar_right, fill_horizontal,
scroll_bar_lower, scroll_bar_middle, scroll_bar_upper,
title_bar_left, title_bar_middle, title_bar_right
);