76 lines
1.7 KiB
C
76 lines
1.7 KiB
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "ui.h"
|
|
#include "ui/uifps.h"
|
|
#include "ui/uiconsole.h"
|
|
#include "ui/uiframe.h"
|
|
#include "display/screen.h"
|
|
#include "display/spritebatch/spritebatch.h"
|
|
|
|
#include "display/tileset/tileset_minogram.h"
|
|
#include "display/tileset/tileset_ui.h"
|
|
#include "display/tileset/tileset_ui_frame.h"
|
|
#include "display/tileset/tileset_background.h"
|
|
|
|
ui_t UI;
|
|
|
|
errorret_t uiInit(void) {
|
|
cameraInitOrthographic(&UI.camera);
|
|
|
|
UI.minogramTileset = (tileset_t*)&TILESET_MINOGRAM;
|
|
errorChain(assetManagerLoadAsset(
|
|
UI.minogramTileset->image,
|
|
&UI.minogramAsset,
|
|
&UI.minogramRef
|
|
));
|
|
|
|
UI.uiTileset = (tileset_t*)&TILESET_UI;
|
|
errorChain(assetManagerLoadAsset(
|
|
UI.uiTileset->image,
|
|
&UI.uiAsset,
|
|
&UI.uiRef
|
|
));
|
|
|
|
UI.frameTileset = (tileset_t*)&TILESET_UI_FRAME;
|
|
errorChain(assetManagerLoadAsset(
|
|
UI.frameTileset->image,
|
|
&UI.frameAsset,
|
|
&UI.frameRef
|
|
));
|
|
|
|
UI.backgroundTileset = (tileset_t*)&TILESET_BACKGROUND;
|
|
errorChain(assetManagerLoadAsset(
|
|
UI.backgroundTileset->image,
|
|
&UI.backgroundAsset,
|
|
&UI.backgroundRef
|
|
));
|
|
|
|
errorOk();
|
|
}
|
|
|
|
void uiRender(void) {
|
|
UI.camera.orthographic.left = 0;
|
|
UI.camera.orthographic.right = SCREEN.width;
|
|
UI.camera.orthographic.bottom = SCREEN.height;
|
|
UI.camera.orthographic.top = 0;
|
|
|
|
cameraPushMatrix(&UI.camera);
|
|
|
|
uiFPSRender(UI.minogramTileset, &UI.minogramAsset->alphaImage.texture);
|
|
uiConsoleRender(
|
|
0, 0,
|
|
UI.minogramTileset, &UI.minogramAsset->alphaImage.texture
|
|
);
|
|
spriteBatchFlush();
|
|
|
|
cameraPopMatrix();
|
|
}
|
|
|
|
void uiDispose(void) {
|
|
|
|
} |