Переглянути джерело

Refactored points drawing code and revised Chad view...

master
Ognjen Milan Robovic 2 тижднів тому
джерело
коміт
929334dd9f
9 змінених файлів з 49 додано та 44 видалено
  1. +6
    -18
      source/attribute.adb
  2. +1
    -2
      source/attribute.ads
  3. +4
    -3
      source/chad.adb
  4. +13
    -15
      source/skill.adb
  5. +1
    -1
      source/skill.ads
  6. +21
    -3
      source/ui.adb
  7. +1
    -0
      source/ui.ads
  8. +2
    -1
      source/world.adb
  9. +0
    -1
      source/world.ads

+ 6
- 18
source/attribute.adb Переглянути файл

@@ -41,27 +41,15 @@ package body attribute is

procedure draw_points (data : in points := (others => 0);
x : in integer := 0;
y : in integer := 0;
list : in boolean := false) is
--
offset : constant core.vector := ((if list then 0 else core.icon),
(if list then core.icon else 0));
y : in integer := 0) is
move_x : integer := x;
begin
for index in enumeration loop
ui.draw_icon (data => sprite (index),
text => trait (index).text,
x => x + offset.x * enumeration'pos (index),
y => y + offset.y * enumeration'pos (index));
ui.draw_icon (sprite (index), trait (index).text, move_x, y);
ui.draw_text_box (move_x, y + core.icon, core.icon, core.icon);
ui.write (data (index)'image, move_x + 4, y + core.icon + 8, (255, 255, 255, 255), 15, true);
--
ui.draw_icon_menu (x => x + offset.x * enumeration'pos (index) + offset.y,
y => y + offset.y * enumeration'pos (index) + offset.x,
width => core.icon,
height => core.icon);
--
ui.write (text => data (index)'image,
x => x + offset.x * enumeration'pos (index) - 3 + offset.y,
y => y + offset.y * enumeration'pos (index) + 6 + offset.x,
size => 18);
move_x := move_x + core.icon;
end loop;
end draw_points;



+ 1
- 2
source/attribute.ads Переглянути файл

@@ -41,8 +41,7 @@ package attribute is

procedure draw_points (data : in points := (others => 0);
x : in integer := 0;
y : in integer := 0;
list : in boolean := false);
y : in integer := 0);

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



+ 4
- 3
source/chad.adb Переглянути файл

@@ -83,18 +83,19 @@ package body chad is
size => 15,
code => true);
--
attribute.draw_points (player.attributes, x, y + 96 + 2 * offset, false);
--~skill.draw_points (player.skills, x + core.icon * 3, y, true);
attribute.draw_points (player.attributes, x, y + 96 + 3 * offset);
--
for index_y in 0 .. 3 loop
for index_x in 0 .. 5 loop
ui.draw_icon (data => equipment.icon_sprite (player.items (6 * index_y + index_x)),
text => equipment.trait (player.items (6 * index_y + index_x)).name,
x => x + index_x * core.icon,
y => y + 96 + 3 * offset + 2 * core.icon + index_y * core.icon);
y => y + 96 + 4 * offset + 2 * core.icon + index_y * core.icon);
--~equipment.draw_icon (player.items (), x + index_x * core.icon, y + 96 + 3 * offset + 2 * core.icon + index_y * core.icon);
end loop;
end loop;
--
skill.draw_points (player.skills, x, y + 96 + 5 * offset + 6 * core.icon);
end draw_data;

------------------------------------------------------------------------------------------


+ 13
- 15
source/skill.adb Переглянути файл

@@ -41,25 +41,23 @@ package body skill is

------------------------------------------------------------------------------------------

procedure draw_points (data : in points; x, y : in integer; list : in boolean) is
offset : constant core.vector := ((if list then 0 else core.icon),
(if list then core.icon else 0));
procedure draw_points (data : in points; x, y : in integer) is
move_x : integer := x;
move_y : integer := y;
begin
for index in enumeration loop
ui.draw_icon (data => sprite (index),
text => trait (index).text,
x => x + offset.x * enumeration'pos (index),
y => y + offset.y * enumeration'pos (index));
if (enumeration'pos (index) + 1) mod (count / 2 + 1) = 0 then
move_x := x + 2 * core.icon + 120;
move_y := y;
end if;
--
ui.draw_icon (sprite (index), trait (index).text, move_x, move_y);
ui.draw_text_box (move_x + core.icon, move_y, core.icon, core.icon);
ui.write (data (index)'image, move_x + core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
--
ui.draw_icon_menu (x => x + offset.x * enumeration'pos (index) + offset.y,
y => y + offset.y * enumeration'pos (index) + offset.x,
width => core.icon,
height => core.icon);
ui.write (trait (index).name, move_x + 2 * core.icon + 4, move_y + 8, (255, 255, 255, 255), 15, true);
--
ui.write (text => data (index)'image,
x => x + offset.x * enumeration'pos (index) - 3 + offset.y,
y => y + offset.y * enumeration'pos (index) + 6 + offset.x,
size => 18);
move_y := move_y + core.icon;
end loop;
end draw_points;



+ 1
- 1
source/skill.ads Переглянути файл

@@ -53,7 +53,7 @@ package skill is

procedure configure;

procedure draw_points (data : in points; x, y : in integer; list : in boolean);
procedure draw_points (data : in points; x, y : in integer);

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



+ 21
- 3
source/ui.adb Переглянути файл

@@ -142,7 +142,7 @@ package body ui is

------------------------------------------------------------------------------------------

procedure draw_text_box is
procedure draw_popup_box is
width : constant integer := 320;
height : constant integer := core.icon;
middle : constant integer := sprite (active, text_middle).width;
@@ -161,7 +161,7 @@ package body ui is
draw (text_lower_right, core.cursor.x + width - middle + offset, core.cursor.y + height - middle + offset);
--
write (core.read_text_box, core.cursor.x + 4 + offset, core.cursor.y + 6 + offset);
end draw_text_box;
end draw_popup_box;

------------------------------------------------------------------------------------------

@@ -255,7 +255,7 @@ package body ui is
end loop;
--
if read_text_box /= "--" then
draw_text_box;
draw_popup_box;
end if;
--
core.write_text_box ("--");
@@ -321,6 +321,24 @@ package body ui is

------------------------------------------------------------------------------------------

procedure draw_text_box (x, y, width, height : in integer) is
middle : constant integer := sprite (active, text_middle).width;
begin
draw_background (text_middle, x + middle, y + middle, width - 2 * middle, height - 2 * middle);
--
draw_horizontally (text_upper, x + middle, y, width - 2 * middle);
draw_horizontally (text_lower, x + middle, y + height - middle, width - 2 * middle);
draw_vertically (text_left, x, y + middle, height - 2 * middle);
draw_vertically (text_right, x + width - middle, y + middle, height - 2 * middle);
--
draw (text_upper_left, x, y);
draw (text_upper_right, x + width - middle, y);
draw (text_lower_left, x, y + height - middle);
draw (text_lower_right, x + width - middle, y + height - middle);
end draw_text_box;

------------------------------------------------------------------------------------------

procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle_skip'access) is
offset : constant integer := sprite (active, text_middle).width;
begin


+ 1
- 0
source/ui.ads Переглянути файл

@@ -64,6 +64,7 @@ package ui is

procedure draw_sprite (data : in core.sprite; text : in string; x, y, offset : in integer; action : core.pointer := core.idle_skip'access);

procedure draw_text_box (x, y, width, height : in integer);
procedure draw_help_box (x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);

procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);


+ 2
- 1
source/world.adb Переглянути файл

@@ -8,13 +8,14 @@ package body world is

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

view_reach : constant integer := 48;
view_reach : constant integer := 96;

construction_limit : constant natural := 120;
equipment_limit : constant natural := 600;
unit_limit : constant natural := 600;
chad_limit : constant natural := 8;

tiles : core.sprite;
dark : core.sprite;
border_upper : core.sprite;
border_lower : core.sprite;


+ 0
- 1
source/world.ads Переглянути файл

@@ -57,7 +57,6 @@ package world is

biome_count : constant natural := biome'pos (biome'last) + 1;

tiles : core.sprite;
landmarks : array (landmark_index) of core.sprite;

landmark_limit : constant integer := 360;


Завантаження…
Відмінити
Зберегти