diff options
| author | realtradam <[email protected]> | 2022-01-20 05:35:21 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2022-01-20 05:35:21 -0500 |
| commit | e45a93074586de2babdc9761cb02e60f96065894 (patch) | |
| tree | 4442c431bd9a659a2004c8202883540c257b98a1 /game | |
| parent | 3b8a8399cb176f6e8bbd564384cb49e331699655 (diff) | |
| download | FelFlameEngine-e45a93074586de2babdc9761cb02e60f96065894.tar.gz FelFlameEngine-e45a93074586de2babdc9761cb02e60f96065894.zip | |
new input methods
Diffstat (limited to 'game')
| -rw-r--r-- | game/assets/PauseChamp.png | bin | 0 -> 17196 bytes | |||
| -rw-r--r-- | game/main.rb | 94 |
2 files changed, 92 insertions, 2 deletions
diff --git a/game/assets/PauseChamp.png b/game/assets/PauseChamp.png Binary files differnew file mode 100644 index 0000000..a5675f8 --- /dev/null +++ b/game/assets/PauseChamp.png diff --git a/game/main.rb b/game/main.rb index 37c8207..0ea5d7c 100644 --- a/game/main.rb +++ b/game/main.rb @@ -1,2 +1,92 @@ -require 'lib/hello.rb' -Raylib.init_window(1000, 300, "poggies") +text = "Our poggies game engine :^)" + +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) + +pause_champ = Rl::Texture.new("./assets/PauseChamp.png") + +y = 10 +spaceing = 25 +font_size = 30 + +Rl.while_window_open do + result_x = (Math.cos(Rl.time*2) * 100) + 250 + result_y = (Math.sin(Rl.time*2) * 100) + 250 + + unless Rl.keys_pressed.empty? + puts Rl.keys_pressed.to_s + end + + Rl.begin_drawing + Rl.clear_background + + 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 + ) + end + + 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 +end |
