|
|
@@ -44,17 +44,6 @@ function xabina return integer is |
|
|
|
LINE_FEED : constant character := character'val (13); |
|
|
|
ESCAPE : constant character := character'val (27); |
|
|
|
|
|
|
|
function format_symbol (symbol : character := ' '; |
|
|
|
colour : character := COLOUR_WHITE; |
|
|
|
effect : character := EFFECT_NORMAL) return string is |
|
|
|
format : string (1 .. 12) := escape & "[E;3CmS" & escape & "[0m"; |
|
|
|
begin |
|
|
|
format (8) := symbol; |
|
|
|
format (6) := colour; |
|
|
|
format (3) := effect; |
|
|
|
return format; |
|
|
|
end format_symbol; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
|
-- Entity |
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
@@ -518,26 +507,55 @@ function xabina return integer is |
|
|
|
-- -- Currently constant, gonna use either my xurses library or <termios.h> C bindings. |
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
|
|
|
|
|
--~buffer_constant_data : string (1 .. 3 + 12 * 120 * 40 + 2 * 40); |
|
|
|
--~buffer_constant_data : string (1 .. 3 + 12 * map_width * map_height + 2 * map_height); |
|
|
|
--~buffer_variable_data : string (1 .. 3 + 12 * map_width * map_height + 2 * map_height); |
|
|
|
type screen_width is mod 120; |
|
|
|
type screen_height is mod 40; |
|
|
|
|
|
|
|
procedure render is |
|
|
|
type screen_type is array (screen_height, screen_width) of character; |
|
|
|
|
|
|
|
screen_symbol : screen_type := (others => (others => CANCEL)); |
|
|
|
screen_colour : screen_type := (others => (others => COLOUR_WHITE)); |
|
|
|
screen_effect : screen_type := (others => (others => EFFECT_NORMAL)); |
|
|
|
|
|
|
|
procedure render_screen_delete is begin put (ESCAPE & "[2J"); end render_screen_delete; |
|
|
|
procedure render_screen_offset is begin put (ESCAPE & "[H"); end render_screen_offset; |
|
|
|
procedure render_cursor_hide is begin put (ESCAPE & "[?25l"); end render_cursor_hide; |
|
|
|
procedure render_cursor_show is begin put (ESCAPE & "[?25l"); end render_cursor_show; |
|
|
|
procedure render_realignment is begin put (CARRIAGE_RETURN & LINE_FEED); end render_realignment; |
|
|
|
|
|
|
|
procedure render_character (symbol : character := ' '; |
|
|
|
colour : character := COLOUR_WHITE; |
|
|
|
effect : character := EFFECT_NORMAL) is |
|
|
|
format : string (1 .. 12) := ESCAPE & "[E;3CmS" & ESCAPE & "[0m"; |
|
|
|
begin |
|
|
|
put (ESCAPE & "[H"); |
|
|
|
for y in map_height |
|
|
|
format (8) := symbol; |
|
|
|
format (6) := colour; |
|
|
|
format (3) := effect; |
|
|
|
put (format); |
|
|
|
end render_character; |
|
|
|
|
|
|
|
procedure render_screen is |
|
|
|
begin |
|
|
|
render_screen_offset; |
|
|
|
for y in screen_height |
|
|
|
loop |
|
|
|
for x in map_width |
|
|
|
for x in screen_width |
|
|
|
loop |
|
|
|
if x = player.x and y = player.y then |
|
|
|
put (format_symbol ('@', COLOUR_CYAN, EFFECT_BOLD)); |
|
|
|
else |
|
|
|
put (format_symbol ('.', COLOUR_GREY, EFFECT_BOLD)); |
|
|
|
end if; |
|
|
|
render_character (screen_symbol (y, x), screen_colour (y, x), screen_effect (y, x)); |
|
|
|
end loop; |
|
|
|
put (CARRIAGE_RETURN & LINE_FEED); |
|
|
|
render_realignment; |
|
|
|
end loop; |
|
|
|
end render; |
|
|
|
end render_screen; |
|
|
|
|
|
|
|
procedure insert_character (symbol : character := ' '; |
|
|
|
colour : character := COLOUR_WHITE; |
|
|
|
effect : character := EFFECT_NORMAL; |
|
|
|
y : screen_height := 0; |
|
|
|
x : screen_width := 0) is |
|
|
|
begin |
|
|
|
screen_symbol (y, x) := symbol; |
|
|
|
screen_colour (y, x) := colour; |
|
|
|
screen_effect (y, x) := effect; |
|
|
|
end insert_character; |
|
|
|
|
|
|
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
|
-- Main |
|
|
@@ -551,17 +569,27 @@ begin |
|
|
|
bind ('a', action_move_left'access); |
|
|
|
bind ('d', action_move_right'access); |
|
|
|
|
|
|
|
put (ESCAPE & "[?25l"); |
|
|
|
render_screen_delete; |
|
|
|
render_screen_offset; |
|
|
|
render_cursor_hide; |
|
|
|
|
|
|
|
loop |
|
|
|
exit when active = false; |
|
|
|
signal := CANCEL; |
|
|
|
render; |
|
|
|
for y in screen_height |
|
|
|
loop |
|
|
|
for x in screen_width |
|
|
|
loop |
|
|
|
insert_character ('.', COLOUR_GREY, EFFECT_BOLD, y, x); |
|
|
|
end loop; |
|
|
|
end loop; |
|
|
|
insert_character ('@', COLOUR_CYAN, EFFECT_BOLD, screen_height (player.y), screen_width (player.x)); |
|
|
|
render_screen; |
|
|
|
get_immediate (signal); |
|
|
|
action_list (character'pos (signal)).all; |
|
|
|
end loop; |
|
|
|
|
|
|
|
put (ESCAPE & "[?25h"); |
|
|
|
render_cursor_show; |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|