Przeglądaj źródła

Added check boxes...

master
Ognjen Milan Robovic 1 tydzień temu
rodzic
commit
e75c62b0d0
3 zmienionych plików z 21 dodań i 6 usunięć
  1. +2
    -0
      source/main.adb
  2. +17
    -6
      source/ui.adb
  3. +2
    -0
      source/ui.ads

+ 2
- 0
source/main.adb Wyświetl plik

@@ -122,6 +122,8 @@ procedure main is
draw (game_title, center_x (game_title.width * 2), center_y (game_title.height * 2), factor => 2);
--
write ("Main Menu", 0, 0);
--
ui.draw_check_box (32, 32, view_list (map_preview_panel), "Test");
end main_menu;

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


+ 17
- 6
source/ui.adb Wyświetl plik

@@ -38,7 +38,9 @@ package body ui is
--
scroll_bar_lower, scroll_bar_middle, scroll_bar_upper,
--
title_bar_left, title_bar_middle, title_bar_right
title_bar_left, title_bar_middle, title_bar_right,
--
check_box_on, check_box_off
);

------------------------------------------------------------------------------------------
@@ -171,11 +173,6 @@ package body ui is
for x in 0 .. data.gui_n - 1 loop
case data.gui_list (x).kind is
when gui_button =>
--~draw_frame (data.gui_list (x).info, button_data.x, button_data.y, button_data.width, button_data.height);
--~draw_icon (data.gui_list (x).image, data.gui_list (x).info, button_data.x + offset, button_data.y + offset);
--~write (data.gui_list (x).text,
--~button_data.x + offset + core.icon + (core.icon - font (active).scale) / 2,
--~button_data.y + offset + (core.icon - font (active).scale) / 2);
draw_button (text => data.gui_list (x).text,
description => data.gui_list (x).info,
icon => data.gui_list (x).image,
@@ -379,6 +376,20 @@ package body ui is

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

procedure draw_check_box (x, y : in integer; on : in out boolean; text : in string) is
begin
draw ((if on then check_box_on else check_box_off), x, y);
--
write (text, x + sprite (active, check_box_on).width, y);
--
if core.cursor_mode = 1 and core.cursor_inside (x, y, sprite (active, check_box_on).width, sprite (active, check_box_on).height) then
on := not on;
core.cursor_mode := 0;
end if;
end draw_check_box;

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

procedure draw_title_bar (x, y, width : in integer; title : in string) is
middle_width : constant integer := width - sprite (active, title_bar_left).width - sprite (active, title_bar_right).width;
offset : constant integer := (sprite (active, title_bar_middle).height - font (active).scale) / 2;


+ 2
- 0
source/ui.ads Wyświetl plik

@@ -67,6 +67,8 @@ package ui is
procedure draw_frame (description : in string; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);
procedure draw_button (text, description : in string; icon : in core.sprite; x, y, width, height : in integer; action : core.pointer := core.idle_skip'access);

procedure draw_check_box (x, y : in integer; on : in out boolean; text : in string);

procedure draw_title_bar (x, y, width : in integer; title : in string);
procedure draw_fill_bar (x, y, width : in integer; fill : in float);
procedure draw_scroll_bar (x, y, height : in integer; offset : in integer);


Ładowanie…
Anuluj
Zapisz