|
ChaiLove API
2.0.0
|
The primary purpose of the graphics module is to draw to the screen. More...
Public Member Functions | |
| graphics & | rectangle (const std::string &drawmode, int x, int y, int width, int height) |
| Draws a rectangle. More... | |
| graphics & | clear () |
| Clears the screen to the set background color. | |
| graphics & | clear (int r, int g, int b, int a) |
| Clears the screen to the given background color. More... | |
| graphics & | point (int x, int y) |
| Draws a point. More... | |
| graphics & | point (Point *p) |
| Draws a point. More... | |
| graphics & | line (int x1, int y1, int x2, int y2) |
| Draws a line. More... | |
| Quad | newQuad (int x, int y, int width, int height, int sw, int sh) |
| Creates a new Quad. | |
| Image * | newImage (const std::string &filename) |
| Creates a new Image from a given filepath. More... | |
| Font * | newFont (const std::string &filename, int size) |
| Creates a new TrueType font, with the given font size. More... | |
| Font * | newFont (int size) |
| Creates a new pixel font at the given size. More... | |
| Font * | newFont (const std::string &filename, int glyphWidth, int glyphHeight, const std::string &letters) |
| Creates a new BMFont with the given spec. More... | |
| graphics & | setFont (Font *font) |
| Set an already-loaded Font as the current font. More... | |
| Font * | getFont () |
| Retrieve th currently active font. More... | |
| graphics & | print (const std::string &text, int x, int y) |
| Prints the given text to the screen. More... | |
| graphics & | setColor (int red, int green, int blue, int alpha) |
| Sets the active drawing color to the given color. More... | |
| Color | getColor () |
| Gets the current color. More... | |
| Color | getBackgroundColor () |
| Retrieves the active background color. More... | |
| graphics & | setBackgroundColor (int red, int green, int blue, int alpha) |
| Sets the background color to the given color. More... | |
| graphics & | setDefaultFilter (const std::string &filter) |
| Sets the default scaling filters used with images, and fonts. More... | |
| std::string | getDefaultFilter () |
| Returns the default scaling filters used with images and fonts. More... | |
| int | getWidth () |
| Retrieve the width of the screen. | |
| int | getHeight () |
| Retrieve the height of the screen. | |
| Point | getDimensions () |
| Gets the width and height of the window. More... | |
| graphics & | circle (const std::string &drawmode, int x, int y, int radius) |
| Draws a circle. More... | |
| graphics & | ellipse (const std::string &drawmode, int x, int y, int radiusx, int radiusy) |
| Draws an ellipse. More... | |
| graphics & | draw (Image *image, int x, int y, float r, float sx, float sy, float ox, float oy) |
| Draws an image with the given angle, zoom, and origin. More... | |
| graphics & | draw (Image *image, Quad quad, int x, int y) |
| Draws an image on screen, using the given Quad as a source. More... | |
| graphics & | arc (const std::string &drawmode, int x, int y, int radius, int angle1, int angle2) |
| Draws an arc. More... | |
The primary purpose of the graphics module is to draw to the screen.
| graphics& love::graphics::arc | ( | const std::string & | drawmode, |
| int | x, | ||
| int | y, | ||
| int | radius, | ||
| int | angle1, | ||
| int | angle2 | ||
| ) |
Draws an arc.
| drawmode | How to draw the arc. Can be "fill" or "line". |
| x | The position to draw the object (x-axis). |
| y | The position to draw the object (y-axis). |
| radius | The radius of the arc. |
| angle1 | The angle of the first |
| angle2 | The angle of the second. |
| graphics& love::graphics::circle | ( | const std::string & | drawmode, |
| int | x, | ||
| int | y, | ||
| int | radius | ||
| ) |
Draws a circle.
| drawmode | How to draw the circle. Can be "fill" or "line". |
| x | The position of the center along x-axis. |
| y | The position of the center along y-axis. |
| radius | The radius of the circle. |
| graphics& love::graphics::clear | ( | int | r, |
| int | g, | ||
| int | b, | ||
| int | a | ||
| ) |
Clears the screen to the given background color.
| r | Red value. |
| g | Green value. |
| b | Blue value. |
| a | (255) Alpha value. |
| graphics& love::graphics::draw | ( | Image * | image, |
| int | x, | ||
| int | y, | ||
| float | r, | ||
| float | sx, | ||
| float | sy, | ||
| float | ox, | ||
| float | oy | ||
| ) |
Draws an image with the given angle, zoom, and origin.
| image | The image to draw on the screen. |
| x | (0) The position to draw the object (x-axis). |
| y | (0) The position to draw the object (y-axis). |
| r | (0) Orientation (radians). |
| sx | (1) Scale factor (x-axis). |
| sy | (sx) Scale factor (y-axis). |
| ox | (0) Origin offset (x-axis). |
| oy | (0) Origin offset (y-axis). |
Draws an image on screen, using the given Quad as a source.
| image | The image to draw on the screen. |
| quad | The source quad of the image. |
| x | (0) The position to draw the object (x-axis). |
| y | (0) The position to draw the object (y-axis). |
| graphics& love::graphics::ellipse | ( | const std::string & | drawmode, |
| int | x, | ||
| int | y, | ||
| int | radiusx, | ||
| int | radiusy | ||
| ) |
Draws an ellipse.
| drawmode | How to draw the ellipse. Can be "fill" or "line". |
| x | The position of the center along x-axis. |
| y | The position of the center along y-axis. |
| radiusx | The radius of the ellipse along the x-axis (half the ellipse's width). |
| radiusy | The radius of the ellipse along the y-axis (half the ellipse's height). |
| Color love::graphics::getBackgroundColor | ( | ) |
Retrieves the active background color.
| Color love::graphics::getColor | ( | ) |
Gets the current color.
| std::string love::graphics::getDefaultFilter | ( | ) |
Returns the default scaling filters used with images and fonts.
| Point love::graphics::getDimensions | ( | ) |
Gets the width and height of the window.
| graphics& love::graphics::line | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2 | ||
| ) |
Draws a line.
| x1 | The position of first point on the x-axis. |
| y1 | The position of first point on the y-axis. |
| x2 | The position of second point on the x-axis. |
| y2 | The position of second point on the y-axis. |
| Font* love::graphics::newFont | ( | const std::string & | filename, |
| int | glyphWidth, | ||
| int | glyphHeight, | ||
| const std::string & | letters | ||
| ) |
Creates a new BMFont with the given spec.
| filename | The path to the font image. |
| glyphWidth | The width of each character. |
| glyphHeight | The height of each character. |
| letters | The letters presented in the font image. |
| Font* love::graphics::newFont | ( | const std::string & | filename, |
| int | size | ||
| ) |
| Font* love::graphics::newFont | ( | int | size | ) |
Creates a new pixel font at the given size.
| size | (8) The size of the font to create. |
References newFont().
| Image* love::graphics::newImage | ( | const std::string & | filename | ) |
Creates a new Image from a given filepath.
| filename | The filepath to the image file. |
| graphics& love::graphics::point | ( | int | x, |
| int | y | ||
| ) |
Draws a point.
| x | The position on the x-axis. |
| y | The position on the y-axis. |
Draws a point.
| p | The point to draw on the screen. |
| graphics& love::graphics::print | ( | const std::string & | text, |
| int | x, | ||
| int | y | ||
| ) |
Prints the given text to the screen.
| text | The text to draw. |
| x | (0) The position to draw the object (x-axis). |
| y | (0) The position to draw the object (y-axis). |
| graphics& love::graphics::rectangle | ( | const std::string & | drawmode, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height | ||
| ) |
Draws a rectangle.
| drawmode | How to draw the rectangle. Can be "fill" or "line". |
| x | The position of top-left corner along the x-axis. |
| y | The position of top-left corner along the y-axis. |
| width | Width of the rectangle. |
| height | Height of the rectangle. |
| graphics& love::graphics::setBackgroundColor | ( | int | red, |
| int | green, | ||
| int | blue, | ||
| int | alpha | ||
| ) |
Sets the background color to the given color.
| red | The r value. |
| green | The g value. |
| blue | The b value. |
| alpha | (255) The a value. |
| graphics& love::graphics::setColor | ( | int | red, |
| int | green, | ||
| int | blue, | ||
| int | alpha | ||
| ) |
Sets the active drawing color to the given color.
| red | The amount of red. |
| green | The amount of green. |
| blue | The amount of blue. |
| alpha | (255) The amount of alpha. |
| graphics& love::graphics::setDefaultFilter | ( | const std::string & | filter | ) |
Sets the default scaling filters used with images, and fonts.
| filter | The filter mode to apply when rotating or scaling graphics. This can be either "linear" (default), or "nearest". |