Class: Tea::Screen
- Inherits:
-
Object
- Object
- Tea::Screen
- Extended by:
- Blitting, Clipping, Grabbing, ImageSaving, Primitive
- Defined in:
- lib/tea/o_screen.rb
Overview
A Bitmap-like object that displays its contents on the screen when drawn to and updated.
Constant Summary collapse
- BITS_PER_PIXEL =
Video buffer depth.
32
Constants included from Primitive
Primitive::BLEND_MIXER, Primitive::REPLACE_MIXER
Class Method Summary collapse
- .blitting_buffer ⇒ Object
- .clipping_buffer ⇒ Object
- .grabbing_buffer ⇒ Object
-
.h ⇒ Object
Get the screen height in pixels.
- .image_saving_buffer ⇒ Object
-
.mode_set? ⇒ Boolean
Check if Screen.set_mode has been called yet.
- .primitive_buffer ⇒ Object
-
.register_bitmap_for_optimizing(bitmap) ⇒ Object
Register a Bitmap object to be optimised to the Screen’s format when a screen mode is set.
-
.set_mode(width, height) ⇒ Object
Set or change the screen video mode, giving a width * height screen buffer.
-
.update ⇒ Object
Update the screen so that things drawn on it are displayed.
-
.w ⇒ Object
Get the screen width in pixels.
Methods included from Blitting
Methods included from Clipping
Methods included from Grabbing
Methods included from ImageSaving
Methods included from Primitive
[], []=, circle, clear, line, rect
Class Method Details
.blitting_buffer ⇒ Object
60 61 62 |
# File 'lib/tea/o_screen.rb', line 60 def Screen.blitting_buffer @screen end |
.clipping_buffer ⇒ Object
65 66 67 |
# File 'lib/tea/o_screen.rb', line 65 def Screen.clipping_buffer @screen end |
.grabbing_buffer ⇒ Object
70 71 72 |
# File 'lib/tea/o_screen.rb', line 70 def Screen.grabbing_buffer @screen end |
.h ⇒ Object
Get the screen height in pixels.
50 51 52 |
# File 'lib/tea/o_screen.rb', line 50 def Screen.h @screen.h end |
.image_saving_buffer ⇒ Object
75 76 77 |
# File 'lib/tea/o_screen.rb', line 75 def Screen.image_saving_buffer @screen end |
.mode_set? ⇒ Boolean
Check if Screen.set_mode has been called yet.
33 34 35 |
# File 'lib/tea/o_screen.rb', line 33 def Screen.mode_set? @screen ? true : false end |
.primitive_buffer ⇒ Object
80 81 82 |
# File 'lib/tea/o_screen.rb', line 80 def Screen.primitive_buffer @screen end |
.register_bitmap_for_optimizing(bitmap) ⇒ Object
Register a Bitmap object to be optimised to the Screen’s format when a screen mode is set.
39 40 41 |
# File 'lib/tea/o_screen.rb', line 39 def Screen.register_bitmap_for_optimizing(bitmap) @bitmaps_to_optimize << WeakRef.new(bitmap) end |
.set_mode(width, height) ⇒ Object
Set or change the screen video mode, giving a width * height screen buffer.
25 26 27 28 29 30 |
# File 'lib/tea/o_screen.rb', line 25 def Screen.set_mode(width, height) @screen = SDL::Screen.open(width, height, BITS_PER_PIXEL, SDL::SWSURFACE) optimize_bitmaps rescue SDL::Error => e raise Tea::Error, e., e.backtrace end |
.update ⇒ Object
Update the screen so that things drawn on it are displayed.
55 56 57 |
# File 'lib/tea/o_screen.rb', line 55 def Screen.update @screen.flip end |
.w ⇒ Object
Get the screen width in pixels.
45 46 47 |
# File 'lib/tea/o_screen.rb', line 45 def Screen.w @screen.w end |