Experimental minimal terminal rogue-like game in Ada programming language. I used to write a lot of Ada programs some time ago, then went in full C and assembly mode, and came back to Ada...
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.6KB

  1. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. -- Copyright (c) 2023 - Ognjen 'xolatile' Milan Robovic
  3. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  4. -- Xabina is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either
  5. -- version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
  6. -- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  7. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8. with ada.text_io;
  9. package body core is
  10. ------------------------------------------------------------------------------------------
  11. procedure screen_delete is
  12. begin
  13. ada.text_io.put (escape & "[2J");
  14. end screen_delete;
  15. procedure screen_offset is
  16. begin
  17. ada.text_io.put (escape & "[H");
  18. end screen_offset;
  19. procedure screen_hide_cursor is
  20. begin
  21. ada.text_io.put (escape & "[?25l");
  22. end screen_hide_cursor;
  23. procedure screen_show_cursor is
  24. begin
  25. ada.text_io.put (escape & "[?25h");
  26. end screen_show_cursor;
  27. procedure screen_new_line is
  28. begin
  29. ada.text_io.put (carriage_return & line_feed);
  30. end screen_new_line;
  31. procedure render_character (symbol : character;
  32. colour : character;
  33. effect : character;
  34. y : screen_height;
  35. x : screen_width) is
  36. begin
  37. screen_symbol (y, x) := symbol;
  38. screen_colour (y, x) := colour;
  39. screen_effect (y, x) := effect;
  40. end render_character;
  41. procedure render_buffer is
  42. format : string (1 .. 12) := escape & "[E;3CmS" & escape & "[0m";
  43. begin
  44. screen_offset;
  45. for y in screen_height
  46. loop
  47. for x in screen_width
  48. loop
  49. format (8) := screen_symbol (y, x);
  50. format (6) := screen_colour (y, x);
  51. format (3) := screen_effect (y, x);
  52. ada.text_io.put (format);
  53. end loop;
  54. screen_new_line;
  55. end loop;
  56. end render_buffer;
  57. ------------------------------------------------------------------------------------------
  58. end core;