Gosu
|
Serves as the target of all drawing and provides primitive drawing functionality. More...
Public Member Functions | |
Graphics (unsigned physical_width, unsigned physical_height) | |
~Graphics () | |
void | set_resolution (unsigned logical_width, unsigned logical_height, double black_bar_width=0, double black_bar_height=0) |
unsigned | width () const |
unsigned | height () const |
void | frame (const std::function< void()> &f) |
Prepares the graphics object for drawing and then runs the rendering code in f. More... | |
void | set_physical_resolution (unsigned physical_width, unsigned physical_height) |
For internal use only. More... | |
Static Public Member Functions | |
static void | flush () |
Flushes the Z queue to the screen and starts a new one. More... | |
static void | gl (const std::function< void()> &f) |
Finishes all pending Gosu drawing operations and executes the code in f in a clean OpenGL environment. More... | |
static void | gl (ZPos z, const std::function< void()> &f) |
Schedules a custom GL functor to be executed at a certain Z level. More... | |
static void | clip_to (double x, double y, double width, double height, const std::function< void()> &f) |
Renders everything drawn in f clipped to a rectangle on the screen. More... | |
static Gosu::Image | render (int width, int height, const std::function< void()> &f, unsigned image_flags=0) |
Renders everything drawn in f onto a new Image of size (width, height). More... | |
static Gosu::Image | record (int width, int height, const std::function< void()> &f) |
Records a macro and returns it as an Image. More... | |
static void | transform (const Transform &transform, const std::function< void()> &f) |
Pushes one transformation onto the transformation stack. More... | |
static void | draw_line (double x1, double y1, Color c1, double x2, double y2, Color c2, ZPos z, AlphaMode mode=AM_DEFAULT) |
Draws a line from one point to another (last pixel exclusive). More... | |
static void | draw_triangle (double x1, double y1, Color c1, double x2, double y2, Color c2, double x3, double y3, Color c3, ZPos z, AlphaMode mode=AM_DEFAULT) |
static void | draw_quad (double x1, double y1, Color c1, double x2, double y2, Color c2, double x3, double y3, Color c3, double x4, double y4, Color c4, ZPos z, AlphaMode mode=AM_DEFAULT) |
static void | draw_rect (double x, double y, double width, double height, Color c, ZPos z, AlphaMode mode=AM_DEFAULT) |
static void | schedule_draw_op (const DrawOp &op) |
For internal use only. More... | |
static std::unique_ptr< ImageData > | create_image (const Bitmap &src, unsigned src_x, unsigned src_y, unsigned src_width, unsigned src_height, unsigned image_flags) |
Turns a portion of a bitmap into something that can be drawn on a Graphics object. More... | |
Serves as the target of all drawing and provides primitive drawing functionality.
Usually created internally by Gosu::Window.
Definition at line 24 of file Graphics.hpp.
Gosu::Graphics::Graphics | ( | unsigned | physical_width, |
unsigned | physical_height | ||
) |
Gosu::Graphics::~Graphics | ( | ) |
|
static |
Renders everything drawn in f clipped to a rectangle on the screen.
|
static |
Turns a portion of a bitmap into something that can be drawn on a Graphics object.
|
static |
Draws a line from one point to another (last pixel exclusive).
Note: OpenGL lines are not reliable at all and may have a missing pixel at the start or end point. Please only use this for debugging purposes. Otherwise, use a quad or image to simulate lines, or contribute a better draw_line to Gosu.
|
static |
|
static |
|
static |
|
static |
Flushes the Z queue to the screen and starts a new one.
This can be useful to separate the Z queues of two parts of the game, e.g. the two halves of a game that runs in split-screen mode.
void Gosu::Graphics::frame | ( | const std::function< void()> & | f | ) |
|
static |
Finishes all pending Gosu drawing operations and executes the code in f in a clean OpenGL environment.
|
static |
Schedules a custom GL functor to be executed at a certain Z level.
The functor f is run in a clean GL context. Note: You may not call any Gosu rendering functions from within the functor.
unsigned Gosu::Graphics::height | ( | ) | const |
|
static |
Records a macro and returns it as an Image.
|
static |
Renders everything drawn in f onto a new Image of size (width, height).
image_flags | Pass Gosu::IF_RETRO if you do not want the resulting image to use interpolation when it is scaled or rotated. |
|
static |
For internal use only.
void Gosu::Graphics::set_physical_resolution | ( | unsigned | physical_width, |
unsigned | physical_height | ||
) |
For internal use only.
void Gosu::Graphics::set_resolution | ( | unsigned | logical_width, |
unsigned | logical_height, | ||
double | black_bar_width = 0 , |
||
double | black_bar_height = 0 |
||
) |
|
static |
Pushes one transformation onto the transformation stack.
unsigned Gosu::Graphics::width | ( | ) | const |