mirror of
https://github.com/AntonioND/nitro-engine.git
synced 2025-06-19 00:55:38 -04:00
library: Refactor code that sets the main screen
The old system wasn't super clear about which screen was which. It also relied on libnds functions, but the new system doesn't.
This commit is contained in:
parent
7c614177f7
commit
f246c157f4
@ -78,6 +78,17 @@ void NE_InitConsole(void);
|
|||||||
/// @param color New color.
|
/// @param color New color.
|
||||||
void NE_SetConsoleColor(u32 color);
|
void NE_SetConsoleColor(u32 color);
|
||||||
|
|
||||||
|
/// Set the top screen as main screen.
|
||||||
|
void NE_MainScreenSetOnTop(void);
|
||||||
|
|
||||||
|
/// Set the bottom screen as main screen.
|
||||||
|
void NE_MainScreenSetOnBottom(void);
|
||||||
|
|
||||||
|
/// Returns the current main screen.
|
||||||
|
///
|
||||||
|
/// @return Returns 1 if the top screen is the main screen, 0 otherwise.
|
||||||
|
int NE_MainScreenIsOnTop(void);
|
||||||
|
|
||||||
/// Swap top and bottom screen.
|
/// Swap top and bottom screen.
|
||||||
void NE_SwapScreens(void);
|
void NE_SwapScreens(void);
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ static SpriteEntry *NE_Sprites; // 2D sprites used for Dual 3D mode
|
|||||||
static int ne_znear, ne_zfar;
|
static int ne_znear, ne_zfar;
|
||||||
static int fov;
|
static int fov;
|
||||||
|
|
||||||
|
static int ne_main_screen = 1; // 1 = top, 0 = bottom
|
||||||
|
|
||||||
void NE_End(void)
|
void NE_End(void)
|
||||||
{
|
{
|
||||||
if (!ne_inited)
|
if (!ne_inited)
|
||||||
@ -97,6 +99,26 @@ void NE_Viewport(int x1, int y1, int x2, int y2)
|
|||||||
MATRIX_CONTROL = GL_MODELVIEW;
|
MATRIX_CONTROL = GL_MODELVIEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NE_MainScreenSetOnTop(void)
|
||||||
|
{
|
||||||
|
ne_main_screen = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NE_MainScreenSetOnBottom(void)
|
||||||
|
{
|
||||||
|
ne_main_screen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int NE_MainScreenIsOnTop(void)
|
||||||
|
{
|
||||||
|
return ne_main_screen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NE_SwapScreens(void)
|
||||||
|
{
|
||||||
|
ne_main_screen ^= 1;
|
||||||
|
}
|
||||||
|
|
||||||
void NE_SetFov(int fovValue)
|
void NE_SetFov(int fovValue)
|
||||||
{
|
{
|
||||||
fov = fovValue;
|
fov = fovValue;
|
||||||
@ -120,7 +142,8 @@ static void NE_Init__(void)
|
|||||||
GFX_FLUSH = 0;
|
GFX_FLUSH = 0;
|
||||||
GFX_FLUSH = 0;
|
GFX_FLUSH = 0;
|
||||||
|
|
||||||
lcdMainOnTop();
|
NE_MainScreenSetOnTop();
|
||||||
|
REG_POWERCNT |= POWER_SWAP_LCDS;
|
||||||
|
|
||||||
glResetMatrixStack();
|
glResetMatrixStack();
|
||||||
|
|
||||||
@ -133,7 +156,7 @@ static void NE_Init__(void)
|
|||||||
|
|
||||||
GFX_CLEAR_DEPTH = GL_MAX_DEPTH;
|
GFX_CLEAR_DEPTH = GL_MAX_DEPTH;
|
||||||
|
|
||||||
// Default number of objects for everyting - Textures are inited in
|
// Default number of objects for everyting. Textures are initialized in
|
||||||
// NE_Init3D and NE_InitDual3D
|
// NE_Init3D and NE_InitDual3D
|
||||||
NE_CameraSystemReset(0);
|
NE_CameraSystemReset(0);
|
||||||
NE_PhysicsSystemReset(0);
|
NE_PhysicsSystemReset(0);
|
||||||
@ -180,11 +203,6 @@ static void NE_Init__(void)
|
|||||||
videoSetMode(MODE_0_3D);
|
videoSetMode(MODE_0_3D);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NE_SwapScreens(void)
|
|
||||||
{
|
|
||||||
REG_POWERCNT ^= POWER_SWAP_LCDS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NE_UpdateInput(void)
|
void NE_UpdateInput(void)
|
||||||
{
|
{
|
||||||
ne_input.kdown = keysDown();
|
ne_input.kdown = keysDown();
|
||||||
@ -295,6 +313,11 @@ void NE_Process(NE_Voidfunc drawscene)
|
|||||||
{
|
{
|
||||||
NE_UpdateInput();
|
NE_UpdateInput();
|
||||||
|
|
||||||
|
if (ne_main_screen == 1)
|
||||||
|
REG_POWERCNT |= POWER_SWAP_LCDS;
|
||||||
|
else
|
||||||
|
REG_POWERCNT &= ~POWER_SWAP_LCDS;
|
||||||
|
|
||||||
NE_PolyFormat(31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
NE_PolyFormat(31, 0, NE_LIGHT_ALL, NE_CULL_BACK, 0);
|
||||||
|
|
||||||
GFX_VIEWPORT = NE_viewport;
|
GFX_VIEWPORT = NE_viewport;
|
||||||
@ -317,8 +340,10 @@ void NE_ProcessDual(NE_Voidfunc topscreen, NE_Voidfunc downscreen)
|
|||||||
{
|
{
|
||||||
NE_UpdateInput();
|
NE_UpdateInput();
|
||||||
|
|
||||||
REG_POWERCNT ^= POWER_SWAP_LCDS;
|
if (NE_Screen == ne_main_screen)
|
||||||
NE_Screen ^= 1;
|
REG_POWERCNT |= POWER_SWAP_LCDS;
|
||||||
|
else
|
||||||
|
REG_POWERCNT &= ~POWER_SWAP_LCDS;
|
||||||
|
|
||||||
if (NE_Screen == 1)
|
if (NE_Screen == 1)
|
||||||
{
|
{
|
||||||
@ -423,6 +448,8 @@ void NE_VBLFunc(void)
|
|||||||
if (!NE_effectpause)
|
if (!NE_effectpause)
|
||||||
NE_lastvbladd = (NE_lastvbladd + 1) & LUT_MASK;
|
NE_lastvbladd = (NE_lastvbladd + 1) & LUT_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NE_Screen ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NE_SpecialEffectPause(bool pause)
|
void NE_SpecialEffectPause(bool pause)
|
||||||
|
Loading…
Reference in New Issue
Block a user