diff options
| author | realtradam <[email protected]> | 2022-01-21 05:27:08 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-01-21 05:27:08 -0500 |
| commit | 464fdf98b6ccdd4a8780c4b31a090084cb11261e (patch) | |
| tree | 27ae3a4994a029f4207f2fa21e491f89428c1aac /game/main.rb | |
| parent | 99955cc7ce726d10856b4e4df2c560b2d2e2d80e (diff) | |
| download | FelFlameEngine-464fdf98b6ccdd4a8780c4b31a090084cb11261e.tar.gz FelFlameEngine-464fdf98b6ccdd4a8780c4b31a090084cb11261e.zip | |
added mouse buttons and scissor
Diffstat (limited to 'game/main.rb')
| -rw-r--r-- | game/main.rb | 159 |
1 files changed, 84 insertions, 75 deletions
diff --git a/game/main.rb b/game/main.rb index 5f31b8c..0721741 100644 --- a/game/main.rb +++ b/game/main.rb @@ -5,6 +5,7 @@ Rl.init_window(600, 600, text) Rl.target_fps = 60 color = Rl::Color.new(200,50,50,255) white = Rl::Color.new(255,255,255,255) +color2 = Rl::Color.new(200,15,15,255) rect1 = Rl::Rectangle.new(50,50,10,10) rect2 = Rl::Rectangle.new(100,50,10,10) @@ -28,6 +29,12 @@ puts "true: #{circ1.collide_with_circle? circ1}" # ya pause_champ = Rl::Texture.new("./assets/PauseChamp.png") puts "#{pause_champ.w} #{pause_champ.h}" +FECS::Cmp.new('Yep', x: 3) + +a = FECS::Cmp::Yep.new + +puts "A: #{a.x}" + y = 10 spaceing = 25 font_size = 30 @@ -40,83 +47,85 @@ Rl.while_window_open do puts Rl.keys_pressed.to_s end - Rl.begin_drawing - Rl.clear_background + Rl.draw(clear_color: white) do + + Rl.scissor_mode(x: Rl.mouse_x - 50, y: Rl.mouse_y - 50, width: 100, height: 100) do + if Rl.mouse_button_up? 0 + # Draw moving pausechamp face + Rl.draw_texture( + texture: pause_champ, + x: result_x - 100, + y: result_y + 200 - 140 + ) + end + end + + if Rl.key_down? 72 + pause_champ.w += 10 + pause_champ.h += 10 + end + + if Rl.key_down? 71 + pause_champ.w += 10 + pause_champ.h += 10 + end + + Rl.draw_text( + text: "mouse wheel:#{Rl.mouse_wheel}", + x: 350, + y: y + (spaceing*2), + font_size: font_size, + color: color + ) - if Rl.is_key_up? 87 - # Draw moving pausechamp face - Rl.draw_texture( - texture: pause_champ, - x: result_x - 100, - y: result_y + 200 - 140 + Rl.draw_text( + text: "mouse x: #{Rl.mouse_x}", + x: 350, + y: y, + font_size: font_size, + color: color ) - end - if Rl.is_key_down? 72 - pause_champ.w += 10 - pause_champ.h += 10 - end - - if Rl.is_key_down? 71 - pause_champ.w += 10 - pause_champ.h += 10 - end + Rl.draw_text( + text: "mouse y: #{Rl.mouse_y}", + x: 350, + y: y + spaceing, + font_size: font_size, + color: color + ) - Rl.draw_text( - text: "mouse wheel:#{Rl.mouse_wheel}", - x: 350, - y: y + (spaceing*2), - font_size: font_size, - color: color - ) - - Rl.draw_text( - text: "mouse x: #{Rl.mouse_x}", - x: 350, - y: y, - font_size: font_size, - color: color - ) - - Rl.draw_text( - text: "mouse y: #{Rl.mouse_y}", - x: 350, - y: y + spaceing, - font_size: font_size, - color: color - ) - - # Draw moving text - Rl.draw_text( - text: text, - x: result_x - 120, - y: result_y + 200, - font_size: 25, - color: color - ) - - # Draw Fps - Rl.draw_text( - text: "FPS: #{Rl.fps.to_s}", - x: 10, - y: y, - font_size: font_size, - color: color - ) - - # Draw Frametime - Rl.draw_text( - text: "Frametime: #{"%.4f" % Rl.frame_time}", - x: 10, - y: y + spaceing, - font_size: font_size, - color: color - ) - - # Draw Elapse Time - Rl.draw_text( - text: "Elapsed Time: #{"%.2f" % Rl.time}", - x: 10, y: y + (spaceing * 2), font_size: font_size, color: color) - - Rl.end_drawing + # Draw moving text + Rl.draw_text( + text: text, + x: result_x - 120, + y: result_y + 200, + font_size: 25, + color: color + ) + + # Draw Fps + Rl.draw_text( + text: "FPS: #{Rl.fps.to_s}", + x: 10, + y: y, + font_size: font_size, + color: color + ) + + # Draw Frametime + Rl.draw_text( + text: "Frametime: #{"%.4f" % Rl.frame_time}", + x: 10, + y: y + spaceing, + font_size: font_size, + color: color + ) + + # Draw Elapse Time + Rl.draw_text( + text: "Elapsed Time: #{"%.2f" % Rl.time}", + x: 10, y: y + (spaceing * 2), font_size: font_size, color: color + ) + + end end |
