// -------------------------------------------------- void BoxViewer::drawCursorButton(int16_t x, int16_t y) // -------------------------------------------------- { if (!sPkm && sPkmCount == 0) { sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 21 + 0, y, 0, 0, 50, 32); sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 21 + 64, y, 64, 0, 50, 32); sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 21 + 128, y, 128, 0, 50, 32); } else { sf2d_draw_texture_part_blend(PHBanku::texture->boxTiles, x + 21 + 0, y, 0, 0, 50, 32, RGBA8(0xCC,0xCC,0xCC,0xAA)); sf2d_draw_texture_part_blend(PHBanku::texture->boxTiles, x + 21 + 64, y, 64, 0, 50, 32, RGBA8(0xCC,0xCC,0xCC,0xAA)); if (cursorType == CursorType::MultiSelect) sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 21 + 128, y, 128, 0, 64, 32); else sf2d_draw_texture_part_blend(PHBanku::texture->boxTiles, x + 21 + 128, y, 128, 0, 50, 32, RGBA8(0xCC,0xCC,0xCC,0xAA)); } }
// -------------------------------------------------- void BoxViewer::drawPokemon(pkm_s* pkm, int16_t x, int16_t y, bool shadow) // -------------------------------------------------- { if (pkm->speciesID == 0) return; // sf2d_draw_rectangle(x, y, PKM_WIDTH, PKM_HEIGHT, RGBA8(0x00,0x00,0x00,0x22)); sf2d_texture* pkmIcons = PHBanku::texture->pkmIcons; if (pkm->isShiny) pkmIcons = PHBanku::texture->pkmShinyIcons; // Draw the shadow if (shadow) { sf2d_draw_texture_part_blend(pkmIcons, x+4, y+4, (pkm->speciesID % 25) * 40, (pkm->speciesID / 25) * 30, 40, 30, RGBA8(0x00,0x00,0x00,0x55)); } if (pkm->isEggy) { // Draw the egg+Pokémon icon sf2d_draw_texture_part_blend(pkmIcons, x, y, (pkm->speciesID % 25) * 40, (pkm->speciesID / 25) * 30, 40, 30, RGBA8(0xFF,0xFF,0xFF,0xAA)); sf2d_draw_texture_part_blend(pkmIcons, x, y, (EGG_ID % 25) * 40, (EGG_ID / 25) * 30, 40, 30, RGBA8(0xFF,0xFF,0xFF,0x88)); } else { // Draw the Pokémon icon sf2d_draw_texture_part(pkmIcons, x, y, (pkm->speciesID % 25) * 40, (pkm->speciesID / 25) * 30, 40, 30); // Draw the item if (pkm->itemID > 0) { sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 23, y + 21, 48, 82, 12, 12); } } // Draw the checkbox if (pkm->checked) { // TODO: Draw a check mark sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 3, y + 22, 96, 56, 8, 8); } }
static int graphicsDraw(lua_State *L) { // love.graphics.draw() if (sf2d_get_current_screen() == currentScreen) { love_image *img = luaobj_checkudata(L, 1, LUAOBJ_TYPE_IMAGE); love_quad *quad = NULL; int x, y; float rad; if (!lua_isnone(L, 2) && lua_type(L, 2) != LUA_TNUMBER) { quad = luaobj_checkudata(L, 2, LUAOBJ_TYPE_QUAD); x = luaL_optnumber(L, 3, 0); y = luaL_optnumber(L, 4, 0); rad = luaL_optnumber(L, 5, 0); } else { x = luaL_optnumber(L, 2, 0); y = luaL_optnumber(L, 3, 0); rad = luaL_optnumber(L, 4, 0); } translateCoords(&x, &y); if (rad == 0) { if (!quad) { if (img) { sf2d_draw_texture_blend(img->texture, x, y, getCurrentColor()); } } else { sf2d_draw_texture_part_blend(img->texture, x, y, quad->x, quad->y, quad->width, quad->height, getCurrentColor()); } } else { sf2d_draw_texture_rotate_blend(img->texture, x + img->texture->width / 2, y + img->texture->height / 2, rad, getCurrentColor()); } } return 0; }