Skip to content

Commit

Permalink
Add remove feature
Browse files Browse the repository at this point in the history
  • Loading branch information
norips committed Nov 17, 2015
1 parent ab7b108 commit 178e311
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
Binary file modified 3DS_Paint.3dsx
Binary file not shown.
Binary file modified 3DS_Paint.elf
Binary file not shown.
29 changes: 23 additions & 6 deletions source/app.c
Expand Up @@ -232,11 +232,14 @@ void app()
{
if(frame+1>canvassize){
canvassize++;
if((canvasarray=realloc(canvasarray,sizeof(canvas)*(canvassize+1)))!=NULL){}
else { errorPopup = true; }
writeToArray(posxy,&canvasarray[frame]);
frame++;
variableReset();
if((canvasarray=realloc(canvasarray,sizeof(canvas)*(canvassize+1)))==NULL){ errorPopup = true; }
else
{
writeToArray(posxy,&canvasarray[frame]);
frame++;
variableReset();
}

} else {
writeToArray(posxy,&canvasarray[frame]);
frame++;
Expand Down Expand Up @@ -265,6 +268,20 @@ void app()
mode = 2;
rendered = 0;
}
//Remove frame
if (input & KEY_B && closePopup == false && clearPopup == false && savePopup == false)
{
if(canvassize>0)
{
free(canvasarray[frame].point);
memmove(&canvasarray[frame],&canvasarray[frame+1],(canvassize-frame)*sizeof(canvas));
canvassize--;
if(frame>0) frame--;
canvasarray = realloc(canvasarray,sizeof(canvas)*(canvassize+1));
variableReset();
writeToScreen(posxy,&canvasarray[frame]);
}
}
//Press DOWN to go back to app menu
if (input & KEY_DOWN && closePopup == false && clearPopup == false && savePopup == false) closePopup = true;

Expand Down Expand Up @@ -309,7 +326,7 @@ void app()
oldposY=posY;
} else if(mode == 2){
//Exit
if(input & KEY_B){ mode = 1; rendered = 0; }
if(input & KEY_B){ mode = 1; rendered = 0; input=0; variableReset();}
//Lower fps
if(input & KEY_DOWN && framepersecond > 0){framepersecond--;}
//Faster fps
Expand Down
2 changes: 1 addition & 1 deletion source/gui.c
Expand Up @@ -271,7 +271,7 @@ void guiClock()
void guiFrame()
{
drawFillRect(276, 169, 399, 200, 0, 204, 146, screenTopLeft);
sprintf(buffer,"Frame = %03d/%03d",frame,canvassize);
sprintf(buffer,"Frame = %03d/%03d",frame+1,canvassize+1);
gfxDrawText(GFX_TOP, GFX_LEFT ,NULL, buffer, 300, 65 - fontDefault.height );
}

Expand Down

0 comments on commit 178e311

Please sign in to comment.