nolddor wrote:How do you print the "options" string?
Using the function i wrote. The options text is the second vdp_drawtext line in drawGameTxt()
char* getGameTxt(int txtnum, int txtnumtwo)
{
mytxt[0][0] = "PLAY";
mytxt[1][0] = "OPTIONS";
return (mytxt[txtnum][txtnumtwo]);
}
void drawGameTxt()
{
if (loc == 1) VDP_drawText(getGameTxt(0,0), 18, 19); VDP_drawText(getGameTxt(1,0), 16, 20);
}
drawGameTxt is in main like this
while(TRUE)
{
entityInput();
entityAnim();
updateCamera();
drawGameTxt();
VDP_waitVSync();
}
And this is what triggers the events. assetLoader is another one of my functions.
static void joyEvent(u16 joy, u16 changed, u16 state)
{
if (changed & state & BUTTON_START)
{
if (loc == 1) loc++; assetLoader(loc);
}
}
void assetLoader(int pack)
{
if (pack == 1)
{
titlebgmap = unpackMap(titlebg_tiles.map, NULL);
ind = TILE_USERINDEX;
VDP_loadTileSet(titlebg_tiles.tileset, ind, TRUE);
VDP_setMapEx(BPLAN, titlebgmap, TILE_ATTR_FULL(PAL2, FALSE, FALSE, FALSE, ind), PlanXPosInTile, PlanYPosInTile, MapXPosInTile, MapYPosInTile, MapWidthInTile, MapHeightInTile);
ind += titlebg_tiles.tileset->numTile;
titlelogomap = unpackMap(titlelogo_tiles.map, NULL);
VDP_loadTileSet(titlelogo_tiles.tileset, ind, TRUE);
VDP_setMapEx(APLAN, titlelogomap, TILE_ATTR_FULL(PAL3, FALSE, FALSE, FALSE, ind), 10, 1, 0, 0, 20, 17);
ind += titlelogo_tiles.tileset->numTile;
}
if (pack == 2)
{
ind = 0;
SYS_disableInts();
VDP_clearText(18, 19, 40);
VDP_clearText(16, 20, 40);
VDP_clearPlan(APLAN, TRUE);
VDP_clearPlan(BPLAN, TRUE);
SYS_enableInts();
// init jaris sprite
player1.hmirror = 0;
player1.vmirror = 0;
player1.zorder = 0;
player1.x = 150;
player1.y = 150;
player1.current_frame = 0;
player1.current_anim = ANIM_STANDSIDES;
player1.animspeeds[0] = 50;
player1.animspeeds[1] = 20;
player1.animspeeds[2] = 2;
//Citizen vars
cxypos[0][0] = 160;
cxypos[1][0] = 150;
czorder = 1;
VDP_setPalette(PAL0, sjaris_sprite.palette->data);
VDP_setPalette(PAL1, fcitizen_sprite.palette->data);
VDP_setPalette(PAL2, city_tiles.palette->data);
SPR_initSprite(&sprites[player1.zorder], &sjaris_sprite, player1.x, player1.y, TILE_ATTR(PAL0, TRUE, FALSE, FALSE));
SPR_initSprite(&sprites[czorder], &fcitizen_sprite, cxypos[0][0], cxypos[1][0], TILE_ATTR(PAL1, TRUE, FALSE, FALSE));
SPR_update(sprites, 0);
SPR_update(sprites, 1);
citymap = unpackMap(city_tiles.map, NULL);
ind = TILE_USERINDEX;
VDP_loadTileSet(city_tiles.tileset, ind, TRUE);
VDP_setMapEx(BPLAN, citymap, TILE_ATTR_FULL(PAL2, FALSE, FALSE, FALSE, ind), PlanXPosInTile, PlanYPosInTile, MapXPosInTile, MapYPosInTile, MapWidthInTile, MapHeightInTile);
ind += city_tiles.tileset->numTile;
}
}