예제 #1
0
파일: main.c 프로젝트: Shadowtrance/sftdlib
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
0
//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
0
파일: brlyt.c 프로젝트: Ente/benzin
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
0
파일: brlyt.c 프로젝트: Ente/benzin
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
0
파일: gui.c 프로젝트: nop90/Vex3DS
/*
	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
0
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
0
//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();
}
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
0
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
0
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
0
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
0
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
0
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
0
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
0
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;
}
//Draw these lovely circles on the screen.
void circle_controller_draw(CircleController self) {

    sf2d_start_frame(GFX_TOP, GFX_LEFT); //Left for Standard Vision
    sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0xFF, 0x89, 0xFF)); //Background
    if (DO_DRAW) circle_controller_draw_all_circles(self);

    sf2d_end_frame();
    sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);

    sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0xEE, 0x89, 0xFF)); //Background
    sf2d_draw_fill_circle(self->circle_timer->x, self->circle_timer->y, 4, RGBA8(0xFF, 0xA5, 0xC4, 0xFF));
    float fps_percentage = sf2d_get_fps() / 60;
    sf2d_draw_rectangle(0, 200, fps_percentage * 320, 10, RGBA8(0x00, 0x00, 0x00, 0xFF));


    sf2d_end_frame();

    sf2d_swapbuffers();
}
예제 #17
0
void Editableoverlay::draw() {
    sf2d_draw_texture(texture, posx, posy);

    if( selected > 0 )
        sf2d_draw_texture(this->arrow, posx+texture->width-10-arrow->width, posy+10+arrow->height);
    
    if( selected < elements.size() - 1)
        sf2d_draw_texture_rotate(this->arrow, posx+texture->width-10-arrow->width+3, posy+texture->height-10-arrow->height, M_PI);
    
    int start = selected / todraw;
    int j = 0;
    for(unsigned int i = (start*todraw); i < elements.size() && j < todraw ; i++) {
        std::string towrite = elements[i];
        if( posx+5+sftd_get_text_width(font, 6, towrite.c_str()) >= this->getRightBorder() ) towrite = towrite.substr(0, 12) + "...";
        if( selected == i ) sftd_draw_text(font, posx+5, posy+10+(10*j), RGBA8(255, 255, 255, 255), 6, towrite.c_str());
        else sftd_draw_text(font, posx+5, posy+10+(10*j), RGBA8(0, 0, 0, 255), 6, towrite.c_str());
        j++;
    }    
}
예제 #18
0
void render_pixels1(uint32_t *pixels, uint32_t c) {
	int x, y;
	/* fill in a square of 5 x 5 at s_x, s_y */
	for (y = 0; y < textureHeight; y++) {
		for (x = 0; x < textureWidth; x++) {
			int idx = x + y * textureWidth;
			pixels[idx++] = RGBA8(255, 255, 0);
		}
	}
}
예제 #19
0
파일: color.c 프로젝트: VideahGams/ctruLua
static int color_RGBA8(lua_State *L) {
	int r = luaL_checkinteger(L, 1);
	int g = luaL_checkinteger(L, 2);
	int b = luaL_checkinteger(L, 3);
	int a = luaL_optinteger(L, 4, 255);

	lua_pushinteger(L, RGBA8(r, g, b, a));

	return 1;
}
예제 #20
0
void video_Init(){
	vita2d_init();
	vita2d_set_vblank_wait(0);
	vita2d_set_clear_color(RGBA8(0, 0, 0, 0xFF));

	fb = vita2d_create_empty_texture_format(256, 192*2,
		SCE_GXM_TEXTURE_FORMAT_U1U5U5U5_ABGR);

	data = vita2d_texture_get_datap(fb);
}
예제 #21
0
//ZZZ TODO Seperate this all out
void game_controller_draw_top(GameController self) {
	//Left Eye
	sf2d_start_frame(GFX_TOP, GFX_LEFT); //Left for Standard Vision
		sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0xFF, 0xFF, 0x89, 0xFF)); //Background
		
		if (self->enemy->health > 0) enemy_draw(self->enemy); /*ZZZ TESTING ZZZ */
		
		//bullet_draw(self->bullet);
		//bullet_draw(self->bullet_storage->bullet_array[0]);
		//bullet_draw(self->bullet_storage->bullet_array[self->bullet_storage->bullet_limit-1]);
		bullet_storage_draw_all(self->bullet_storage);
		
		player_draw(self->player); //Draw player ontop of all game objects.
		
		//Pause interface
		if (self->is_paused) sf2d_draw_rectangle(0, 0, 400, 240, RGBA8(0x7A, 0x7A, 0x7A, 0xCC));
	sf2d_end_frame();

	
}
예제 #22
0
static int graphicsSetBackgroundColor(lua_State *L) { // love.graphics.setBackgroundColor()

	int r = luaL_checkinteger(L, 1);
	int g = luaL_checkinteger(L, 2);
	int b = luaL_checkinteger(L, 3);

	sf2d_set_clear_color(RGBA8(r, g, b, 0xFF));

	return 0;

}
예제 #23
0
int main() {
	SceCtrlData pad;
	vita2d_pgf *pgf;
	vita2d_texture *image;
	float rad = 0.0f;
  
	vita2d_init();
	vita2d_set_clear_color(RGBA8(0x40, 0x40, 0x40, 0xFF));
  
	pgf = vita2d_load_default_pgf();
  
	image = vita2d_load_PNG_buffer(&_binary_image_png_start);
  
	memset(&pad, 0, sizeof(pad));
  
	while (1) {
		sceCtrlPeekBufferPositive(0, &pad, 1);
	
		if (pad.buttons & SCE_CTRL_START)
			break;
	
		vita2d_start_drawing();
		vita2d_clear_screen();
	
		vita2d_draw_texture_rotate(image, 940/2, 544/2, rad);
	
		vita2d_pgf_draw_text(pgf, 50, 50, RGBA8(255,255,255,255), 1.0f, "ミクのおっぱい柔かぁい。柔軟剤使ったのか?");
	
		vita2d_end_drawing();
		vita2d_swap_buffers();
	
		rad += 0.1f;
	}
  
	vita2d_fini();
	vita2d_free_texture(image);
	vita2d_free_pgf(pgf);
  
	sceKernelExitProcess(0);
	return 0;
}
예제 #24
0
void start()
{
	playerMove(300, 60);
	playerFloor(0);
	playerDir(1);
	cameraCenterPlayer();
	
	playerSetColor(RGBA8(128, 0, 128, 255));
	
	// create stuff
	main();
}
//Goes through and draws all the circles.
void circle_controller_draw_all_circles(CircleController self) {
    int i;
    for (i=0; i < MAX_SIZE; i++) {
        Circle circle = self->circle_array[i];
        if (DO_SQUARE) {
            sf2d_draw_rectangle(circle->x - RADIUS, circle->y - RADIUS, RADIUS, RADIUS, RGBA8(0xFF, 0xA5, 0xC4, 0xFF));
        } else {
            sf2d_draw_fill_circle(circle->x, circle->y, circle->radius, RGBA8(0xFF, 0xA5, 0xC4, 0xFF));

        }
    }
}
예제 #26
0
// --------------------------------------------------
void BoxViewer::drawBox(box_s* box, int16_t x, int16_t y, bool cursor)
// --------------------------------------------------
{
	// Draw the box background
	sf2d_draw_texture_part(PHBanku::texture->boxBackgrounds, x, y, ((box->background % 16) % 4) * BACKGROUND_WIDTH, ((box->background % 16) / 4) * BACKGROUND_HEIGHT, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);

	if (cursor)
	{
		// Draw CursorType buttons (Red|Blue|Green)
		drawCursorButton(x, y);
	}

	// Draw the box header
	sf2d_draw_texture_part(PHBanku::texture->boxBackgrounds, x, y + 15, ((box->background % 16) % 4) * BOX_HEADER_WIDTH, 840 + ((box->background % 16) / 4) * BOX_HEADER_HEIGHT, BOX_HEADER_WIDTH, BOX_HEADER_HEIGHT);

	// Draw the box arrows
	sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 4, y + 18, 96, 32, 16, 24);
	sf2d_draw_texture_part(PHBanku::texture->boxTiles, x + 200, y + 18, 112, 32, 16, 24);

	// Draw the box title
	wchar_t boxTitle[0x1a];
	// TODO: Remove that if statement when complete box->title.
	// TODO: Wait for sftd_get_wtext_wdith.
	if (box->title[0] != '\0') swprintf(boxTitle, 0x1a, (wchar_t*) box->title);
	else swprintf(boxTitle, 0x1a, L"Box %i", box->number+1);
	int boxTitleWidth = sftd_get_wtext_width(font, 12, boxTitle);
	sftd_draw_wtext(font, x + (BACKGROUND_WIDTH - boxTitleWidth) / 2, y + 21, RGBA8(0x22,0x22,0x22,0xFF), 12, boxTitle);

	// TODO: v DRY v

	// If there is a Pokémon currently selected
	if (sPkm)
	{
		// Draw Pokémon icons
		for (u8 i = 0; i < BOX_PKM_COUNT; i++)
		{
			// If the Pokémon isn't the selected Pokémon
			if (sPkm != &(box->slot[i]))
			{
				drawPokemon(&box->slot[i], x + (i % BOX_COL_PKM_COUNT) * PKM_WIDTH, y + PKM_BOX_MARGIN_TOP + (i / BOX_COL_PKM_COUNT) * PKM_HEIGHT, false);
			}
		}
	}
	// If there is no Pokémon currently selected
	else
	{
		// Draw Pokémon icons
		for (u8 i = 0; i < BOX_PKM_COUNT; i++)
		{
			drawPokemon(&box->slot[i], x + (i % BOX_COL_PKM_COUNT) * PKM_WIDTH, y + PKM_BOX_MARGIN_TOP + (i / BOX_COL_PKM_COUNT) * PKM_HEIGHT, false);
		}
	}
}
예제 #27
0
int32_t Lux_NATIVE_DrawChar( int32_t cchar, int32_t x, int32_t y, ObjectEffect effects, bool allow_custom )
{
	sf2d_texture * 	texture = NULL;
	LuxColour c = effects.primary_colour;
	LuxRect area;
	NativeTexture * ntexture = NULL;
	LuxSprite * sprite_data = NULL;
	int32_t offset = 7;

	int8_t axis;
	int8_t button;
	int8_t pointer;

	area.x = x;
	area.y = y;

	UnicodeToInput( cchar, &axis, &button, &pointer );

	if ( axis >= 0 || button >= 0 || pointer >= 0 )
	{
		c.r = c.g = c.b = 255;
		sprite_data = lux::display->GetInputSprite( 0, axis, button, pointer );
	}


	if ( sprite_data )
	{
		ntexture = (NativeTexture*)sprite_data->GetData();

		texture = ntexture->texture;

		area.w = ntexture->tw;
		area.h = ntexture->th;

		offset = ntexture->w;

	}
	else
	{
		texture = dsgraphics_bitfont->GetTexture(cchar);

		offset = 8;
		area.w = 8;
		area.h = 8;
	}


	if ( texture )
	{
		sf2d_draw_texture_blend(texture, area.x, area.y, RGBA8(effects.primary_colour.r, effects.primary_colour.g, effects.primary_colour.b, effects.primary_colour.a) 	);
	}
	return offset;
}
예제 #28
0
static void menu_display_ctr_clear_color(menu_display_ctx_clearcolor_t *clearcolor, video_frame_info_t *video_info)
{
   if (!clearcolor)
      return;
#if 0
   ctr_set_clear_color(RGBA8((int)(clearcolor->r*255.f),
            (int)(clearcolor->g*255.f),
            (int)(clearcolor->b*255.f),
            (int)(clearcolor->a*255.f)));
   ctr_clear_screen();
#endif
}
예제 #29
0
int main(int argc, char **argv)
{
	// Start sf2dlib
	sf2d_init();
	sf2d_set_clear_color(RGBA8(0xF5, 0xF2, 0xEF, 0xFF));

	// Initialize console on top screen
	// consoleInit(GFX_TOP, NULL);

	printf("Sizeof report:\n");
	printf(" > elementNode: %i\n", sizeof(elementNode_s));
	printf(" > elementList: %i\n", sizeof(elementList_s));

	printf(" %2i | %2i |", strcmp("ab", "aa"), strcmp("ab", "ac"));
	printf(" %2i | %2i \n", strcmp("a ", "aA"), strcmp("a ", "aa"));

	AlchemyScene scene;
	scene.initialize();

	// consoleClear();

	keystate_s ks;
	while(aptMainLoop())
	{
		hidKeys(&ks);

		// Draw the top screen
		sf2d_start_frame(GFX_TOP, GFX_LEFT);
			scene.drawTopScreen();
		sf2d_end_frame();
		
		// Draw the bottom screen
		sf2d_start_frame(GFX_BOTTOM, GFX_LEFT);
			scene.drawBottomScreen();
		sf2d_end_frame();

		// Swap the buffers
		sf2d_swapbuffers();

		scene.updateInput(ks);

		// Exit the loop
		if (ks.down & KEY_START) break;
	}
	
	scene.destroy();

	// Stop sf2dlib
	sf2d_fini();

	return 0;
}
예제 #30
0
int dayNightWidget()
{
	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;
	//int month = timeStruct->tm_mon;
	
	if (hours < 6)
		sf2d_draw_texture(dayWidget, 172, 60);
	else
		sf2d_draw_texture(nightWidget, 167, 60);
		
	sftd_draw_textf(roboto, 142, 20, RGBA8(255, 255, 255, 255), 34, "0%2d : %02d", hours, minutes);
	sftd_draw_textf(roboto, 130, 80, RGBA8(255, 255, 255, 255), 10, "Monday");
	sftd_draw_textf(roboto, 230, 80, RGBA8(255, 255, 255, 255), 10, "%d", day);
	sftd_draw_textf(roboto, 245, 80, RGBA8(255, 255, 255, 255), 10, "October");
	
	return 0;
}