Class: Rubyboy::Raylib::Lcd
- Inherits:
-
Object
- Object
- Rubyboy::Raylib::Lcd
- Includes:
- Rubyboy::Raylib
- Defined in:
- lib/rubyboy/raylib/lcd.rb
Constant Summary collapse
- WIDTH =
160
- HEIGHT =
144
- SCALE =
4
Instance Method Summary collapse
- #close_window ⇒ Object
- #draw(pixel_data) ⇒ Object
-
#initialize ⇒ Lcd
constructor
A new instance of Lcd.
- #window_should_close? ⇒ Boolean
Constructor Details
#initialize ⇒ Lcd
Returns a new instance of Lcd.
14 15 16 17 18 19 20 |
# File 'lib/rubyboy/raylib/lcd.rb', line 14 def initialize InitWindow(WIDTH * SCALE, HEIGHT * SCALE, 'RUBY BOY') image = GenImageColor(WIDTH, HEIGHT, BLACK) image.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8 @texture = LoadTextureFromImage(image) @vector = Vector2.create(0, 0) end |
Instance Method Details
#close_window ⇒ Object
35 36 37 |
# File 'lib/rubyboy/raylib/lcd.rb', line 35 def close_window CloseWindow() end |
#draw(pixel_data) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rubyboy/raylib/lcd.rb', line 22 def draw(pixel_data) UpdateTexture(@texture, pixel_data.pack('C*')) BeginDrawing() ClearBackground(BLACK) DrawTextureEx(@texture, @vector, 0.0, SCALE, WHITE) EndDrawing() end |
#window_should_close? ⇒ Boolean
31 32 33 |
# File 'lib/rubyboy/raylib/lcd.rb', line 31 def window_should_close? WindowShouldClose() end |