#ifndef MOUSE_SPEED
#define MOUSE_SPEED
#define slow 0
#define normal 1
#define fast 2
#endif
extern char snesfont, snespal, cursorsprite, cursorsprite_end, cursorpal, buttonsmap, buttonstiles, buttonstiles_end, buttonspal;
char hex_string[4];
u16 p1_mouse_x = 0x80;
u16 p1_mouse_y = 0x70;
u16 p2_mouse_x = 0x80;
u16 p2_mouse_y = 0x70;
u8 odd = 0;
bool mc_mem[2] = {false};
bool printed[2] = {false};
bool mouseDown_L[2] = {false};
bool mouseDown_R[2] = {false};
bool mouseDown_LR[2] = {false};
bool speedset[2] = {true};
int main(void)
{
else
{
}
else
{
}
bgInitTileSet(1, &buttonstiles, &buttonspal, 1, (&buttonstiles_end - &buttonstiles), 16 * 2, BG_16COLORS, 0x4000);
while (1)
{
odd++;
printed[0] = true;
{
if (printed[0])
{
printed[0] = false;
}
}
else
{
else
if (mouse_y[0] & 0x80)
p1_mouse_y -= mouse_y[0] & 0x7F;
else
p1_mouse_y += mouse_y[0] & 0x7F;
if (p1_mouse_x > 0xFF00)
p1_mouse_x = 0;
if (p1_mouse_x > 0xFF)
p1_mouse_x = 0xFF;
if (p1_mouse_y > 0xFF00)
p1_mouse_y = 0;
if (p1_mouse_y > 0xEF)
p1_mouse_y = 0xEF;
if (printed[0])
{
printed[0] = false;
}
odd = 1;
{
sprintf(hex_string, "%02X", p1_mouse_x);
sprintf(hex_string, "%02X", p1_mouse_y);
}
{
if (mouseDown_L[0] == false)
{
mouseDown_L[0] = true;
mouseDown_R[0] = false;
mouseDown_LR[0] = false;
}
break;
case mouse_R:
if (mouseDown_R[0] == false)
{
mouseDown_L[0] = false;
mouseDown_R[0] = true;
mouseDown_LR[0] = false;
}
break;
if (mouseDown_LR[0] == false)
{
mouseDown_L[0] = false;
mouseDown_R[0] = false;
mouseDown_LR[0] = true;
}
break;
}
}
printed[1] = true;
{
if (printed[1])
{
printed[1] = false;
}
}
else
{
else
if (mouse_y[1] & 0x80)
p2_mouse_y -= mouse_y[1] & 0x7F;
else
p2_mouse_y += mouse_y[1] & 0x7F;
if (p2_mouse_x > 0xFF00)
p2_mouse_x = 0;
if (p2_mouse_x > 0xFF)
p2_mouse_x = 0xFF;
if (p2_mouse_y > 0xFF00)
p2_mouse_y = 0;
if (p2_mouse_y > 0xEF)
p2_mouse_y = 0xEF;
if (printed[1])
{
printed[1] = false;
}
odd = 0;
{
sprintf(hex_string, "%02X", p2_mouse_x, p2_mouse_y);
sprintf(hex_string, "%02X", p2_mouse_y);
}
{
if (mouseDown_L[1] == false)
{
mouseDown_L[1] = true;
mouseDown_R[1] = false;
mouseDown_LR[1] = false;
}
break;
case mouse_R:
if (mouseDown_R[1] == false)
{
mouseDown_L[1] = false;
mouseDown_R[1] = true;
mouseDown_LR[1] = false;
}
break;
if (mouseDown_LR[1] == false)
{
mouseDown_L[1] = false;
mouseDown_R[1] = false;
mouseDown_LR[1] = true;
}
break;
}
}
{
{
if ((p1_mouse_y > 0x5E) && (p1_mouse_y < 0x6C))
{
if ((p1_mouse_x > 0x44) && (p1_mouse_x < 0x64))
{
speedset[0] = true;
}
if ((p1_mouse_x > 0x6C) && (p1_mouse_x < 0x94))
{
speedset[0] = true;
}
if ((p1_mouse_x > 0x9C) && (p1_mouse_x < 0xBC))
{
speedset[0] = true;
}
}
}
if (speedset[0])
{
{
case slow:
break;
case normal:
break;
case fast:
break;
}
speedset[0] = false;
}
}
else if (speedset[0] == false)
{
speedset[0] = true;
}
{
{
if ((p2_mouse_y > 0xBE) && (p2_mouse_y < 0xCC))
{
if ((p2_mouse_x > 0x44) && (p2_mouse_x < 0x64))
{
speedset[1] = true;
}
if ((p2_mouse_x > 0x6C) && (p2_mouse_x < 0x94))
{
speedset[1] = true;
}
if ((p2_mouse_x > 0x9C) && (p2_mouse_x < 0xBC))
{
speedset[1] = true;
}
}
}
if (speedset[1])
{
{
case slow:
break;
case normal:
break;
case fast:
break;
}
speedset[1] = false;
}
}
else if (speedset[1] == false)
{
speedset[1] = true;
}
}
return 0;
}
void bgSetGfxPtr(u8 bgNumber, u16 address)
Definition of each background address.
void bgSetDisable(u8 bgNumber)
Disable a BG in the actual SNES mode.
void bgSetMapPtr(u8 bgNumber, u16 address, u8 mapSize)
Change Background Map address.
void bgInitTileSet(u8 bgNumber, u8 *tileSource, u8 *tilePalette, u8 paletteEntry, u16 tileSize, u16 paletteSize, u16 colorMode, u16 address)
Initializes a Tile Set and Loads the Tile GFX into VRAM.
void consoleSetTextVramAdr(u16 vramfont)
Change text graphics address (4K aligned)
void consoleInitText(u8 palnum, u8 palsize, u8 *tilfont, u8 *palfont)
Initialize the Text System.
void consoleInit(void)
Initialize console.
void consoleDrawText(u16 x, u16 y, char *fmt,...)
Output formatted string on a screen (tiles mode)
void consoleSetTextOffset(u16 offsetfont)
Change text Background map address for display (must be BG address)
void consoleSetTextVramBGAdr(u16 offsetfont)
Change text Background map address for display (must be BG address)
void dmaFillVram(u8 *source, u16 address, u16 size)
fill the source data to destination using channel 0 of DMA available channels in half words
void dmaCopyVram(u8 *source, u16 address, u16 size)
copy data from source to destination using channel 0 of DMA available channels in half words
void WaitForVBlank(void)
Wait for vblank interrupt
the master include file for snes applications.
#define OBJ_SIZE16_L32
default OAM size 16x16 (SM) and 32x32 (LG) pix for OBJSEL register
Definition: sprite.h:42
void oamSetVisible(u16 id, u8 hide)
Hide or show a sprite.
void oamInitGfxSet(u8 *tileSource, u16 tileSize, u8 *tilePalette, u16 paletteSize, u8 tilePaletteNumber, u16 address, u8 oamsize)
Initializes a sprites Gfx and Loads the GFX into VRAM.
void oamSet(u16 id, u16 xspr, u16 yspr, u8 priority, u8 hflip, u8 vflip, u16 gfxoffset, u8 paletteoffset)
sets an oam entry to the supplied values
void setScreenOn(void)
Put screen On.
void setMode(u8 mode, u8 size)
Set the SNES hardware to operate in new display mode.