[ADD] start of controls
This commit is contained in:
0
sce_sys/livearea/contents/bg.png
Normal file → Executable file
0
sce_sys/livearea/contents/bg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
0
sce_sys/livearea/contents/startup.png
Normal file → Executable file
0
sce_sys/livearea/contents/startup.png
Normal file → Executable file
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
35
src/main.c
35
src/main.c
@@ -21,9 +21,10 @@
|
||||
* @brief should be called when an unhandlable exception or error occurs. Triggers coredump.
|
||||
*
|
||||
*/
|
||||
__attribute__((__noreturn__))
|
||||
void shit_yourself(void){
|
||||
while(1){
|
||||
__attribute__((__noreturn__)) void shit_yourself(void)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
*(int *)(0xAA) = 0x55; // trigger coredump
|
||||
}
|
||||
}
|
||||
@@ -31,6 +32,8 @@ void shit_yourself(void){
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
/* to enable analog sampling */
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
||||
SceCtrlData pad;
|
||||
vita2d_pgf *pgf;
|
||||
vita2d_pvf *pvf;
|
||||
@@ -49,11 +52,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
memset(&pad, 0, sizeof(pad));
|
||||
|
||||
BULLET b1 = {1,200,200,RGBA8(255,0,255,255)};
|
||||
BULLET b1 = {1, 200, 200, RGBA8(255, 0, 255, 255)};
|
||||
|
||||
SceUInt64 deltaTime = 0; // delta time in ms
|
||||
SceKernelSysClock sysclock;
|
||||
|
||||
float x1 = 300, y1 = 50, x2 = 400, y2 = 50;
|
||||
|
||||
while (1)
|
||||
{
|
||||
deltaTime = timing_get_deltatime(&sysclock);
|
||||
@@ -68,6 +73,26 @@ int main(int argc, char *argv[])
|
||||
vita2d_start_drawing();
|
||||
vita2d_clear_screen();
|
||||
|
||||
int16_t lxpos = -128 + pad.lx; // full left is 0 so -128 and full right is 255 so 128
|
||||
char leftStick[50] = "left stick: ";
|
||||
sprintf(leftStick, "left stick: %d", lxpos);
|
||||
|
||||
vita2d_pgf_draw_text(pgf, 300, 30, RGBA8(255, 255, 0, 255), 1.0f, leftStick);
|
||||
if (abs(lxpos) > 15)
|
||||
x1 += (lxpos) * (deltaTime / 1000.0);
|
||||
char xtext[50];
|
||||
sprintf(xtext, "x: %f", x1);
|
||||
|
||||
vita2d_pgf_draw_text(pgf, 200, 80, RGBA8(255, 0, 0, 255), 1.0f, xtext);
|
||||
|
||||
if (x1 <= 0)
|
||||
x1 = 0;
|
||||
if (x1 > 700)
|
||||
x1 = 700;
|
||||
|
||||
vita2d_draw_rectangle(x1, y1, (float)10, (float)10, RGBA8(100, 100, 100, 255));
|
||||
vita2d_draw_rectangle(x2, y2, (float)10, (float)10, RGBA8(169, 60, 23, 255));
|
||||
|
||||
// vita2d_draw_texture(image, 100, 100);
|
||||
|
||||
char text[80] = "process time: ";
|
||||
@@ -78,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
vita2d_pgf_draw_text(pgf, 700, 30, RGBA8(0, 255, 0, 255), 1.0f, text);
|
||||
|
||||
vita2d_pvf_draw_text(pvf, 700, 80, RGBA8(0,255,0,255), 1.0f, fps);
|
||||
vita2d_pvf_draw_text(pvf, 700, 80, RGBA8(0, 255, 0, 255), 1.0f, fps);
|
||||
|
||||
sprites_draw_bullet(&b1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user