9#include "../VideoDriver.h"
17 ~OgcVideoDriver()
override;
19 void init(
int width,
int height)
override;
26 int getRefreshRate()
const override {
return vmode && (vmode->viTVMode >> 2) == VI_PAL ? 50 : 60; }
27 float getDeltaTime()
const override {
return vmode && (vmode->viTVMode >> 2) == VI_PAL ? (1.0f / 50.0f) : (1.0f / 60.0f); }
34 void resetVideoMenu();
37 uint32_t frameTimer = 0;
38 uint32_t* xfb[2] = {
nullptr,
nullptr };
40 GXRModeObj* vmode =
nullptr;
41 void* gp_fifo =
nullptr;
43 ImageRenderer* imageRenderer =
nullptr;
44 GlyphRenderer* glyphRenderer =
nullptr;
53 void loadTextureData(
void * texture,
const uint8_t * rgba,
int width,
int height)
override;
55 void drawTexture(
void * texture,
float xpos,
float ypos, uint16_t width, uint16_t height,
float degrees,
float scaleX,
float scaleY, uint8_t alpha)
override;
60 void drawMeshInstance(
void* mesh,
float x,
float y,
float scaleX,
float scaleY)
override;
66void OgcFreeRetiredMeshes();
80 void*
createTexture(uint16_t width, uint16_t height)
override;
84 void drawQuad(
void* texture, int16_t screenX, int16_t screenY, uint16_t width, uint16_t height,
const PixelColor& color)
override;
85 void drawFeature(int16_t screenX, int16_t screenY, uint16_t width, uint16_t height,
const PixelColor& color)
override;
Draws glyph textures and solid rectangles on behalf of GuiTextRenderer.
Platform image/texture backend GuiImageData and GuiImage delegate to.
void loadTextureData(void *texture, FT_Bitmap *bitmap) override
Uploads a rasterized FreeType glyph bitmap into a texture from createTexture().
void setVertexFormat(uint8_t vtxFmtIndex)
Changes which GX vertex format slot subsequent draws use.
void destroyTexture(void *texture) override
Destroys a texture created by createTexture().
void drawFeature(int16_t screenX, int16_t screenY, uint16_t width, uint16_t height, const PixelColor &color) override
Draws a solid-color rectangle used for text decoration (underline/strike-through).
OgcGlyphRenderer(uint8_t vtxFmtIndex=GX_VTXFMT1)
void * createTexture(uint16_t width, uint16_t height) override
Allocates an empty single-channel glyph texture. Returns an opaque handle.
void drawQuad(void *texture, int16_t screenX, int16_t screenY, uint16_t width, uint16_t height, const PixelColor &color) override
Draws a glyph texture as a quad tinted with color.
GX-backed ImageRenderer for GuiImage/GuiImageData textures.
void loadTextureData(void *texture, const uint8_t *rgba, int width, int height) override
Loads raw RGBA8 pixels into the pre-allocated texture.
void * createTexture(int width, int height) override
Allocates an empty hardware-aligned texture buffer.
void destroyTexture(void *texture) override
Destroys a texture created by createTexture.
void drawMeshInstance(void *mesh, float x, float y, float scaleX, float scaleY) override
Draws a mesh from createMesh() fully opaque, as its vertex colors say.
void drawMesh(const MeshVertex *vertices, size_t count) override
Draws a triangle list: three vertices per triangle, each with its own color.
void * createMesh(const MeshVertex *vertices, size_t count) override
Hands a triangle list to the backend to keep in its own ready-to-draw form (a GX display list,...
void drawRectangle(float x, float y, float width, float height, PixelColor color) override
Draws a solid-color rectangle (alpha-blended using color.a).
void drawTexture(void *texture, float xpos, float ypos, uint16_t width, uint16_t height, float degrees, float scaleX, float scaleY, uint8_t alpha) override
Draws a texture created by createTexture.
void destroyMesh(void *mesh) override
Releases a mesh from createMesh().
GlyphRenderer * getGlyphRenderer() override
int getScreenWidth() const override
void shutdown() override
Releases the video backend. Call after every other user of the renderers has finished.
uint32_t getFrameTimer() override
float getDeltaTime() const override
void render() override
Flushes the current frame to the screen and swaps buffers.
int getScreenHeight() const override
int getRefreshRate() const override
void clearScreen(const PixelColor &color) override
Clears the current frame buffer.
void init(int width, int height) override
ImageRenderer * getImageRenderer() override
Platform video backend owning the frame lifecycle (init/render/clear, screen size,...
A single 2D vertex with its own color, in design-canvas coordinates.
8-bit-per-channel RGBA color used by the video interfaces.