persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
UIScreen.hpp
Go to the documentation of this file.
1#pragma once
2#include "types/UITypes.hpp"
3#include <nds.h>
4#include <vector>
5
7{
8 public:
9 // TODO: ensure bgId, oam is set before calling load()
10 int bgId = -1;
11 bool isMain = false;
12 OamState* oam = nullptr;
13 bool isLoaded = false;
14
18 virtual void load() = 0;
19
23 virtual void unload() = 0;
24
28 virtual void triggerAction(UIAction action);
29
33 virtual void renderSprites();
34
38 virtual void renderText()
39 {
40 }
41
45 void removeSprites();
46
53 virtual int onTouch(touchPosition* touch);
54 virtual ~UIScreen() = default;
55 UIScreen(bool iIsMain) : isMain(iIsMain)
56 {
57 }
58
59 protected:
67 void moveSprite(int spriteId, int x, int y);
68
74 void showSprite(int spriteId);
75
81 void hideSprite(int spriteId);
82};
UIAction
Definition UITypes.hpp:23
virtual void triggerAction(UIAction action)
Trigger an action to be handled.
Definition UIScreen.cpp:3
virtual int onTouch(touchPosition *touch)
Hook to allow touch response.
Definition UIScreen.cpp:20
void removeSprites()
Clears the displayed sprites from the screen.
Definition UIScreen.cpp:11
UIScreen(bool iIsMain)
Definition UIScreen.hpp:55
bool isMain
Definition UIScreen.hpp:11
virtual void renderText()
Draws the screen's text. Called after the background is shown.
Definition UIScreen.hpp:38
void hideSprite(int spriteId)
Hides the specified sprite on the screen.
Definition UIScreen.cpp:43
OamState * oam
Definition UIScreen.hpp:12
virtual void load()=0
Loads graphics data into memory & pushes to VRAM.
bool isLoaded
Definition UIScreen.hpp:13
virtual void unload()=0
Unloads graphics data from memory.
void moveSprite(int spriteId, int x, int y)
Moves the specified sprite to the specified position on the screen.
Definition UIScreen.cpp:25
virtual void renderSprites()
Applys sprite colour palette & draws sprites to screen.
Definition UIScreen.cpp:7
void showSprite(int spriteId)
Shows the specified sprite on the screen.
Definition UIScreen.cpp:34
virtual ~UIScreen()=default