From 9d8ce4394b6bcc4593c6551d8778cb3f9d5957a1 Mon Sep 17 00:00:00 2001 From: mewrrythekibby Date: Sun, 30 Nov 2025 21:01:10 -0600 Subject: [PATCH] Render and text system changes (minor) --- main.rb | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/main.rb b/main.rb index ad97ba5..70690ff 100644 --- a/main.rb +++ b/main.rb @@ -263,7 +263,7 @@ end class HexagonTerminalWindow < Gosu::Window - def initialize(width, height, fullscreen) + def initialize(width, height, options={}) # Window super self.caption = "Hexagon Terminal" @@ -277,11 +277,10 @@ class HexagonTerminalWindow < Gosu::Window recalculate_hexagons # State - @cursor_pos = [0, 1] # row-1, col-1 + @cursor_pos = [0, 0] # row minus 1, col minus 1 @input_buffer = "" - @output_buffer = "." + @output_buffer = "Hello, world!" @active_styling = TextProps.new(@font) - @do_redraw = true self.text_input = Gosu::TextInput.new @old_text = [0,'',0] @@ -309,10 +308,6 @@ class HexagonTerminalWindow < Gosu::Window end end - def needs_redraw? - return @do_redraw - end - def update hbgdb = $hex_bgs.debug_get_stats # puts "ids: #{hbgdb['i']}" @@ -321,7 +316,6 @@ class HexagonTerminalWindow < Gosu::Window if @output_buffer.length > 0 render_output - @do_redraw = true end new_text = [ self.text_input.selection_start, @@ -334,6 +328,7 @@ class HexagonTerminalWindow < Gosu::Window new_text[1], new_text[2] ] + @output_buffer += new_text[1] out = ''+new_text[1] if new_text[0]= @hexes[0].length @cursor_pos[0] += 1 @cursor_pos[1] = 0 @@ -399,8 +385,7 @@ class HexagonTerminalWindow < Gosu::Window scroll_with_new_line end end - @do_redraw = true - # @output_buffer = "" + @output_buffer = "" end def scroll_with_new_line @@ -433,13 +418,15 @@ class HexagonTerminalWindow < Gosu::Window @next_row_is_shifted = !@next_row_is_shifted end - def handle_escape_char(char) - @escape_buffer += @output_buffer[0] - @output_buffer = @output_buffer[1..-1] - end end $hex_bgs = HexEditXref_BgGrphStore.new recalculate_hexagons -window = HexagonTerminalWindow.new(800, 600, false) +FPS = 20.0 +window = HexagonTerminalWindow.new(800, 600, { + :resizable => true, + :fullscreen => false, + :borderless => false, + :update_interval => (1000/FPS) # 1000ms (1s) cut into FPS pieces +}) window.show