[−][src]Crate olc_pixel_game_engine
olcPixelGameEngine Rust API.
Example:
extern crate olc_pixel_game_engine; use crate::olc_pixel_game_engine as olc; struct ExampleProgram {} impl olc::Application for ExampleProgram { fn on_user_create(&mut self) -> Result<(), olc::Error> { // Mirrors `olcPixelGameEngine::onUserCreate`. // Your code goes here. Ok(()) } fn on_user_update(&mut self, _elapsed_time: f32) -> Result<(), olc::Error> { // Mirrors `olcPixelGameEngine::onUserUpdate`. // Your code goes here. Ok(()) } fn on_user_destroy(&mut self) -> Result<(), olc::Error> { // Mirrors `olcPixelGameEngine::onUserDestroy`. // Your code goes here. Ok(()) } } fn main() { let mut example = ExampleProgram {}; // Launches the program in 256x240 "pixels" screen, where each "pixel" is 4x4 pixel square, // and starts the main game loop. olc::start("Hello, World!", &mut example, 256, 240, 4, 4).unwrap(); }
Structs
Decal | Mirror of |
Error | olcPixelGameEngine error. |
HWButton | Mirror of |
Pixel | Mirror of |
Sprite | Mirror of |
Vf2d | Mirror of |
Enums
Key | Mirror of |
PixelMode | Mirror of |
SpriteFlip | Mirror of |
SpriteMode | Mirror of |
Constants
Traits
Application | Application trait, should be extended by an implementation and passed to start function. |
Functions
c_rand | Utility C++ rand function. |
clear | Clears entire draw target to Pixel. |
clear_buffer | Clears the rendering back buffer. |
create_layer | Layer API. Creates a new layer. |
draw | Draws pixel at coordinates (x, y). |
draw_circle | Draws a circle located at (x, y) with radius. |
draw_circle_with_mask | Draws a circle located at (x, y) with radius. Allows to set mask. |
draw_decal | Draws a whole decal with default scale and tinting. |
draw_decal_ext | Draws a whole decal with scale and tinting. |
draw_line | Draws a line from (x1, y1) to (x2, y2). |
draw_line_with_pattern | Draws a line from (x1, y1) to (x2, y2). Allows to set pattern. |
draw_partial_decal | Draws a region of a decal with default scale and tint. |
draw_partial_decal_ext | Draws a region of a decal with scale and tinting. |
draw_partial_rotated_decal | Draws partial rotated decal with default scale and tinting. |
draw_partial_rotated_decal_ext | Draws partial rotated decal. |
draw_partial_sprite | Draws an area of a sprite at location (x, y), where the selected area is (ox, oy) to (ox+w, oy+h). |
draw_partial_sprite_ext | Draws an area of a sprite at location (x, y), where the selected area is (ox, oy) to (ox+w, oy+h) with provided scale and flip. |
draw_partial_warped_decal | Draws partial warped decal with default tinting. |
draw_partial_warped_decal_ext | Draws partial warped decal. |
draw_rect | Draws a rectangle at (x, y) to (x+w, y+h). |
draw_rotated_decal | Draws rotated decal with default center, scale, and tinting. |
draw_rotated_decal_ext | Draws rotated decal with custom center, scale, and tinting. |
draw_sprite | Draws an entire sprite at the location (x, y). |
draw_sprite_ext | Draws an entire sprite at the location (x, y) with provided scale and flip. |
draw_string | Draws string. |
draw_string_decal | Draws string decal with default colour and scale. |
draw_string_decal_ext | Draws string decal with colour and scale. |
draw_string_with_scale | Draws string. Allows to set scale. |
draw_triangle | Draws a triangle between points (x1, y1), (x2, y2) and (x3, y3). |
draw_warped_decal | Draws warped decal with default tinting. |
draw_warped_decal_ext | Draws warped decal. |
enable_layer | Layer API. Enables/disables layer. |
fill_circle | Fills a circle located at (x, y) with radius. |
fill_rect | Fills a rectangle at (x, y) to (x+w, y+h). |
fill_triangle | Flat fills a triangle between points (x1, y1), (x2, y2) and (x3, y3). |
get_draw_target_height | Returns the height of the currently selected drawing target in "pixels". |
get_draw_target_width | Returns the width of the currently selected drawing target in "pixels". |
get_fps | Gets the current Frames Per Second. |
get_key | Returns the state of a specific keyboard button. |
get_mouse | Returns the state of a specific mouse button. |
get_mouse_wheel | Returns mouse wheel delta. |
get_mouse_x | Returns mouse X coordinate in "pixel" space. |
get_mouse_y | Returns mouse Y coordinate in "pixel" space. |
get_pixel_mode | Returns the current pixel mode. |
is_focused | Whether or not the window is focused. |
screen_height | Returns the height of the screen in "pixels". |
screen_width | Returns the width of the screen in "pixels". |
set_draw_target | Layer API. Sets layer as the main draw target. |
set_layer_offset | Layer API. Sets layer offset. |
set_layer_scale | Layer API. Sets layer scale. |
set_layer_tint | Layer API. Sets layer tint. |
set_pixel_blend | Changes the blend factor form between 0.0f to 1.0f. |
set_pixel_mode | Changes the pixel mode for different optimisations. |
set_screen_size | Resizes the primary screen sprite. |
start | Starts the main game loop. |
start_with_full_screen_and_vsync | Starts the main game loop with configurable full screen and vsync. |