本文整理汇总了C++中RGBA8函数的典型用法代码示例。如果您正苦于以下问题:C++ RGBA8函数的具体用法?C++ RGBA8怎么用?C++ RGBA8使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RGBA8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
sf2d_init();
sf2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
consoleInit(GFX_BOTTOM, NULL);
printf("sftd sample\n");
// Font loading
sftd_init();
sftd_font *font = sftd_load_font_mem(airstrike_ttf, airstrike_ttf_size);
while (aptMainLoop()) {
hidScanInput();
if (hidKeysDown() & KEY_START) break;
sf2d_start_frame(GFX_TOP, GFX_LEFT);
sftd_draw_text(font, 10, 10, RGBA8(255, 0, 0, 255), 20, "Font drawing on the top screen!");
sftd_draw_textf(font, 10, 40, RGBA8(0, 255, 0, 255), 20, "FPS %f", sf2d_get_fps());
sf2d_end_frame();
sf2d_swapbuffers();
}
sftd_free_font(font);
sftd_fini();
sf2d_fini();
return 0;
}
示例2: player_draw
//Draws the player sprite.
void player_draw(Player self) {
if (self->player_texture == NULL) {
if (self->frame_invincibility > 0) {
sf2d_draw_fill_circle(self->x, self->y, self->radius, RGBA8(0xFF, 0x00, 0x08, 0xFF));
} else {
sf2d_draw_fill_circle(self->x, self->y, self->radius, RGBA8(0x5C, 0xFF, 0x71, 0xBB));
}
} else {
switch (self->player_direction) { //ZZZ Set this up for textures.
case NORTH:
case EAST:
case SOUTH:
case WEST:
default:
sf2d_draw_texture(self->player_texture, self->x, self->y);
}
}
}
示例3: LaichLyt_StartText
int LaichLyt_StartText(BRLYT* brlyt, char* name)
{
LYTEntry entry;
entry.type = LYT_TYPE_TEXT;
entry.done = 0;
entry.tag.text.pane.alpha = 255;
entry.tag.text.pane.alpha2 = 0;
memset(entry.tag.text.pane.name, 0, 24);
strncpy(entry.tag.text.pane.name, name, 24);
entry.tag.text.pane.x = 0;
entry.tag.text.pane.y = 0;
entry.tag.text.pane.z = 0;
entry.tag.text.pane.rot_x = 0;
entry.tag.text.pane.rot_x = 0;
entry.tag.text.pane.angle = 0;
entry.tag.text.pane.xmag = 0;
entry.tag.text.pane.ymag = 0;
entry.tag.text.pane.width = 0;
entry.tag.text.pane.height = 0;
entry.tag.text.pane.done = 0;
entry.tag.text.font = LYT_FONT_DEFAULT;
entry.tag.text.stringlen = 0;
entry.tag.text.string = NULL;
entry.tag.text.color_fg = RGBA8(0, 0, 0, 255);
entry.tag.text.color_bg = RGBA8(0, 0, 0, 0);
entry.tag.text.done = 0;
return AddEntryToBRLYT(brlyt, entry);
}
示例4: LaichLyt_StartPic
int LaichLyt_StartPic(BRLYT* brlyt, char* name)
{
LYTEntry entry;
entry.type = LYT_TYPE_PIC;
entry.done = 0;
entry.tag.pic.pane.alpha = 255;
entry.tag.pic.pane.alpha2 = 0;
memset(entry.tag.pic.pane.name, 0, 24);
strncpy(entry.tag.pic.pane.name, name, 24);
entry.tag.pic.pane.x = 0;
entry.tag.pic.pane.y = 0;
entry.tag.pic.pane.z = 0;
entry.tag.pic.pane.rot_x = 0;
entry.tag.pic.pane.rot_x = 0;
entry.tag.pic.pane.angle = 0;
entry.tag.pic.pane.xmag = 0;
entry.tag.pic.pane.ymag = 0;
entry.tag.pic.pane.width = 0;
entry.tag.pic.pane.height = 0;
entry.tag.pic.pane.done = 0;
entry.tag.pic.colors[0] = RGBA8(0, 0, 0, 255);
entry.tag.pic.colors[1] = RGBA8(0, 0, 0, 255);
entry.tag.pic.colors[2] = RGBA8(0, 0, 0, 255);
entry.tag.pic.colors[3] = RGBA8(0, 0, 0, 255);
entry.tag.pic.texcoordcnt = 0;
entry.tag.pic.texcoords = NULL;
entry.tag.pic.done = 0;
return AddEntryToBRLYT(brlyt, entry);
}
示例5: ShowMenu
/*
Shows menu items
*/
void ShowMenu(MENU *menu)
{
int i;
MENUITEM *mi = menu->m;
int boxColor;
boxColor = RGBA8(0x44, 0x44, 0xaa, 0xff);
// show menu lines
for(i = 0; i < menu->itemNum; i++, mi++) {
int fg_color;
sf2d_draw_rectangle(10, 35 + i*26, 125, 19, (menu->itemCur == i)?boxColor:COLOR_INACTIVE_ITEM_BG);
if(menu->itemCur == i) fg_color = COLOR_ACTIVE_ITEM; else fg_color = COLOR_INACTIVE_ITEM;
ShowMenuItem(12, 38 + i*26, mi, fg_color,(menu == &gui_MainMenu)?0:1);
}
// show preview screen
// ShowPreview(menu);
// print info string
sftd_draw_text(font, 7, 7, RGBA8(0x66, 0x66, 0x66, 0xff), 10, "Vex3ds");
sftd_draw_text(font, 5, 5, RGBA8(0xff, 0xff, 0xff, 0xff), 10, "Vex3ds");
/* if (menu == &gui_MainMenu) {
guitextwidth = sftd_get_text_width(font, 10, Handy_3DS_String_list[HANDY_STR_Back_to_Game]);
sftd_draw_text(font, (320 - guitextwidth) / 2, 225, COLOR_HELP_TEXT, 10, Handy_3DS_String_list[HANDY_STR_Back_to_Game]);
} else {
guitextwidth = sftd_get_text_width(font, 10, Handy_3DS_String_list[HANDY_STR_Back_to_Previous]);
sftd_draw_text(font, (320 - guitextwidth) / 2, 225, COLOR_HELP_TEXT, 10, Handy_3DS_String_list[HANDY_STR_Back_to_Previous]);
}
*/
}
示例6: sf2d_draw_rectangle_gradient
void Slider::Draw(int x, int y, int w, int h)
{
width = w;
int fillWidth = (int)Interpolate(value, min, max, 0.0, (double)(w - 2));
sf2d_draw_rectangle_gradient(x+1, y+1, w-2, h-2, RGBA8(0xF0, 0xF0, 0xF0, 0xFF), RGBA8(0xFF, 0xFF, 0xFF, 0xFF), SF2D_TOP_TO_BOTTOM);
sf2d_draw_rectangle(x+1, y+1, fillWidth, h-2, RGBA8(0x00, 0xCC, 0xFF, 0xFF));
mainFont.drawStr(ssprintf("%.5f", value), x + 8, y + h/2 - mainFont.height()/2, RGBA8(0x00, 0x00, 0x00, 0xFF));
sf2d_draw_rectangle_gradient(x+1, y+1, w-2, h/2-2, RGBA8(0xFF, 0xFF, 0xFF, 0x20), RGBA8(0xFF, 0xFF, 0xFF, 0x60), SF2D_TOP_TO_BOTTOM);
}
示例7: test_draw
//ZZ Quick function to check if drawing is working here.
void test_draw() {
sf2d_start_frame(GFX_TOP, GFX_LEFT); //Left for Standard Vision
sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0xFF, 0x89, 0xFF)); //Background
sf2d_end_frame();
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0xFF, 0x89, 0xFF)); //Background
sf2d_end_frame();
sf2d_swapbuffers();
}
示例8: sf2d_draw_rectangle
void Slider::draw()
{
if (is_hidden()) return;
sf2d_draw_rectangle(x, y, width, height, RGBA8(0x40, 0x40, 0x40, 255));
int percent = value * width / (max - min);
sf2d_draw_rectangle(x + percent - 2, y - 6 + height / 2, 5, 12, RGBA8(0x60, 0x60, 0x60, 255));
sf2d_draw_rectangle(x + percent - 2 + 1, y - 6 + height / 2 + 1, 3, 10, !is_active() ? color.start() : color.color());
if (style & LABELS)
font->draw(value, x + width, y);
}
示例9: lockScreen
int lockScreen()
{
lockscreenBg = sf2d_create_texture_mem_RGBA8(lockscreen_img.pixel_data, lockscreen_img.width, lockscreen_img.height, TEXFMT_RGBA8, SF2D_PLACE_RAM);
time_t unixTime = time(NULL);
struct tm* timeStruct = gmtime((const time_t *)&unixTime);
int hours = timeStruct->tm_hour;
int minutes = timeStruct->tm_min;
int day = timeStruct->tm_mday;
sf2d_set_clear_color(RGBA8(0, 0, 0, 0));
while (1)
{
hidScanInput();
u32 kDown = hidKeysDown();
sf2d_start_frame(GFX_TOP, GFX_LEFT);
sf2d_draw_texture(background, 0, 0);
sf2d_draw_texture(lockscreenBg, 0, 0);
sftd_draw_textf(roboto, 142, 20, RGBA8(255, 255, 255, 255), 34, "0%2d : %02d", hours, minutes);
sftd_draw_textf(roboto, 140, 80, RGBA8(255, 255, 255, 255), 10, "Monday");
sftd_draw_textf(roboto, 200, 80, RGBA8(255, 255, 255, 255), 10, "%d", day);
sftd_draw_textf(roboto, 220, 80, RGBA8(255, 255, 255, 255), 10, "October");
digitalTime(350, 2);
batteryStatus(316, 2);
cursorController();
sf2d_end_frame();
if ((touch.px >= 160 && touch.px <= 235 && touch.py >= 210 && touch.py <= 240) && (kDown & KEY_A))
{
sf2d_free_texture(lockscreenBg);
return 1;
}
sf2d_swapbuffers();
}
sf2d_free_texture(lockscreenBg);
return 0;
}
示例10: setupGame
void setupGame(bool loadUpWorld) {
currentLevel = 1;
// Reset entity manager.
memset(&eManager, 0, sizeof(eManager));
sf2d_set_clear_color(RGBA8(0x82, 0x6D, 0x6C, 0xFF));
if (!loadUpWorld) {
initNewMap();
initPlayer();
airWizardHealthDisplay = 2000;
int i;
for (i = 0; i < 5; ++i) {
trySpawn(500, i);
}
addEntityToList(newAirWizardEntity(630, 820, 0), &eManager);
player.p.hasWonSaved = false;
} else {
initPlayer();
loadWorld(currentFileName, &eManager, &player, (u8*) map, (u8*) data);
}
initMiniMap(loadUpWorld);
shouldRenderMap = false;
mScrollX = 0;
mScrollY = 0;
zoomLevel = 2;
sprintf(mapText,"x%d",zoomLevel);
initGame = 0;
}
示例11: video_DrawFrame
void video_DrawFrame(){
uint16_t *src = (uint16_t *)GPU->GetDisplayInfo().masterNativeBuffer;
vita2d_start_drawing();
vita2d_clear_screen();
memcpy(data, src, sizeof(uint16_t) * 256 * 192 * 2);
switch(video_layout){
case LAYOUT_PORTRAIT:
vita2d_draw_texture_scale_rotate(fb, PORTRAIT_X, PORTRAIT_Y, 2, 2, PI/2);
break;
case LAYOUT_SBS:
vita2d_draw_texture_part_scale(fb, 0, SBS_Y, 0, 0, 256, 192, SBS_SCALE, SBS_SCALE);
vita2d_draw_texture_part_scale(fb, SBS_X, SBS_Y, 0, 192, 256, 192, SBS_SCALE, SBS_SCALE);
break;
case LAYOUT_LANDSCAPE:
default:
vita2d_draw_texture_scale(fb, LANDSCAPE_X, LANDSCAPE_Y, LANDSCAPE_SCALE, LANDSCAPE_SCALE);
break;
}
vita2d_draw_rectangle(930,514,30,30,RGBA8(30,30,30,255));
vita2d_end_drawing();
vita2d_swap_buffers();
}
示例12: lua_init
static int lua_init(lua_State *L) {
int argc = lua_gettop(L);
if (argc != 0) return luaL_error(L, "wrong number of arguments");
sf2d_init();
cur_screen = 2;
sf2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF));
return 0;
}
示例13: game_controller_draw_bottom
void game_controller_draw_bottom(GameController self) {
sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0x47, 0x53, 0xFF)); //Background
if (self->flag_test) sf2d_draw_rectangle(30, 30, 30, 30, RGBA8(0xAA, 0xDD, 0x89, 0xFF));
//Draw lives.
int i;
for (i=0; i < self->player->lives; i++) {
sf2d_draw_rectangle(15+(i*16), 0, 15, 15, RGBA8(0x47, 0x5F, 0xFF, 0xFF));
}
//sftd_font *font = sftd_load_font_mem(FreeSans_ttf, FreeSans_ttf_size);
//sftd_draw_text(0, 10, 10, RGBA8(0, 255, 0, 255), 20, "Font drawing on the bot. screen!");
sf2d_end_frame();
}
示例14: batteryStatus
int batteryStatus(int x, int y)
{
int batt = 100; //This is temporary until I find how to get battery status. I know 3DS doesn't use percentages, but only values from 1-5.
sf2d_draw_texture(_100, 300, 2);
sftd_draw_textf(roboto, x, y, RGBA8(255, 255, 255, 255), 12, "%d%%", batt);
return 0;
}
示例15: sizeof
static void *vita2d_gfx_init(const video_info_t *video,
const input_driver_t **input, void **input_data)
{
vita_video_t *vita = (vita_video_t *)calloc(1, sizeof(vita_video_t));
if (!vita)
return NULL;
*input = NULL;
*input_data = NULL;
RARCH_LOG("vita2d_gfx_init: w: %i h: %i\n", video->width, video->height);
RARCH_LOG("RARCH_SCALE_BASE: %i input_scale: %i = %i\n",
RARCH_SCALE_BASE, video->input_scale, RARCH_SCALE_BASE * video->input_scale);
vita2d_init();
vita2d_set_clear_color(RGBA8(0x00, 0x00, 0x00, 0xFF));
vita2d_set_vblank_wait(video->vsync);
if (vita->rgb32)
{
RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB\n");
vita->format = SCE_GXM_TEXTURE_FORMAT_X8U8U8U8_1RGB;
}
else
{
RARCH_LOG("Format: SCE_GXM_TEXTURE_FORMAT_R5G6B5\n");
vita->format = SCE_GXM_TEXTURE_FORMAT_R5G6B5;
}
vita->fullscreen = video->fullscreen;
vita->texture = NULL;
vita->menu.texture = NULL;
vita->menu.active = 0;
vita->menu.width = 0;
vita->menu.height = 0;
vita->vsync = video->vsync;
vita->rgb32 = video->rgb32;
vita->tex_filter = video->smooth? SCE_GXM_TEXTURE_FILTER_LINEAR : SCE_GXM_TEXTURE_FILTER_POINT;
if (input && input_data)
{
void *pspinput = input_psp.init();
*input = pspinput ? &input_psp : NULL;
*input_data = pspinput;
}
vita->keep_aspect = true;
vita->should_resize = true;
#ifdef HAVE_OVERLAY
vita->overlay_enable = false;
#endif
return vita;
}