4 #ifndef GOSU_GRAPHICS_HPP
5 #define GOSU_GRAPHICS_HPP
34 bool operator==(
const Transform &other) {
for (
int i = 0; i < 16; ++i)
if ((*
this)[i] != other[i])
return false;
return true; }
35 const double &operator[](std::size_t idx)
const {
return value[idx]; }
36 double &operator[](std::size_t idx) {
return value[idx]; }
44 Transform scale(
double factorX,
double factorY,
double fromX = 0,
double fromY = 0);
52 const GOSU_UNIQUE_PTR<Impl> pimpl;
54 #if defined(GOSU_CPP11_ENABLED)
67 void setResolution(
unsigned virtualWidth,
unsigned virtualHeight);
70 unsigned width()
const;
94 void scheduleGL(
const std::tr1::function<
void()>& functor,
ZPos z);
97 void beginClipping(
double x,
double y,
double width,
double height);
108 GOSU_UNIQUE_PTR<Gosu::ImageData>
endRecording(
int width,
int height);
120 double x2,
double y2,
Color c2,
124 double x2,
double y2,
Color c2,
125 double x3,
double y3,
Color c3,
129 double x2,
double y2,
Color c2,
130 double x3,
double y3,
Color c3,
131 double x4,
double y4,
Color c4,
137 unsigned srcX,
unsigned srcY,
unsigned srcWidth,
unsigned srcHeight,
138 unsigned borderFlags);
Includes all parts of C++03 (TR1) that are relevant for Gosu.
void drawLine(double x1, double y1, Color c1, double x2, double y2, Color c2, ZPos z, AlphaMode mode=amDefault)
Draws a line from one point to another (last pixel exclusive).
void beginRecording()
Starts recording a macro. Cannot be nested.
std::tr1::array< double, 16 > Transform
void beginGL()
Finishes all pending Gosu drawing operations and executes the following OpenGL code in a clean enviro...
Transform scale(double factor)
Contains declarations of all of Gosu's available classes.
Represents an RGBA color value with 8 bits for each channel.
void drawTriangle(double x1, double y1, Color c1, double x2, double y2, Color c2, double x3, double y3, Color c3, ZPos z, AlphaMode mode=amDefault)
void flush()
Flushes the Z queue to the screen and starts a new one.
void endGL()
Resets Gosu into its default rendering state.
double ZPos
Represents the Z position of something drawn with Gosu's graphics system.
void beginClipping(double x, double y, double width, double height)
Enables clipping to a specified rectangle.
Rectangular area of pixels, each represented by a Color value.
void setResolution(unsigned virtualWidth, unsigned virtualHeight)
The color's channels will be interpolated.
void pushTransform(const Transform &transform)
Pushes one transformation onto the transformation stack.
Graphics(unsigned physicalWidth, unsigned physicalHeight, bool fullscreen)
unsigned screenHeight()
Returns the height, in pixels, of the user's primary screen.
Transform translate(double x, double y)
Serves as the target of all drawing and provides primitive drawing functionality. ...
void popTransform()
Pops one transformation from the transformation stack.
AlphaMode
Determines the way colors are combined when one is drawn onto another.
bool begin(Color clearWithColor=Color::BLACK)
Prepares the graphics object for drawing.
unsigned const MAX_TEXTURE_SIZE
Returns the maximum size of an texture that will be allocated internally by Gosu. ...
bool operator==(Color a, Color b)
GOSU_UNIQUE_PTR< ImageData > createImage(const Bitmap &src, unsigned srcX, unsigned srcY, unsigned srcWidth, unsigned srcHeight, unsigned borderFlags)
Turns a portion of a bitmap into something that can be drawn on this graphics object.
GOSU_UNIQUE_PTR< Gosu::ImageData > endRecording(int width, int height)
Finishes building the macro and returns it as a drawable object.
Interface of the Color class.
unsigned screenWidth()
Returns the width, in pixels, of the user's primary screen.
void scheduleGL(const std::tr1::function< void()> &functor, ZPos z)
(Experimental) Schedules a custom GL functor to be executed at a certain Z level. ...
void end()
Every call to begin must have a matching call to end.
double angle(double fromX, double fromY, double toX, double toY, double def=0)
Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.
Transform rotate(double angle, double aroundX=0, double aroundY=0)
void endClipping()
Disables clipping.
void drawQuad(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=amDefault)
Contains general typedefs and enums related to graphics.