mirror of
https://github.com/RocketRobz/SuperAllStarPhotoStudio.git
synced 2025-06-18 17:15:35 -04:00
More DS(i) prep work
This commit is contained in:
parent
5fcdcb383f
commit
eec303feba
@ -58,7 +58,11 @@ namespace GFX {
|
||||
void showCharSprite(int num, bool flipH, int zoomIn, int fadeAlpha, bool lightingEffects = false);
|
||||
void DrawSprite(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
void DrawSpriteLinear(int img, int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
#ifdef _3DS
|
||||
void DrawSpriteBlend(int img, float x, float y, u32 color, float ScaleX = 1, float ScaleY = 1, GPU_TEXTURE_FILTER_PARAM filter = GPU_NEAREST);
|
||||
#else
|
||||
void DrawSpriteBlend(int img, float x, float y, u32 color, float ScaleX = 1, float ScaleY = 1);
|
||||
#endif
|
||||
|
||||
// Draw Cursor.
|
||||
void drawCursor(int cX, int cY);
|
||||
|
@ -19,8 +19,8 @@ include $(DEVKITARM)/ds_rules
|
||||
#---------------------------------------------------------------------------------
|
||||
TARGET := SuperPhotoStudio
|
||||
BUILD := build
|
||||
SOURCES := source ../source source/screens ../source/screens ../source/utils
|
||||
INCLUDES := include ../include include/screens ../include/screens include/utils ../include/utils
|
||||
SOURCES := source ../../source source/screens ../../source/screens ../../source/utils
|
||||
INCLUDES := include ../../include include/screens ../../include/screens include/utils ../../include/utils
|
||||
GRAPHICS := ../gfx
|
||||
MUSIC := ../sound
|
||||
|
||||
|
187
nds/arm9/include/gui.hpp
Normal file
187
nds/arm9/include/gui.hpp
Normal file
@ -0,0 +1,187 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_GUI_HPP
|
||||
#define _UNIVERSAL_CORE_GUI_HPP
|
||||
|
||||
#include "screen.hpp"
|
||||
|
||||
#include <nds.h>
|
||||
|
||||
namespace Gui {
|
||||
// Clear the Text Buffer.
|
||||
void clearTextBufs(void);
|
||||
|
||||
/* Draw a sprite from a SpriteSheet.
|
||||
* sheet: The SpriteSheet which should be used.
|
||||
* imgIndex: The index of the sprite from the sheet which should be drawn.
|
||||
* x: The X Position where the sprite should be drawn.
|
||||
* y: The Y Position where the sprite should be drawn.
|
||||
* ScaleX: The X-Scale for the sprite. (Optional!)
|
||||
* ScaleY: The Y-Scale for the sprite. (Optional!)
|
||||
*/
|
||||
void DrawSprite(int x, int y, float ScaleX = 1, float ScaleY = 1);
|
||||
|
||||
// Initialize the GUI with Citro2D & Citro3D and initialize the Textbuffer. (call this when initializing.)
|
||||
void init(void);
|
||||
|
||||
/* Load a Font. (BCFNT)
|
||||
* fnt: The C2D_Font variable which should be initialized.
|
||||
* Path: Path to the BCFNT file.
|
||||
* if you're unsure, just call 'Gui::init();' and it will load the system font.
|
||||
*/
|
||||
void loadFont(const char * Path = "");
|
||||
|
||||
/* Unload a Font. (BCFNT)
|
||||
* fnt: The C2D_Font variable which should be unloaded.
|
||||
*/
|
||||
void unloadFont();
|
||||
|
||||
/* Load a spritesheet.
|
||||
* Path: Path to the SpriteSheet file. (T3X)
|
||||
* sheet: Reference to the C2D_SpriteSheet declaration.
|
||||
*/
|
||||
void loadSheet(const char* Path);
|
||||
|
||||
/* Unload a spritesheet.
|
||||
* sheet: Reference to the C2D_SpriteSheet which should be free'd.
|
||||
*/
|
||||
void unloadSheet();
|
||||
|
||||
// Exit the GUI. (Call this at exit.)
|
||||
void exit(void);
|
||||
|
||||
/* Draws a centered String.
|
||||
* x: The X Offset from center. (Center: 200 px on top, 160 px on Bottom.)
|
||||
* y: The Y Position of the Text.
|
||||
* size: The size of the Text.
|
||||
* color: The Color of the Text.
|
||||
* Text: The Text which should be displayed.
|
||||
* maxWidth: The maxWidth for the Text. (Optional!)
|
||||
* maxHeight: The maxHeight of the Text. (Optional!)
|
||||
* fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
void DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0);
|
||||
|
||||
/* Draws a String.
|
||||
* x: The X Position where the Text should be drawn.
|
||||
* y: The Y Position where the Text should be drawn.
|
||||
* size: The size of the Text.
|
||||
* color: The Color of the Text.
|
||||
* Text: The Text which should be displayed.
|
||||
* maxWidth: The maxWidth for the Text. (Optional!)
|
||||
* maxHeight: The maxHeight of the Text. (Optional!)
|
||||
* fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
void DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0);
|
||||
|
||||
/* Get the width of a String.
|
||||
* size: The size of the Text.
|
||||
* Text: The Text where the width should be getted from.
|
||||
* fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
float GetStringWidth(float size, std::string Text);
|
||||
|
||||
/* Get the size of a String.
|
||||
* size: The size of the Text.
|
||||
* width: The width of the Text.
|
||||
* height: The height of the Text.
|
||||
* Text: The Text where the size should be getted from.
|
||||
* fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
void GetStringSize(float size, float *width, float *height, std::string Text);
|
||||
|
||||
/* Get the height of a String.
|
||||
* size: The size of the Text.
|
||||
* Text: The Text where the height should be getted from.
|
||||
* fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||
*/
|
||||
float GetStringHeight(float size, std::string Text);
|
||||
|
||||
/* Draw a Rectangle.
|
||||
* x: X Position of the Rectangle.
|
||||
* y: Y Position of the Rectangle.
|
||||
* w: The width of the rectangle.
|
||||
* h: The height of the rectangle.
|
||||
* color: The color of the rectangle.
|
||||
*/
|
||||
bool Draw_Rect(float x, float y, float w, float h, u32 color);
|
||||
|
||||
// Used for the current Screen's Draw. (Optional!)
|
||||
void DrawScreen();
|
||||
|
||||
/* Used for the current Screen's Logic. (Optional!)
|
||||
* hDown: the hidKeysDown() variable.
|
||||
* hHeld: the HidKeysHeld() variable.
|
||||
* touch: The TouchPosition variable.
|
||||
* waitFade: Wheter to wait until the fade ends.
|
||||
*/
|
||||
void ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch, bool waitFade = true);
|
||||
|
||||
/* Transfer the Temp Screen to the used one. (Optional!)
|
||||
* It will check, if the tempScreen variable is not nullptr, so don't worry.
|
||||
*/
|
||||
void transferScreen();
|
||||
|
||||
/* Set a specific Screen with switch function. (Optional!)
|
||||
* screen: unique_ptr of the screen. (Optional by using the screen class.)
|
||||
* screenSwitch: Wheter to switch to the current screen.
|
||||
*/
|
||||
void setScreen(std::unique_ptr<Screen> screen, bool fade = false);
|
||||
|
||||
/* Fades into screens and calls the constructor after it. (Optional!)
|
||||
* fadeoutFrames: Amount of frames for fadeout.
|
||||
* fadeinFrames: Amount of frames for fadein.
|
||||
*/
|
||||
void fadeEffects(int fadeoutFrames = 6, int fadeinFrames = 6);
|
||||
|
||||
/* Set on which screen to draw.
|
||||
* screen: The render target. (Targets are inside the screenCommon.hpp file.)
|
||||
*/
|
||||
void ScreenDraw();
|
||||
|
||||
/* Draws a grid.
|
||||
* xPos: X Position of the grid.
|
||||
* yPos: Y Position of the grid.
|
||||
* Width: Width of the grid.
|
||||
* Height: Height of the grid.
|
||||
* color: Color of the grid.
|
||||
*/
|
||||
void drawGrid(float xPos, float yPos, float Width, float Height, u32 color);
|
||||
|
||||
/* Draws an animated selector.
|
||||
* xPos: X Position of the selector.
|
||||
* yPos: Y Position of the Selector.
|
||||
* Width: Width of the Selector.
|
||||
* Height: Height of the Selector.
|
||||
* speed: The speed of the animation. (Use .030 or something by default.)
|
||||
* SelectorColor: The Color of the Selector.
|
||||
* bgColor: The Color from the middle of the Selector. (Optional! It's transparent by default.)
|
||||
*/
|
||||
void drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed, u32 SelectorColor, u32 bgColor = 0);
|
||||
}
|
||||
|
||||
#endif
|
40
nds/arm9/include/screen.hpp
Normal file
40
nds/arm9/include/screen.hpp
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_SCREEN_HPP
|
||||
#define _UNIVERSAL_CORE_SCREEN_HPP
|
||||
|
||||
#include <nds.h>
|
||||
#include <memory>
|
||||
|
||||
class Screen {
|
||||
public:
|
||||
virtual ~Screen() {}
|
||||
virtual void Logic(u32 hDown, u32 hHeld, touchPosition touch) = 0;
|
||||
virtual void Draw() const = 0;
|
||||
};
|
||||
|
||||
#endif
|
38
nds/arm9/include/screenCommon.hpp
Normal file
38
nds/arm9/include/screenCommon.hpp
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_SCREENCOMMON_HPP
|
||||
#define _UNIVERSAL_CORE_SCREENCOMMON_HPP
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "structs.hpp"
|
||||
|
||||
extern bool fadeout;
|
||||
extern bool fadein;
|
||||
extern int fadealpha;
|
||||
extern int fadecolor;
|
||||
|
||||
#endif
|
49
nds/arm9/include/structs.hpp
Normal file
49
nds/arm9/include/structs.hpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#ifndef _UNIVERSAL_CORE_STRUCTS_HPP
|
||||
#define _UNIVERSAL_CORE_STRUCTS_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
class Structs {
|
||||
public:
|
||||
struct ButtonPos {
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
};
|
||||
|
||||
struct Key {
|
||||
std::string character;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
459
nds/arm9/source/gfx.cpp
Normal file
459
nds/arm9/source/gfx.cpp
Normal file
@ -0,0 +1,459 @@
|
||||
#include "common.hpp"
|
||||
|
||||
#include <ctime>
|
||||
#include <unistd.h>
|
||||
|
||||
/*#define charSpriteSize 0x100000
|
||||
|
||||
static char bgSpriteMem[4][0x200000];
|
||||
static char charSpriteMem[5][charSpriteSize];
|
||||
|
||||
static C2D_SpriteSheet sprites;
|
||||
static C2D_SpriteSheet bgSprite;
|
||||
static C2D_SpriteSheet chracterSprite;*/
|
||||
static bool chracterSpriteLoaded = false;
|
||||
static bool chracterSpriteFound[5] = {false};
|
||||
static bool bgSpriteLoaded = false;
|
||||
|
||||
extern int studioBg;
|
||||
extern u8 settingBits;
|
||||
extern int iFps;
|
||||
|
||||
extern bool showCursor;
|
||||
extern int cursorX;
|
||||
extern int cursorY;
|
||||
extern int cursorAlpha;
|
||||
|
||||
bool animateBg = false;
|
||||
bool bgCanAnimate = false;
|
||||
static int bgAnimationFrame = 0;
|
||||
static int bgAnimationCurrent = 0;
|
||||
static int bgAnimationTime = 0;
|
||||
//static int bgAnimationDelay = 0;
|
||||
static int bgAnimation[8] = {100};
|
||||
|
||||
static int timeOutside = 0; // 0 == Day, 1 == Sunset, 2 == Night
|
||||
|
||||
void GFX::resetCharStatus(int num) {
|
||||
if (num > -1) {
|
||||
chracterSpriteFound[num] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
chracterSpriteFound[0] = false;
|
||||
chracterSpriteFound[1] = false;
|
||||
chracterSpriteFound[2] = false;
|
||||
chracterSpriteFound[3] = false;
|
||||
chracterSpriteFound[4] = false;
|
||||
}
|
||||
|
||||
void GFX::loadSheets() {
|
||||
}
|
||||
|
||||
void GFX::unloadSheets() {
|
||||
}
|
||||
|
||||
static inline bool isDaytime(int hour, int minutes) {
|
||||
if ((hour >= 7 && hour < 20) || (hour == 20 && minutes >= 0 && minutes < 45)) {
|
||||
timeOutside = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool isEvening(int hour, int minutes) {
|
||||
if ((hour == 20 && minutes >= 45 && minutes < 60) || (hour == 21 && minutes >= 0 && minutes < 45)) {
|
||||
timeOutside = 1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GFX::loadBgSprite(void) {
|
||||
if (bgSpriteLoaded) return;
|
||||
|
||||
timeOutside = 2; // Default is Nighttime
|
||||
|
||||
const char* bgPath;
|
||||
time_t t = time(0);
|
||||
int hour = localtime(&t)->tm_hour;
|
||||
int minutes = localtime(&t)->tm_min;
|
||||
|
||||
switch (studioBg) {
|
||||
case 0:
|
||||
default:
|
||||
bgPath = "nitro:/graphics/bg/bg_blue.png";
|
||||
break;
|
||||
case 1:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_loversBell.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_loversBell.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_loversBell.png";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_bougainville.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_bougainville.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_bougainville.png";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
bgPath = "nitro:/graphics/bg/bg_nin10Pro.png";
|
||||
break;
|
||||
case 4:
|
||||
bgPath = "nitro:/graphics/bg/bg_beautician4.png";
|
||||
break;
|
||||
case 5:
|
||||
bgPath = "nitro:/graphics/bg/bg_hairSalon4.png";
|
||||
break;
|
||||
case 6:
|
||||
bgPath = "nitro:/graphics/bg/bg_celestialHotel.png";
|
||||
break;
|
||||
case 7:
|
||||
bgPath = "nitro:/graphics/bg/bg_liveMusicClub4.png";
|
||||
break;
|
||||
case 8:
|
||||
bgPath = "nitro:/graphics/bg/bg_menswearShop.png";
|
||||
break;
|
||||
case 9:
|
||||
bgPath = "nitro:/graphics/bg/bg_VIP.png";
|
||||
break;
|
||||
case 10:
|
||||
bgPath = "nitro:/graphics/bg/bg_restauraunt4.png";
|
||||
break;
|
||||
case 11:
|
||||
bgPath = "nitro:/graphics/bg/bg_cinema.png";
|
||||
break;
|
||||
case 12:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_tropicaBeach_0.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_tropicaBeach_0.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_tropicaBeach.png";
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_primrosePark.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_primrosePark.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_primrosePark.png";
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_cafe3.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_cafe3.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_cafe3.png";
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_mapleCrescent.png";
|
||||
} else if (isEvening(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_mapleCrescent.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_mapleCrescent.png";
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
bgPath = "nitro:/graphics/bg/bg_white.png";
|
||||
break;
|
||||
case 17:
|
||||
bgPath = "nitro:/graphics/bg/bg_yellow.png";
|
||||
break;
|
||||
case 18:
|
||||
bgPath = "nitro:/graphics/bg/bg_snowflakes.png";
|
||||
break;
|
||||
case 19:
|
||||
bgPath = "nitro:/graphics/bg/bg_pinkShine.png";
|
||||
break;
|
||||
case 20:
|
||||
bgPath = "nitro:/graphics/bg/bg_beigeWithCircles.png";
|
||||
break;
|
||||
case 21:
|
||||
bgPath = "nitro:/graphics/bg/bg_gradientPurple.png";
|
||||
break;
|
||||
case 22:
|
||||
bgPath = "nitro:/graphics/bg/bg_greenBirds.png";
|
||||
break;
|
||||
case 23:
|
||||
bgPath = "nitro:/graphics/bg/bg_circlePattern.png";
|
||||
break;
|
||||
case 24:
|
||||
bgPath = "nitro:/graphics/bg/bg_circleWindows.png";
|
||||
break;
|
||||
case 25:
|
||||
bgPath = "nitro:/graphics/bg/bg_bigHearts.png";
|
||||
break;
|
||||
case 26:
|
||||
bgPath = "nitro:/graphics/bg/bg_smallHearts.png";
|
||||
break;
|
||||
case 27:
|
||||
bgPath = "nitro:/graphics/bg/bg_park2Spring.png";
|
||||
break;
|
||||
case 28:
|
||||
bgPath = "nitro:/graphics/bg/bg_park2Summer.png";
|
||||
break;
|
||||
case 29:
|
||||
bgPath = "nitro:/graphics/bg/bg_park2Fall.png";
|
||||
break;
|
||||
case 30:
|
||||
bgPath = "nitro:/graphics/bg/bg_park2Winter.png";
|
||||
break;
|
||||
case 31:
|
||||
bgPath = "nitro:/graphics/bg/bg_downtownSpring.png";
|
||||
break;
|
||||
case 32:
|
||||
bgPath = "nitro:/graphics/bg/bg_downtownSummer.png";
|
||||
break;
|
||||
case 33:
|
||||
bgPath = "nitro:/graphics/bg/bg_downtownFall.png";
|
||||
break;
|
||||
case 34:
|
||||
bgPath = "nitro:/graphics/bg/bg_downtownWinter.png";
|
||||
break;
|
||||
case 35:
|
||||
bgPath = "nitro:/graphics/bg/bg_cafe2Spring.png";
|
||||
break;
|
||||
case 36:
|
||||
bgPath = "nitro:/graphics/bg/bg_cafe2Summer.png";
|
||||
break;
|
||||
case 37:
|
||||
bgPath = "nitro:/graphics/bg/bg_cafe2Fall.png";
|
||||
break;
|
||||
case 38:
|
||||
bgPath = "nitro:/graphics/bg/bg_cafe2Winter.png";
|
||||
break;
|
||||
case 39:
|
||||
if (isDaytime(hour, minutes)) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_exhibitionHall2.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgNight_exhibitionHall2.png";
|
||||
}
|
||||
break;
|
||||
case 40:
|
||||
bgPath = "nitro:/graphics/bg/bg_beautician2.png";
|
||||
break;
|
||||
case 41:
|
||||
bgPath = "nitro:/graphics/bg/bg_afterParty.png";
|
||||
break;
|
||||
case 42:
|
||||
bgPath = "nitro:/graphics/bg/bg_graceShop.png";
|
||||
break;
|
||||
case 43:
|
||||
bgPath = "nitro:/graphics/bg/bg_hairSalon1.png";
|
||||
break;
|
||||
case 44:
|
||||
bgPath = "nitro:/graphics/bg/bg_beautician1.png";
|
||||
break;
|
||||
case 45:
|
||||
bgPath = "nitro:/graphics/bg/bg_lifestyleShop2.png";
|
||||
break;
|
||||
case 46:
|
||||
bgPath = "nitro:/graphics/bg/bg_liveMusicClub2.png";
|
||||
break;
|
||||
case 47:
|
||||
bgPath = "nitro:/graphics/bg/bg_roseGarden2.png";
|
||||
break;
|
||||
case 48:
|
||||
bgPath = "nitro:/graphics/bg/bg_carringtonInstitute.png";
|
||||
break;
|
||||
case 49:
|
||||
bgPath = "nitro:/graphics/bg/bg_peachCastleOutside.png";
|
||||
break;
|
||||
case 50:
|
||||
bgPath = "nitro:/graphics/bg/bg_peachCastle.png";
|
||||
break;
|
||||
}
|
||||
FILE* bgFile = fopen(bgPath, "rb");
|
||||
//fread((void*)bgSpriteMem[0], 1, 0x200000, bgFile);
|
||||
fclose(bgFile);
|
||||
|
||||
bgSpriteLoaded = true;
|
||||
bgAnimationFrame = 0;
|
||||
bgAnimationCurrent = 0;
|
||||
bgAnimationTime = 0;
|
||||
bgCanAnimate = false;
|
||||
|
||||
// Load animated parts
|
||||
if (studioBg == 12 && (timeOutside == 0 || timeOutside == 1)) {
|
||||
if (timeOutside == 0) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_tropicaBeach_1.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_tropicaBeach_1.png";
|
||||
}
|
||||
bgFile = fopen(bgPath, "rb");
|
||||
//fread((void*)bgSpriteMem[1], 1, 0x200000, bgFile);
|
||||
fclose(bgFile);
|
||||
if (timeOutside == 0) {
|
||||
bgPath = "nitro:/graphics/bg/bgDay_tropicaBeach_2.png";
|
||||
} else {
|
||||
bgPath = "nitro:/graphics/bg/bgSunset_tropicaBeach_2.png";
|
||||
}
|
||||
bgFile = fopen(bgPath, "rb");
|
||||
//fread((void*)bgSpriteMem[2], 1, 0x200000, bgFile);
|
||||
fclose(bgFile);
|
||||
//bgAnimationDelay = iFps;
|
||||
bgAnimation[0] = 0;
|
||||
bgAnimation[1] = 1;
|
||||
bgAnimation[2] = 2;
|
||||
bgAnimation[3] = 1;
|
||||
bgAnimation[4] = 100;
|
||||
bgCanAnimate = true;
|
||||
}
|
||||
|
||||
bgSpriteLoaded = true;
|
||||
}
|
||||
|
||||
void GFX::unloadBgSprite() {
|
||||
if (!bgSpriteLoaded) return;
|
||||
|
||||
animateBg = false;
|
||||
bgCanAnimate = false;
|
||||
|
||||
bgSpriteLoaded = false;
|
||||
}
|
||||
|
||||
void GFX::reloadBgSprite() {
|
||||
unloadBgSprite();
|
||||
loadBgSprite();
|
||||
}
|
||||
|
||||
bool GFX::loadCharSprite(int num, const char* t3xPathAllSeasons, const char* t3xPathOneSeason) {
|
||||
if (chracterSpriteLoaded) {
|
||||
chracterSpriteLoaded = false;
|
||||
}
|
||||
chracterSpriteFound[num] = false;
|
||||
bool allSeasons = true;
|
||||
bool fileFound = false;
|
||||
fileFound = (access(t3xPathAllSeasons, F_OK) == 0);
|
||||
if (!fileFound) {
|
||||
allSeasons = false;
|
||||
fileFound = (access(t3xPathOneSeason, F_OK) == 0);
|
||||
}
|
||||
|
||||
if (!fileFound) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FILE* charFile = fopen((allSeasons ? t3xPathAllSeasons : t3xPathOneSeason), "rb");
|
||||
//fread((void*)charSpriteMem[num], 1, charSpriteSize, charFile);
|
||||
fclose(charFile);
|
||||
|
||||
chracterSpriteFound[num] = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GFX::loadCharSpriteMem(int num) {
|
||||
if (chracterSpriteLoaded) {
|
||||
}
|
||||
|
||||
if (!chracterSpriteFound[num]) return;
|
||||
//chracterSprite = C2D_SpriteSheetLoadFromMem(charSpriteMem[num], charSpriteSize);
|
||||
chracterSpriteLoaded = true;
|
||||
}
|
||||
|
||||
void GFX::showBgSprite(int zoomIn) {
|
||||
if (!bgSpriteLoaded) return;
|
||||
}
|
||||
|
||||
void GFX::animateBgSprite(void) {
|
||||
if (!animateBg) return;
|
||||
|
||||
// Animate background
|
||||
bgAnimationTime++;
|
||||
if (bgAnimationTime >= iFps) {
|
||||
bgAnimationCurrent++;
|
||||
if (bgAnimation[bgAnimationCurrent] == 100) {
|
||||
// Reset animation
|
||||
bgAnimationCurrent = 0;
|
||||
}
|
||||
bgAnimationFrame = bgAnimation[bgAnimationCurrent];
|
||||
//bgSprite = C2D_SpriteSheetLoadFromMem(bgSpriteMem[bgAnimationFrame], 0x200000);
|
||||
bgAnimationTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GFX::showCharSprite(int num, bool flipH, int zoomIn, int fadeAlpha, bool lightingEffects) {
|
||||
if (!chracterSpriteLoaded) return;
|
||||
|
||||
int xPos = 0;
|
||||
int yPos = 0;
|
||||
if ((num == 3 || num == 4) && chracterSpriteFound[3]) {
|
||||
if (zoomIn == 0) {
|
||||
return;
|
||||
}
|
||||
yPos += 80;
|
||||
switch (num) {
|
||||
case 3:
|
||||
xPos -= 80;
|
||||
break;
|
||||
case 4:
|
||||
xPos += 80;
|
||||
break;
|
||||
}
|
||||
} else if (chracterSpriteFound[0] && chracterSpriteFound[1] && chracterSpriteFound[2]) {
|
||||
if (zoomIn == 1) {
|
||||
switch (num) {
|
||||
case 0:
|
||||
xPos -= 152;
|
||||
break;
|
||||
case 2:
|
||||
xPos += 152;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (num) {
|
||||
case 0:
|
||||
xPos -= 64;
|
||||
break;
|
||||
case 2:
|
||||
xPos += 64;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (chracterSpriteFound[0] && chracterSpriteFound[1]) {
|
||||
if (zoomIn == 1) {
|
||||
switch (num) {
|
||||
case 0:
|
||||
xPos -= 80;
|
||||
break;
|
||||
case 1:
|
||||
xPos += 80;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (num) {
|
||||
case 0:
|
||||
xPos -= 32;
|
||||
break;
|
||||
case 1:
|
||||
xPos += 32;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GFX::DrawSprite(int img, int x, int y, float ScaleX, float ScaleY) {
|
||||
}
|
||||
|
||||
void GFX::DrawSpriteLinear(int img, int x, int y, float ScaleX, float ScaleY) {
|
||||
}
|
||||
|
||||
void GFX::DrawSpriteBlend(int img, float x, float y, u32 color, float ScaleX, float ScaleY) {
|
||||
}
|
||||
|
||||
void GFX::drawCursor(int cX, int cY) {
|
||||
}
|
161
nds/arm9/source/gui.cpp
Normal file
161
nds/arm9/source/gui.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* This file is part of Universal-Core
|
||||
* Copyright (C) 2020 DeadPhoenix8091, Epicpkmn11, Flame, RocketRobz, StackZ, TotallyNotGuy
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
||||
* * Requiring preservation of specified reasonable legal notices or
|
||||
* author attributions in that material or in the Appropriate Legal
|
||||
* Notices displayed by works containing it.
|
||||
* * Prohibiting misrepresentation of the origin of that material,
|
||||
* or requiring that modified versions of such material be marked in
|
||||
* reasonable ways as different from the original version.
|
||||
*/
|
||||
|
||||
#include "gui.hpp"
|
||||
#include "screenCommon.hpp"
|
||||
|
||||
#include <nds.h>
|
||||
#include <unistd.h>
|
||||
|
||||
std::unique_ptr<Screen> usedScreen, tempScreen; // tempScreen used for "fade" effects.
|
||||
bool currentScreen = false;
|
||||
bool fadeout = false;
|
||||
bool fadein = false;
|
||||
int fadealpha = 0;
|
||||
int fadecolor = 0;
|
||||
|
||||
// Clear Text.
|
||||
void Gui::clearTextBufs(void) { }
|
||||
|
||||
// Draw a sprite from the sheet.
|
||||
void Gui::DrawSprite(int x, int y, float ScaleX, float ScaleY) {
|
||||
}
|
||||
|
||||
// Initialize GUI.
|
||||
void Gui::init(void) {
|
||||
}
|
||||
|
||||
// Load a Font.
|
||||
void Gui::loadFont(const char* Path) {
|
||||
}
|
||||
|
||||
// Unload a Font.
|
||||
void Gui::unloadFont() {
|
||||
}
|
||||
|
||||
// Load a Sheet.
|
||||
void Gui::loadSheet(const char* Path) {
|
||||
}
|
||||
|
||||
// Unload a Sheet.
|
||||
void Gui::unloadSheet() {
|
||||
}
|
||||
|
||||
// Exit the GUI.
|
||||
void Gui::exit(void) {
|
||||
if (usedScreen != nullptr) usedScreen = nullptr;
|
||||
}
|
||||
|
||||
// Draw a Centered String.
|
||||
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight) {
|
||||
}
|
||||
|
||||
// Draw String or Text.
|
||||
void Gui::DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight) {
|
||||
}
|
||||
|
||||
// Get String or Text Width.
|
||||
float Gui::GetStringWidth(float size, std::string Text) {
|
||||
}
|
||||
|
||||
// Get String or Text Size.
|
||||
void Gui::GetStringSize(float size, float *width, float *height, std::string Text) {
|
||||
}
|
||||
|
||||
|
||||
// Get String or Text Height.
|
||||
float Gui::GetStringHeight(float size, std::string Text) {
|
||||
}
|
||||
|
||||
// Draw a Rectangle.
|
||||
bool Gui::Draw_Rect(float x, float y, float w, float h, u32 color) {
|
||||
}
|
||||
|
||||
// Draw's the current screen's draw.
|
||||
void Gui::DrawScreen() {
|
||||
if (usedScreen != nullptr) usedScreen->Draw();
|
||||
}
|
||||
|
||||
// Do the current screen's logic.
|
||||
void Gui::ScreenLogic(u32 hDown, u32 hHeld, touchPosition touch, bool waitFade) {
|
||||
if (waitFade) {
|
||||
if (!fadein && !fadeout) {
|
||||
if (usedScreen != nullptr) usedScreen->Logic(hDown, hHeld, touch);
|
||||
}
|
||||
} else {
|
||||
if (usedScreen != nullptr) usedScreen->Logic(hDown, hHeld, touch);
|
||||
}
|
||||
}
|
||||
|
||||
// Move's the tempScreen to the used one.
|
||||
void Gui::transferScreen() {
|
||||
if (tempScreen != nullptr) usedScreen = std::move(tempScreen);
|
||||
}
|
||||
|
||||
// Set the current Screen.
|
||||
void Gui::setScreen(std::unique_ptr<Screen> screen, bool fade) {
|
||||
tempScreen = std::move(screen);
|
||||
// Switch screen without fade.
|
||||
if (!fade) {
|
||||
Gui::transferScreen();
|
||||
} else {
|
||||
// Fade, then switch.
|
||||
fadeout = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fade's the screen in and out and transfer the screen.
|
||||
// Credits goes to RocketRobz & SavvyManager.
|
||||
void Gui::fadeEffects(int fadeoutFrames, int fadeinFrames) {
|
||||
if (fadein) {
|
||||
fadealpha -= fadeinFrames;
|
||||
if (fadealpha < 0) {
|
||||
fadealpha = 0;
|
||||
fadecolor = 255;
|
||||
fadein = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (fadeout) {
|
||||
fadealpha += fadeoutFrames;
|
||||
if (fadealpha > 255) {
|
||||
fadealpha = 255;
|
||||
Gui::transferScreen(); // Transfer Temp screen to the used one.
|
||||
fadein = true;
|
||||
fadeout = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Select, on which Screen should be drawn.
|
||||
void Gui::ScreenDraw() {
|
||||
}
|
||||
|
||||
void Gui::drawGrid(float xPos, float yPos, float Width, float Height, u32 color) {
|
||||
}
|
||||
|
||||
void Gui::drawAnimatedSelector(float xPos, float yPos, float Width, float Height, float speed, u32 SelectorColor, u32 bgColor) {
|
||||
}
|
@ -10,10 +10,11 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "inifile.h"
|
||||
#include "util/stringtool.h"
|
||||
#include "tonccpy.h"
|
||||
#include "rocketRobz.hpp"
|
||||
#include "screen.hpp"
|
||||
|
||||
u32 hDown = 0;
|
||||
u32 hHeld = 0;
|
||||
touchPosition touch;
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
@ -29,7 +30,6 @@ void doPause() {
|
||||
scanKeys();
|
||||
if (keysDown() & KEY_START)
|
||||
break;
|
||||
snd().updateStream();
|
||||
swiWaitForVBlank();
|
||||
}
|
||||
scanKeys();
|
||||
@ -38,5 +38,18 @@ void doPause() {
|
||||
int main(int argc, char **argv) {
|
||||
defaultExceptionHandler();
|
||||
|
||||
while (1) {
|
||||
// Scan hid shared memory for input events
|
||||
scanKeys();
|
||||
|
||||
hDown = keysDown();
|
||||
hHeld = keysHeld();
|
||||
|
||||
touchRead(&touch);
|
||||
|
||||
Gui::setScreen(std::make_unique<RocketRobz>(), false); // Set screen to product identification.
|
||||
Gui::ScreenLogic(hDown, hHeld, touch, true); // Call the logic of the current screen here.
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
4
nds/clean and compile.bat
Normal file
4
nds/clean and compile.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
make clean
|
||||
make
|
||||
pause
|
2
nds/clean.bat
Normal file
2
nds/clean.bat
Normal file
@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
make clean
|
3
nds/compile.bat
Normal file
3
nds/compile.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
make
|
||||
pause
|
4
nds/gfx/cursor.grit
Normal file
4
nds/gfx/cursor.grit
Normal file
@ -0,0 +1,4 @@
|
||||
-W3
|
||||
-gb
|
||||
-gB4
|
||||
-gT 000000
|
4
nds/gfx/icon_female.grit
Normal file
4
nds/gfx/icon_female.grit
Normal file
@ -0,0 +1,4 @@
|
||||
-W3
|
||||
-gb
|
||||
-gB4
|
||||
-gT 000000
|
4
nds/gfx/icon_male.grit
Normal file
4
nds/gfx/icon_male.grit
Normal file
@ -0,0 +1,4 @@
|
||||
-W3
|
||||
-gb
|
||||
-gB4
|
||||
-gT 000000
|
4
nds/gfx/item_button.grit
Normal file
4
nds/gfx/item_button.grit
Normal file
@ -0,0 +1,4 @@
|
||||
-W3
|
||||
-gb
|
||||
-gB4
|
||||
-gT FF00FF
|
@ -2,10 +2,12 @@
|
||||
#include "screenvars.h"
|
||||
|
||||
void Exiting::Draw(void) const {
|
||||
#ifdef _3DS
|
||||
Gui::ScreenDraw(Top);
|
||||
Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
|
||||
Gui::ScreenDraw(Bottom);
|
||||
Gui::Draw_Rect(0, 0, 320, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, 255)); // Fade in/out effect
|
||||
#endif
|
||||
}
|
||||
|
||||
void Exiting::Logic(u32 hDown, u32 hHeld, touchPosition touch) {
|
||||
|
@ -17,13 +17,13 @@ void RocketRobz::Draw(void) const {
|
||||
} else {
|
||||
GFX::DrawSpriteLinear(sprites_logo_rocketrobz_idx, 0, 0, 0.5, 1);
|
||||
}
|
||||
Gui::Draw_Rect(0, 238, 400, 2, C2D_Color32(0, 0, 0, 255)); // Hide line from other texture(s)
|
||||
Gui::Draw_Rect(0, 238, 400, 2, BLACK); // Hide line from other texture(s)
|
||||
|
||||
if (fadealpha > 0) Gui::Draw_Rect(0, 0, 400, 240, C2D_Color32(fadecolor, fadecolor, fadecolor, fadealpha)); // Fade in/out effect
|
||||
|
||||
if (cinemaWide) {
|
||||
Gui::Draw_Rect(0, 0, 400, 36, C2D_Color32(0, 0, 0, 255));
|
||||
Gui::Draw_Rect(0, 204, 400, 36, C2D_Color32(0, 0, 0, 255));
|
||||
Gui::Draw_Rect(0, 0, 400, 36, BLACK);
|
||||
Gui::Draw_Rect(0, 204, 400, 36, BLACK);
|
||||
}
|
||||
|
||||
if (shiftBySubPixel) return;
|
||||
@ -61,6 +61,7 @@ void RocketRobz::Draw(void) const {
|
||||
if (rr_fadeAlpha > 255) rr_fadeAlpha = 255;
|
||||
}
|
||||
|
||||
#ifdef _3DS
|
||||
if (delay > iFps*9 && gfxIsWide()) {
|
||||
if (prevSubMode != 0) {
|
||||
rr_fadeType = false;
|
||||
@ -71,6 +72,7 @@ void RocketRobz::Draw(void) const {
|
||||
prevSubMode++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user