-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created screen_manage.c and top screen cursor
- Loading branch information
Showing
5 changed files
with
53 additions
and
20 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "editor.c" | ||
|
||
static bool screenSwap=true; | ||
static float cursorX=0; | ||
static float cursorY=0; | ||
|
||
static void updateCursor(u32 kHeld){ | ||
if(kHeld&KEY_DRIGHT){cursorX++;} | ||
if(kHeld&KEY_DDOWN) {cursorY++;} | ||
if(kHeld&KEY_DLEFT) {cursorX--;} | ||
if(kHeld&KEY_DUP) {cursorY--;} | ||
} | ||
|
||
static void renderCursor(float cursorX, float cursorY, bool pressedA){ | ||
u32 c=C2D_Color32(10,10,10,0xFF); | ||
if(pressedA){c=C2D_Color32(100,100,100,0xFF);} | ||
C2D_DrawTriangle(cursorX+0,cursorY+0,c,cursorX+15,cursorY+0,c,cursorX+0,cursorY+15,c,0); | ||
} | ||
|
||
static void renderScreen(u32 kDown, u32 kHeld, bool scr, float touchX, float touchY){ | ||
updateCursor(kHeld); | ||
bool pressedA=false;if(kHeld&KEY_A){pressedA=true;} | ||
float useX=touchX;float useY=touchY; | ||
if(scr){ | ||
if(pressedA){ | ||
useX=cursorX; | ||
useY=cursorY; | ||
} else { | ||
useX=0.0f;useY=0.0f; | ||
} | ||
} | ||
if(scr^screenSwap){ | ||
editorBackend(scr,useX,useY); | ||
} else { | ||
// temporary triangle | ||
C2D_DrawTriangle(0,0,C2D_Color32(0xFF,10,10,0xFF),150,0,C2D_Color32(10,0xFF,10,0xFF),0,150,C2D_Color32(10,10,0xFF,0xFF),0); | ||
} | ||
if(scr){ | ||
renderCursor(cursorX,cursorY,pressedA); | ||
} | ||
} | ||
|
||
static void screenSwapCheck(u32 kDown){ | ||
if (kDown & KEY_L) | ||
screenSwap=!screenSwap; | ||
} |