mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-05 00:39:14 +00:00
Some more screen class things.
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
#include "font.hpp"
|
#include "font.hpp"
|
||||||
#include "image.hpp"
|
#include "image.hpp"
|
||||||
|
#include "screen.hpp"
|
||||||
#include "sprite.hpp"
|
#include "sprite.hpp"
|
||||||
|
|
||||||
#include <nds/ndstypes.h>
|
#include <nds/ndstypes.h>
|
||||||
@@ -83,6 +84,30 @@ namespace Graphics {
|
|||||||
* @param layer The layer to draw to
|
* @param layer The layer to draw to
|
||||||
*/
|
*/
|
||||||
void drawRectangle(int x, int y, int w, int h, u8 color1, u8 color2, bool top, bool layer);
|
void drawRectangle(int x, int y, int w, int h, u8 color1, u8 color2, bool top, bool layer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Draws the setted screen
|
||||||
|
*/
|
||||||
|
void drawScreen();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The current screen logic
|
||||||
|
* @param hDown The keysDown variable
|
||||||
|
* @param hHeld The keysHeld variable
|
||||||
|
* @param touch The TouchPosition variable
|
||||||
|
*/
|
||||||
|
void screenLogic(u32 hDown, u32 hHeld, touchPosition touch);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a specific Screen with the Screen class
|
||||||
|
* @param screen The screen which to set
|
||||||
|
*/
|
||||||
|
void setScreen(std::unique_ptr<Screen> screen);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Goes a screen back
|
||||||
|
*/
|
||||||
|
void screenBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+1
-1
@@ -28,7 +28,7 @@
|
|||||||
#define _UNIVERSAL_CORE_SCREEN_HPP
|
#define _UNIVERSAL_CORE_SCREEN_HPP
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <nds/ndstypes.h>
|
#include <nds.h>
|
||||||
|
|
||||||
class Screen {
|
class Screen {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -29,9 +29,11 @@
|
|||||||
#include "tonccpy.h"
|
#include "tonccpy.h"
|
||||||
|
|
||||||
#include <nds.h>
|
#include <nds.h>
|
||||||
|
#include <stack>
|
||||||
|
|
||||||
int Graphics::bg3Main, Graphics::bg2Main, Graphics::bg3Sub, Graphics::bg2Sub;
|
int Graphics::bg3Main, Graphics::bg2Main, Graphics::bg3Sub, Graphics::bg2Sub;
|
||||||
bool Graphics::wideScreen = false;
|
bool Graphics::wideScreen = false;
|
||||||
|
static std::stack<std::unique_ptr<Screen>> screens;
|
||||||
|
|
||||||
void Graphics::init(void) {
|
void Graphics::init(void) {
|
||||||
// Initialize video mode
|
// Initialize video mode
|
||||||
@@ -89,3 +91,22 @@ void Graphics::drawRectangle(int x, int y, int w, int h, u8 color1, u8 color2, b
|
|||||||
toncset(dst + ((y + i) * 256 + x), ((i % 2) ? color1 : color2), w);
|
toncset(dst + ((y + i) * 256 + x), ((i % 2) ? color1 : color2), w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Graphics::drawScreen() {
|
||||||
|
if (!screens.empty())
|
||||||
|
screens.top()->Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::screenLogic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||||
|
if (!screens.empty())
|
||||||
|
screens.top()->Logic(hDown, hHeld, touch);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::setScreen(std::unique_ptr<Screen> screen) {
|
||||||
|
screens.push(std::move(screen));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Graphics::screenBack() {
|
||||||
|
if (screens.size() > 0)
|
||||||
|
screens.pop();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user