Skip to content

Commit

Permalink
Icons that are touching the screen edges are now close to the next/pr…
Browse files Browse the repository at this point in the history
…ev icons
  • Loading branch information
RocketRobz committed Feb 25, 2018
1 parent af44d4f commit 8f27a69
Showing 1 changed file with 96 additions and 12 deletions.
108 changes: 96 additions & 12 deletions romsel_dsimenutheme/arm9/source/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ int titleboxXpos;
int titleboxYpos = 84;
int titlewindowXpos;

int movecloseXpos = 0;

bool startBorderZoomOut = false;
int startBorderZoomAnimSeq[5] = {0, 1, 2, 1, 0};
int startBorderZoomAnimNum = 0;
Expand Down Expand Up @@ -178,6 +180,70 @@ void SetBrightness(u8 screen, s8 bright) {
*(u16*)(0x0400006C + (0x1000 * screen)) = bright + mode;
}

void moveIconClose(int num) {
if (titleboxXmoveleft) {
movecloseXpos = 0;
if(movetimer == 1) {
if (cursorPosition-2 == num) movecloseXpos = 1;
else if (cursorPosition+2 == num) movecloseXpos = -2;
} else if(movetimer == 2) {
if (cursorPosition-2 == num) movecloseXpos = 1;
else if (cursorPosition+2 == num) movecloseXpos = -2;
} else if(movetimer == 3) {
if (cursorPosition-2 == num) movecloseXpos = 2;
else if (cursorPosition+2 == num) movecloseXpos = -3;
} else if(movetimer == 4) {
if (cursorPosition-2 == num) movecloseXpos = 2;
else if (cursorPosition+2 == num) movecloseXpos = -3;
} else if(movetimer == 5) {
if (cursorPosition-2 == num) movecloseXpos = 3;
else if (cursorPosition+2 == num) movecloseXpos = -4;
} else if(movetimer == 6) {
if (cursorPosition-2 == num) movecloseXpos = 4;
else if (cursorPosition+2 == num) movecloseXpos = -5;
} else if(movetimer == 7) {
if (cursorPosition-2 == num) movecloseXpos = 5;
else if (cursorPosition+2 == num) movecloseXpos = -6;
} else if(movetimer == 8) {
if (cursorPosition-2 == num) movecloseXpos = 6;
else if (cursorPosition+2 == num) movecloseXpos = -7;
}
}
if (titleboxXmoveright) {
movecloseXpos = 0;
if(movetimer == 1) {
if (cursorPosition-2 == num) movecloseXpos = 2;
else if (cursorPosition+2 == num) movecloseXpos = -1;
} else if(movetimer == 2) {
if (cursorPosition-2 == num) movecloseXpos = 2;
else if (cursorPosition+2 == num) movecloseXpos = -1;
} else if(movetimer == 3) {
if (cursorPosition-2 == num) movecloseXpos = 3;
else if (cursorPosition+2 == num) movecloseXpos = -2;
} else if(movetimer == 4) {
if (cursorPosition-2 == num) movecloseXpos = 3;
else if (cursorPosition+2 == num) movecloseXpos = -2;
} else if(movetimer == 5) {
if (cursorPosition-2 == num) movecloseXpos = 4;
else if (cursorPosition+2 == num) movecloseXpos = -3;
} else if(movetimer == 6) {
if (cursorPosition-2 == num) movecloseXpos = 5;
else if (cursorPosition+2 == num) movecloseXpos = -4;
} else if(movetimer == 7) {
if (cursorPosition-2 == num) movecloseXpos = 6;
else if (cursorPosition+2 == num) movecloseXpos = -5;
} else if(movetimer == 8) {
if (cursorPosition-2 == num) movecloseXpos = 7;
else if (cursorPosition+2 == num) movecloseXpos = -6;
}
}
if(!titleboxXmoveleft || !titleboxXmoveright) {
if (cursorPosition-2 == num) movecloseXpos = 6;
else if (cursorPosition+2 == num) movecloseXpos = -6;
else movecloseXpos = 0;
}
}

//-------------------------------------------------------
// set up a 2D layer construced of bitmap sprites
// this holds the image when rendering to the top screen
Expand Down Expand Up @@ -316,12 +382,6 @@ void vBlankHandler()
}
}

if(pagenum == 0) {
glSprite(-32-titleboxXpos, titleboxYpos-1, GL_FLIP_NONE, settingsImage);
if (theme == 1) glSprite(32-titleboxXpos, titleboxYpos, GL_FLIP_NONE, boxfullImage);
else glSprite(32-titleboxXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[0 & 63]);
drawIconGBA(48-titleboxXpos, titleboxYpos+12);
}
if (theme==0) {
glColor(RGB15(31, 31, 31));
if (cursorPosition >= 0) glSprite(16+titlewindowXpos, 171, GL_FLIP_NONE, scrollwindowImage);
Expand All @@ -344,16 +404,40 @@ void vBlankHandler()
}
int spawnedboxXpos = 96;
int iconXpos = 112;
if(pagenum == 0) {
for(int i = -2; i < 0; i++) {
if (theme == 0) {
moveIconClose(i);
} else {
movecloseXpos = 0;
}
if (i == -2) {
glSprite(-32-titleboxXpos+movecloseXpos, titleboxYpos-1, GL_FLIP_NONE, settingsImage);
} else if (i == -1) {
if (theme == 1) glSprite(32-titleboxXpos+movecloseXpos, titleboxYpos, GL_FLIP_NONE, boxfullImage);
else glSprite(32-titleboxXpos+movecloseXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[0 & 63]);
drawIconGBA(48-titleboxXpos+movecloseXpos, titleboxYpos+12);
}
}
}
for(int i = 0; i < 40; i++) {
if (theme == 0) {
moveIconClose(i);
} else {
movecloseXpos = 0;
}
if (i < spawnedtitleboxes) {
if (theme == 1) glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, boxfullImage);
else glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[0 & 63]);
if (romtype == 1) drawIconGBC(iconXpos-titleboxXpos, titleboxYpos+12, i);
else if (romtype == 2) drawIconNES(iconXpos-titleboxXpos, titleboxYpos+12);
else drawIcon(iconXpos-titleboxXpos, titleboxYpos+12, i);
else glSprite(spawnedboxXpos-titleboxXpos+movecloseXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[0 & 63]);
if (romtype == 1) drawIconGBC(iconXpos-titleboxXpos+movecloseXpos, titleboxYpos+12, i);
else if (romtype == 2) drawIconNES(iconXpos-titleboxXpos+movecloseXpos, titleboxYpos+12);
else drawIcon(iconXpos-titleboxXpos+movecloseXpos, titleboxYpos+12, i);
} else {
if (theme == 1) glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, boxemptyImage);
else glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[1 & 63]);
if (theme == 1) {
glSprite(spawnedboxXpos-titleboxXpos, titleboxYpos, GL_FLIP_NONE, boxemptyImage);
} else {
glSprite(spawnedboxXpos-titleboxXpos+movecloseXpos, titleboxYpos, GL_FLIP_NONE, &boxfullImage[1 & 63]);
}
}
spawnedboxXpos += 64;
iconXpos += 64;
Expand Down

0 comments on commit 8f27a69

Please sign in to comment.