| Module | RubyCube |
| In: |
rubycube.c
|
| KEY_LEFT | = | INT2FIX(RC_KEY_LEFT) |
| KEY_RIGHT | = | INT2FIX(RC_KEY_RIGHT) |
| KEY_UP | = | INT2FIX(RC_KEY_UP) |
| KEY_DOWN | = | INT2FIX(RC_KEY_DOWN) |
| EVENT_KEYBOARD | = | INT2FIX(EVENT_KEYBOARD) |
| EVENT_KEYBOARD_LETTER | = | INT2FIX(EVENT_KEYBOARD_LETTER) |
| EVENT_MOUSE_BUTTON_UP | = | INT2FIX(EVENT_MOUSE_BUTTON_UP) |
| EVENT_MOUSE_BUTTON_DOWN | = | INT2FIX(EVENT_MOUSE_BUTTON_DOWN) |
| EVENT_MOUSE_ACTIVE | = | INT2FIX(EVENT_MOUSE_ACTIVE) |
| EVENT_MOUSE_PASSIVE | = | INT2FIX(EVENT_MOUSE_PASSIVE) |
| EVENT_ANIM_COMPLETE | = | INT2FIX(EVENT_ANIM_COMPLETE) |
| EVENT_COLLISION | = | INT2FIX(EVENT_COLLISION) |
| EVENT_APPLICATION | = | INT2FIX(EVENT_APPLICATION) |
| EVENT_TIMER | = | INT2FIX(EVENT_TIMER) |
| ZERO | = | INT2FIX(GL_ZERO) |
| ONE | = | INT2FIX(GL_ONE) |
| DST_COLOR | = | INT2FIX(GL_DST_COLOR) |
| ONE_MINUS_DST_COLOR | = | INT2FIX(GL_ONE_MINUS_DST_COLOR) |
| SRC_ALPHA | = | INT2FIX(GL_SRC_ALPHA) |
| ONE_MINUS_SRC_ALPHA | = | INT2FIX(GL_ONE_MINUS_SRC_COLOR) |
| DST_ALPHA | = | INT2FIX(GL_DST_ALPHA) |
| ONE_MINUS_DST_ALPHA | = | INT2FIX(GL_ONE_MINUS_DST_ALPHA) |
| SRC_ALPHA_SATURATE | = | INT2FIX(GL_SRC_ALPHA_SATURATE) |
| SHAPE_FORMAT_POINTS | = | INT2FIX(SHAPE_FORMAT_POINTS) |
| SHAPE_FORMAT_LINES | = | INT2FIX(SHAPE_FORMAT_LINES) |
| SHAPE_FORMAT_QUADS | = | INT2FIX(SHAPE_FORMAT_QUADS) |
| SHAPE_FORMAT_TRIANGLES | = | INT2FIX(SHAPE_FORMAT_TRIANGLES) |
| SHAPE_FORMAT_TRIANGLE_FAN | = | INT2FIX(SHAPE_FORMAT_TRIANGLE_FAN) |
| SHAPE_FORMAT_TRIANGLE_STRIP | = | INT2FIX(SHAPE_FORMAT_TRIANGLE_STRIP) |
| POLY_MODE_LINE | = | INT2FIX(POLY_MODE_LINE) |
| POLY_MODE_FILL | = | INT2FIX(POLY_MODE_FILL) |
Sets the clear color for the back buffer
# Clear the back buffer to white before any shapes are rendered RubyCube.clear_color(1.0, 1.0, 1.0, 1.0)
Toggle between full screen and windowed mode. (toggles asynchronously)
Returns the desired full screen state
RubyCube.start("test", 640, 480)
# Toggle full screen
RubyCube.full_screen
Converts the perspective transformation to an orthographic screen space projection where 1 graphical unit == 1 screen pixel. This is the default mode for simplicity.
Converts to a perspective correct transformation. RubyCube will have better support for 3d mode later.
RubyCube.perspective(90, 0, 1, 1000)
Change the polygon filling mode of the renderer
RubyCube::POLY_MODE_LINE RubyCube::POLY_MODE_FILL
Returns true when event data has been filled into event_data.
This turns out to be a lot faster and in most cases more convient then passing a set of blocks for every kind of callback you might want to receive. Higher level event handling semantics can be built on this method very easily.
See the EVENT_* constants for event types. testevents.rb shows examples of all relevant events.
Events are the primary way that the background thread communicates with your ruby application. The events will overflow and the oldest events will be lost if you don’t read events in a timely manner. This method call belongs at the top of your ruby loop.
event_data = []
RubyCube.read_event(event_data)
puts "Event type: #{event_data[0]}"
Returns the ID of the timer. Each time the timer is hit it will deliver a EVENT_TIMER event type. Timers with a repeatCount of -1 will repeat forever.
RubyCube.set_timer(60, -1) # interval 60 seconds, repeat forever RubyCube.set_timer(.01, 10) # interval 10 milliseconds, repeat 10 times
This is the startup routine for the rubycube system. If you don’t call this method first bad things will happen later.
RubyCube will start a background thread that updates your shapes and renders everything.
RubyCube.start("My application", 800, 600)
Change the global translation for the model view matrix. This could be used to implement camera shake or scrolling.