graphics module performs the actual drawing of images, text, and other
objects with the
Drawable trait. It also handles
basic loading of images and text.
This module also manages graphics state, coordinate systems, etc. The default coordinate system has the origin in the upper-left corner of the screen, with Y increasing downwards.
This library differs significantly in performance characteristics from the
LÖVE library that it is based on. Many operations that are batched by default
in love (e.g. drawing primitives like rectangles or circles) are not batched
ggez, so render loops with a large number of draw calls can be very slow.
The primary solution to efficiently rendering a large number of primitives is
SpriteBatch, which can be orders
of magnitude more efficient than individual
pipe module is auto-generated by
gfx_defines!. You shouldn't need to
touch it, but alas we can't exclude it from
A generic canvas independent of graphics backend. This type should
never need to be used directly; use
A RGBA color in the
A struct containing all the necessary info for drawing a
A type for empty shader data for shaders that do not require any additional data to be sent to the GPU
Parameters for the fill tessellator.
A handle referring to a loaded Truetype font.
A backend specification for OpenGL.
This is different from
Internal structure containing global shader state.
Generic in-GPU-memory image data available to be drawn on the screen.
You probably just want to look at the
Internal structure containing values that are different for each drawable object. This is the per-object data that gets fed into the shaders.
2D polygon mesh.
A builder for creating
A simple 2D rectangle.
Defines the size of a rendered face of a font, in pixels, horizontally and
vertically. A vertical scale of
A lock for RAII shader regions. The shader automatically gets cleared once the lock goes out of scope, restoring the previous shader (if any).
Parameters for the tessellator.
Drawable text object. Essentially a list of
A piece of text with optional color, font and font scale information.
Drawing text generally involves one or more of these.
These options take precedence over any similar field/argument.
Structure containing fundamental vertex data.
Describes horizontal alignment preference for positioning & bounds.
An enum for specifying default and custom blend modes
Specifies whether a mesh should be drawn filled or as an outline.
The fill rule defines how to determine what is inside and what is outside of the shape.
Specifies what blending method to use when scaling up/down images.
The supported formats for saving an image.
Line cap as defined by the SVG specification.
Line join as defined by the SVG specification.
Specifies how texture coordinates outside the range
Default size for fonts.
A trait providing methods for working with a particular backend, such as OpenGL, with associated gfx-rs types for that backend. As a user you probably don't need to touch this unless you want to write a new graphics backend for ggez. (Trust me, you don't.)
All types that can be drawn on the screen implement the
A trait that is used to create trait objects to abstract away the
Calculates the new total transformation (Model-View-Projection) matrix based on the matrices at the top of the transform and view matrix stacks and sends it to the graphics card.
Clear the screen to the background color.
Clears the the current shader for the
Get the default filter mode for new images.
Draws the given
Returns the size of the window's underlying drawable in pixels as (width, height). Returns zeros if window doesn't exist.
Premultiplies the given transformation matrix with the current projection matrix
Premultiplies the given transform with the current model transform.
Sets the current model transform to the origin transform (no transformation)
Pops the transform matrix off the top of the transform
(model) matrix stack of the
Gets a copy of the context's raw projection matrix
Pushes a homogeneous transform matrix to the top of the transform
(model) matrix stack of the
Returns a string that tells a little about the obtained rendering mode. It is supposed to be human-readable and will change; do not try to parse information out of it!
Returns a rectangle defining the coordinate system of the screen.
It will be
Take a screenshot by outputting the current render surface
(screen or selected canvas) to an
Sets the blend mode of the currently active shader program
Sets the default filter mode used to scale images.
Sets the window size/resolution to the specified width and height.
Sets the window to fullscreen or back.
Sets the window mode, such as the size and other properties.
Sets the raw projection matrix to the given homogeneous transformation matrix.
Sets whether or not the window is resizable.
Sets the bounds of the screen viewport.
Set the current shader for the
Sets the current model transformation to the given homogeneous transformation matrix.
Sets the window icon.
Sets the window title.
Returns the size of the window in pixels as (width, height), including borders, titlebar, etc. Returns zeros if the window doesn't exist.
Gets a copy of the context's current transform matrix
Use a shader until the returned lock goes out of scope
Returns a reference to the Glutin window. Ideally you should not need to use this because ggez would provide all the functions you need without having to dip into Glutin itself. But life isn't always ideal.
A canvas that can be rendered to instead of the screen (sometimes referred
to as "render target" or "render to texture"). Set the canvas with the
In-GPU-memory image data available to be drawn on the screen, using the OpenGL backend.
An ID used by the ggez graphics context to uniquely identify a shader