11 #define SCALING_NONE 0
12 #define SCALING_RATIO 1
14 /// GSKit CLUT base struct. This should've been in gsKit from the start :)
16 u8 PSM
; ///< Pixel Storage Method (Color Format)
17 u8 ClutPSM
; ///< CLUT Pixel Storage Method (Color Format)
18 u32
*Clut
; ///< EE CLUT Memory Pointer
19 u32 VramClut
; ///< GS VRAM CLUT Memory Pointer
34 // Some convenience globals
39 const u64 gDefaultCol
;
40 const u64 gDefaultAlpha
;
48 /** Initializes the rendering manager
49 * @param vsyncon 1 == vsync enabled, 0 == vsync disabled
50 * @param vmodeset Video mode
52 void rmInit(int vsyncon
, enum rm_vmode vmodeset
);
54 /** Sets a new screen mode */
55 void rmSetMode(int vsyncon
, enum rm_vmode vmodeset
);
59 /** Fills the parameters with the screen width and height */
60 void rmGetScreenExtents(int *w
, int *h
);
62 /** Manually prepares a texture for rendering (should not be normally needed).
63 * txt->Vram will be nonzero on success.
64 * @param txt The texture to upload (if not uploaded already)
65 * @return 1 if ok, 0 if error uploading happened (likely too big texture) */
66 int rmPrepareTexture(GSTEXTURE
* txt
);
68 /** Flushes all rendering buffers - renders the gs queue, removes all textures from GS ram */
71 /** Issues immediate rendering of the accumulated operations */
72 void rmDispatch(void);
74 void rmDrawQuad(rm_quad_t
* q
);
76 void rmSetupQuad(GSTEXTURE
* txt
, int x
, int y
, short aligned
, int w
, int h
, short scaled
, u64 color
, rm_quad_t
* q
);
78 /** Queues a specified pixmap (tinted with colour) to be rendered on specified position */
79 void rmDrawPixmap(GSTEXTURE
* txt
, int x
, int y
, short aligned
, int w
, int h
, short scaled
, u64 color
);
81 void rmDrawOverlayPixmap(GSTEXTURE
* overlay
, int x
, int y
, short aligned
, int w
, int h
, short scaled
, u64 color
,
82 GSTEXTURE
* inlay
, int ulx
, int uly
, int urx
, int ury
, int blx
, int bly
, int brx
, int bry
);
84 /** Queues a opaque rectangle to be rendered */
85 void rmDrawRect(int x
, int y
, int w
, int h
, u64 color
);
87 /** Queues a single color line to be rendered */
88 void rmDrawLine(int x
, int y
, int x1
, int y1
, u64 color
);
90 /** Starts the frame - first to call every frame */
91 void rmStartFrame(void);
93 /** Ends the frame - last to call every frame */
94 void rmEndFrame(void);
96 /** Sets the clipping rectangle */
97 void rmClip(int x
, int y
, int w
, int h
);
99 /** Sets cipping to none */
102 /** Sets the aspect ratio correction for the upcoming operations.
103 * When set, it will treat all pixmap widths/heights (not positions) as scaled with the ratios provided */
104 void rmSetAspectRatio(float width
, float height
);
106 /** Resets aspect ratio back to 1:1 */
107 void rmResetAspectRatio();
109 /** gets the current aspect ratio */
110 void rmGetAspectRatio(float *w
, float *h
);
112 void rmApplyAspectRatio(int* w
, int* h
);
114 void rmSetShiftRatio(float height
);
116 void rmResetShiftRatio();
118 void rmApplyShiftRatio(int* y
);
120 /** sets the transposition coordiantes (all content is transposed with these values) */
121 void rmSetTransposition(float x
, float y
);