Exemple #1
0
__myevic__ void ShowContrast()
{
	int pc, nd, x;

	DrawString( String_Contrast, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	pc = ( ( 100 * dfContrast ) / 255 );
	nd = ( pc < 100 ? pc < 10 ? 1 : 2 : 3 );
	x = ( 64 - ( 6 * nd + 9 )) / 2;
	DrawValue( x, 20, pc, 0, 0x0B, 0 );
	DrawImage( x + 6 * nd, 20, 0xC2 );

	DrawFillRect( 0, 32, 63, 44, 1 );
	DrawFillRect( 1, 33, 62, 43, 0 );
	if ( dfContrast )
	{
		DrawFillRect( 2, 34, 2 + ( ( 59 * dfContrast ) / 255 ), 42, 1 );
	}

	DrawStringCentered( String_Fireto, 57 );
	DrawStringCentered( ( gFlags.edit_capture_evt ) ? String_Exit : String_Edit, 67 );

	if ( !(dfStatus.nologo) ) DrawLOGO( 0, 88 );
}
Exemple #2
0
//=========================================================================
//----- (00006764) --------------------------------------------------------
__myevic__ void ShowBatCharging()
{
	DrawImage( 8, 115, 0xC4 );

	if ( BatteryTenth != 10 )
	{
		if ( BatAnimLevel )
		{
			DrawFillRect( 10, 118, (4 * BatAnimLevel + 9), 124, 1 );
		}
	}
	else if ( gFlags.draw_battery_charging )
	{
		DrawFillRect( 10, 118, 49, 124, 1 );
	}
}
Exemple #3
0
__myevic__ void DrawMenu()
{
	unsigned int firstitem;

	if ( CurrentMenu == 0 )
	{
		CurrentMenu = &MainMenu;
		CurrentMenuItem = 0;
	}

	if ( !CurrentMenu->nitems )
	{
		MainView();
		return;
	}

	if ( CurrentMenuItem >= CurrentMenu->nitems ) CurrentMenuItem = 0;

	DrawString( CurrentMenu->caption, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	if (( CurrentMenu->nitems > 7 ) && ( CurrentMenuItem > 3 ))
	{
		if ( CurrentMenuItem > CurrentMenu->nitems-4 )
		{
			firstitem = CurrentMenu->nitems - 7;
		}
		else
		{
			firstitem = CurrentMenuItem - 3;
		}
	}
	else
	{
		firstitem = 0;
	}

	for ( int i = 0; i < 7; ++i )
	{
		if ( firstitem + i >= CurrentMenu->nitems ) break;

		if ( CurrentMenu->mitems[firstitem+i].caption )
		{
			if ( CurrentMenuItem == firstitem + i )
			{
				DrawFillRect( 0, 18+14*i, 63, 30+14*i, 1 );
				DrawStringInv( CurrentMenu->mitems[firstitem+i].caption, 4, 20+14*i );
			}
			else
			{
				DrawString( CurrentMenu->mitems[firstitem+i].caption, 4, 20+14*i );
			}
		}

		if ( CurrentMenu->on_drawitem )
		{
			CurrentMenu->on_drawitem( firstitem + i, 18+14*i, CurrentMenuItem == firstitem + i );
		}
	}
}
Exemple #4
0
//=========================================================================
//----- (000072EC) --------------------------------------------------------
__myevic__ void ShowTCRSet()
{
	int i;
	int line;

	DrawString( String_TCRSet, 7, 6 );
	DrawHLine( 0, 22, 63, 1 );

	if ( gFlags.edit_tcr_value )
	{
		for ( i = 0 ; i < 3 ; ++i )
		{
			if ( EditTCRIndex == i )
			{
				DrawFillRect( 28, 25 * i + 30, 62, 25 * i + 52, 1 );
				DrawValueInv(30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4);
			}
			else
			{
				DrawValue( 30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4 );
			}
			line = 25 * i + 33;
			DrawImage(  0, line, 0xED );
			DrawImage( 15, line, 0xEE + i );
		}
	}
	else
	{
		for ( i = 0 ; i < 3 ; ++i )
		{
			line = 25 * i + 33;

			if ( EditTCRIndex == i )
			{
				DrawImageInv(  0, line, 0xED );
				DrawImageInv( 15, line, 0xEE + i );
				DrawFillRect( 25, line, 30, line + 16, 0);
			}
			else
			{
				DrawImage(  0, line, 0xED );
				DrawImage( 15, line, 0xEE + i );
			}
			DrawValue( 30, 25 * i + 36, dfTCRM[i], 0, 0x1F, 4 );
		}
	}
}
Exemple #5
0
void nGraphics::DrawShadowFillRect(const nRect& rect,const nColor& color)
{
	// Don't draw if fully transparent
	if(color.a <= 0.0f)
		return;

	// Draw the rect
	static nRect rect2;
	static nColor color2;

	rect2 = rect;
	rect2.Offset(1,1);

	color2.r = color2.g = color2.b = 0.0f;
	color2.a = color.a * 0.1f;

	DrawFillRect(rect2,color2);
	DrawFillRect(rect,color);
}
Exemple #6
0
__myevic__ void CoilsIDraw( int it, int line, int sel )
{
	if ( it > 3 ) return;
	DrawFillRect( 32, line, 63, line+12, 0 );
	int rez = 0;
	short img = 0xC0;
	switch ( it )
	{
		case 0 : rez = dfRezNI; if (dfRezLockedNI) img = 0xC3; break;
		case 1 : rez = dfRezTI; if (dfRezLockedTI) img = 0xC3; break;
		case 2 : rez = dfRezSS; if (dfRezLockedSS) img = 0xC3; break;
		case 3 : rez = dfRezTCR; if (dfRezLockedTCR) img = 0xC3; break;
	}
	DrawValue( 34, line+2, rez, 2, 0x0B, 3 );
	DrawImage( 56, line+2, img );
}
Exemple #7
0
__myevic__ void ScreenSaveMenuIDraw( int it, int line, int sel )
{
	if ( ScrSaveTimes[it] )
	{
		if ( sel )
		{
			DrawFillRect( 0, line, 63, line+12, 1 );
			DrawValueInv( 4, line+2, ScrSaveTimes[it], 0, 0x0B, 0 );
			DrawStringInv( String_Min, 32, line+2 );
		}
		else
		{
			DrawValue( 4, line+2, ScrSaveTimes[it], 0, 0x0B, 0 );
			DrawString( String_Min, 32, line+2 );
		}
	}
}
Exemple #8
0
//=========================================================================
//----- (000071A4) --------------------------------------------------------
__myevic__ void ShowLOGOMenu()
{
	int l;

	DrawString( String_LOGO, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	l = dfStatus.nologo;

	DrawFillRect( 0, 14 * l + 18, 63, 14 * l + 30, 1 );

	if ( l )
	{
		DrawString( String_On, 4, 20 );
		DrawStringInv( String_Off, 4, 34 );
	}
	else
	{
		DrawStringInv( String_On, 4, 20 );
		DrawString( String_Off, 4, 34 );
	}
}
Exemple #9
0
//=========================================================================
//----- (000067C8) --------------------------------------------------------
__myevic__ void ShowBattery()
{
	if ( gFlags.battery_10pc && !(gFlags.battery_charging) )
	{
		if ( gFlags.draw_battery )
		{
			DrawImage( 8, 115, 0xC4 );
		}
	}
	else if ( gFlags.draw_battery_charging && gFlags.battery_charging )
	{
		DrawImage( 8, 115, 0xC5 );
	}
	else
	{
		DrawImage( 8, 115, 0xC4 );
		if ( BatteryTenth )
		{
			DrawFillRect( 10, 118, (4 * BatteryTenth + 9), 124, 1 );
		}
	}
}
Exemple #10
0
//=========================================================================
//----- (00007234) --------------------------------------------------------
__myevic__ void ShowGameMenu()
{
	int line;
	const uint16_t *str;

	DrawString( String_Game, 4, 6 );
	DrawHLine( 0, 16, 63, 1 );

	DrawString( String_Easy, 4, 20 );
	DrawString( String_Normal, 4, 34 );
	DrawString( String_Hard, 4, 48 );
	DrawString( String_Exit, 4, 62 );

	DrawFillRect( 0, ( 18 + 14 * dfFBSpeed ), 63, ( 30 + 14 * dfFBSpeed ), 1);

	line = 20 + 14 * dfFBSpeed;

	if ( dfFBSpeed == 0 )
	{
		str = String_Easy;
	}
	else if ( dfFBSpeed == 1 )
	{
		str = String_Normal;
	}
	else if ( dfFBSpeed == 2 )
	{
		str = String_Hard;
	}
	else if ( dfFBSpeed == 3 )
	{
		str = String_Exit;
	}
	else return;

	DrawStringInv( str, 4, line );
}
Exemple #11
0
void nGraphics::DrawPrintLine(ID3DXFont* font,const nRect& rect,const char* text,float delta,unsigned long flags,const nColor& color)
{
	nAssert(font);

	// Don't draw if fully transparent
	if(color.a <= 0.0f)
		return;

	nString textString(text);
	nColor color2(color);
	
	if(delta < 0.0f)
		color2.a = 0.0f;
	else if(delta < 1.0f)
		color2.a *= cubicf(0.0f,1.0f,delta);
	else if(delta > textString.size())
		color2.a = 0.0f;
	else if(delta > textString.size() - 1.0f)
		color2.a *= cubicf(0.0f,1.0f,textString.size() - min(delta,textString.size()));

	unsigned long numChars = min(max(0.0f,delta),textString.size());
	numChars = textString.size() * cubicf(0.0f,1.0f,(float)numChars/(float)textString.size());	// Comment-out for no cubic interpolation
	textString.erase(textString.end() - textString.size() + numChars,textString.end());

	nSize size;
	GetTextSize(font,textString.c_str(),&size,NULL);

	nSize space;
	GetTextSize(font," ",&space,NULL);
	space.cx = 8;

	// Draw the text
	DrawText(font,rect,textString.c_str(),flags,color);

	// Draw block
	DrawFillRect(nRect(rect.left + size.cx,rect.top,rect.left + size.cx + space.cx,rect.top + space.cy),color2);
}
Exemple #12
0
//
// DrawSoftKeyRect()
// draw softkey rect
//
void Font::DrawSoftKeyRect(Uint32 *buf, SDL_Rect *rect, Uint32 fore, Uint32 inside)
{
	int x;
	int y;
	Uint32 color;
	SDL_Rect fill_rect;
	SDL_Rect cur_rect;

	// make fill rect (width+=4, height+=4)
	fill_rect.x = rect->x - 2;
	fill_rect.y = rect->y - 2;
	fill_rect.w = rect->w + 4;
	fill_rect.h = rect->h + 4;

	// stretch +2 dot if fore == inside
	if (fore == inside) {
		cur_rect = fill_rect;
	}
	else {
		// clear previous state
		DrawFillRect(buf, &fill_rect, 0x00000000);
		cur_rect = *rect;
	}

	// rect.x & rect.y
	if ((cur_rect.x != 0) || (cur_rect.y != 0)) {
		buf += ((cur_rect.y * SCREEN_WIDTH) + cur_rect.x);
	}

	// y loop
	for (y=0; y<cur_rect.h; y++) {

		// x loop
		for (x=0; x<cur_rect.w; x++) {
			// initialize
			color = fore;

			if (y < 2) {
				// cornor (top)
				if (x < (2 - y)) {
					color = 0;
				}
				else {
					if (x >= (cur_rect.w - (2 - y))) {
						color = 0;
					}
				}
			}
			else {
				// cornor (bottom)
				if (y >= (cur_rect.h - 2)) {
					if (x <= (y + 2 - cur_rect.h)) {
						color = 0;
					}
					else {
						if (x >= (cur_rect.w - (y + 3 - cur_rect.h))) {
							color = 0;
						}
					}
				}
				else {
					// middle
					if ((x < 2) || (x >= (cur_rect.w - 2))) {
						color = fore;
					}
					else {
						color = inside;
					}

					if (y == 2) {
						if ((x == 2) || (x == (cur_rect.w - 3))) {
							color = fore;
						}
					}

					if (y == (cur_rect.h - 3)) {
						if ((x == 2) || (x == (cur_rect.w - 3))) {
							color = fore;
						}
					}
				}
			}

			// write
			if (color != 0) {
				*buf = color;
			}

			// next x
			buf++;
		}

		// next y
		buf += (SCREEN_WIDTH - cur_rect.w);
	}
}
Exemple #13
0
int OpenMenu(Widget *w, wMENU *m, int xr, int xl, int minWidth, int y)
{
	if (!w || !m) return MENU_QUIT;
	if (!m->nItems || !m->items) return MENU_QUIT;

	SDL_Surface *scr = w->construct->scr;
	wTHEME *t = w->construct->theme;
	ListArgs *args = w->args;
	wITEM *itm;
	wMENU *menu;
	int x, l;
	SDL_Rect area;
	SDL_Surface *saveImage;
	Uint32 c = Darker(t->color1, 60);
	Uint32 cs1 = Darker(t->menus_c1, 15);	// color selection
	args->cMenu = m;
	args->yItem = 0;
	args->cItem = 0;
	int dItems = min(args->dItems, m->nItems);
	if (!dItems) dItems = m->nItems;
	SDL_Rect clip;
	SDL_GetClipRect(scr, &clip);
	int b;
	int ok = ACTION_CONTINUE;
	
	// calcul de la hauteur
	int h = 10*dItems+2;
	while (h > 234) h-=10, dItems-=1;
	if (y+h > scr->h) y = scr->h - h;
	
	// calcul de la largeur
	int wd = 0;
	for (x=0; x < m->nItems; x++) {
		itm = m->items[x];
		l = nSDL_GetStringWidth(t->menus_font1, itm->str);
		if (l > wd) wd = l;
		l = nSDL_GetStringWidth(t->menus_font2, itm->str);
		if (l > wd) wd = l;
	}
	wd += 10;
	if (m->nItems > dItems) wd += 7;	// pour les scrollbars
	if (wd < minWidth) wd = minWidth;
	if (wd > scr->w) wd = scr->w;
	if (xr+wd > scr->w) {
		if (xl-wd > 0) xr = xl - wd;
		else xr = scr->w - wd;
	}
	
	// sauvegarde de l'image
	area = (SDL_Rect) {xr, y, wd, h};
	saveImage = SDL_CreateRGBSurface(SDL_SWSURFACE, wd, h, 16, 0, 0, 0, 0);
	DrawSurface(scr, &area, saveImage, NULL);
	if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE) {
		SDL_FreeSurface(saveImage);
		return ok;
	}
	
	do {
		// dessin !!!
		SDL_SetClipRect(scr, &area);
		DrawFillRect(scr, &area, t->menus_c1);
		DrawRect(scr, &area, c);
		
		
		for (x=0; x < dItems; x++) {
			itm = m->items[x + args->yItem];
			
			if (x == args->cItem)
				DrawFillRectXY(scr, xr+1, y+1+10*x, wd-2, 10, cs1);
			
			if (itm->magicNumber == 1) {
				menu = (wMENU *) itm;
				
				if (wMenu_HasSelectedItemOrMenu(menu))
					DrawClippedStr(scr, t->menus_font2, xr+2, y+2+10*x, menu->title);
				else
					DrawClippedStr(scr, t->menus_font1, xr+2, y+2+10*x, menu->title);
				
				DrawSurface(t->menus_right,NULL,scr, &(SDL_Rect){xr+wd - (m->nItems > dItems? 17:8), y+2+10*x, 5, 7});
			}
			
			else {
				if (itm->isSelected)
					DrawClippedStr(scr, t->menus_font2, xr+2, y+2+10*x, itm->str);
				else
					DrawClippedStr(scr, t->menus_font1, xr+2, y+2+10*x, itm->str);
			}
		}
		if (m->nItems > dItems)
			DrawVScrollBar(scr, t, &area, 10*m->nItems+2, 10*args->yItem);
		SDL_SetClipRect(scr, &clip);
		
		
		// activation !!!
		itm = m->items[args->cItem + args->yItem];
	  ACTIVATION:
		SDL_Flip(scr);
		while ((any_key_pressed() && !K_CTRL()) || K_CLICK());
		while (!any_key_pressed());
		
		if (K_CLICK() || K_ENTER()) {
			if (K_ENTER() && args->maxSelected != 1) {
				ok = wExecCallback(w, SIGNAL_CLICK);
				break;
			}
			if (itm->magicNumber == 1) goto NEWMENU;
			
			if (args->maxSelected == 1) {
				if (args->nSelected) wMenu_DeselectAll(args->menu);
				wMenu_SelectItem(m, args->yItem + args->cItem);
				args->nSelected = 1;
				
				DrawSurface(saveImage, NULL, scr, &area);
				SDL_FreeSurface(saveImage);
				saveImage = NULL;
				ok = wExecCallback(w, K_CLICK() || K_ENTER()? SIGNAL_CLICK : SIGNAL_ACTION);
				break;
			}
			
			else if (args->maxSelected >= 0) {
				b = wMenu_IsSelected(m, args->yItem + args->cItem);
				if (!b && args->nSelected)
					if (args->nSelected == args->maxSelected) goto ACTIVATION;
				
				wMenu_SelectItem(m, args->yItem + args->cItem);
				if (b) args->nSelected--;
				else args->nSelected++;
			}
			if ((ok=wExecCallback(w, SIGNAL_CLICK)) != ACTION_CONTINUE)
				break;
		}
		
		else if (K_UP()) {
			if (!args->yItem && !args->cItem) {
				if (K_CTRL()) goto ACTIVATION;
				args->cItem = dItems-1;
				args->yItem = m->nItems-dItems;
			}
			else {
				if (args->cItem) args->cItem--;
				else args->yItem--;
			}
			if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE)
				break;
		}
		
		else if (K_DOWN()) {
			if (args->yItem + args->cItem >= m->nItems-1) {
				if (K_CTRL()) goto ACTIVATION;
				args->cItem = 0;
				args->yItem = 0;
			}
			else {
				if (args->cItem < dItems-1) args->cItem++;
				else args->yItem++;
			}
			if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE)
				break;
		}
		
		else if (K_RIGHT() && itm->magicNumber == 1) {
		  NEWMENU:;
			int yI = args->yItem, cI = args->cItem;
			ok = OpenMenu(w, (wMENU *) itm, xr+wd-3, xr, minWidth, y+10*args->cItem);
			
			args->cMenu = m;
			args->yItem = yI;
			args->cItem = cI;
			if (K_ESC() || K_ENTER() || (K_CLICK() && args->maxSelected == 1) || ok != ACTION_CONTINUE) break;
			if ((ok=wExecCallback(w, SIGNAL_ACTION)) != ACTION_CONTINUE)
				break;
		}
		
		else if (K_LEFT()) break;
	} while (!K_ESC());
	
	
	if (saveImage) {
		DrawSurface(saveImage, NULL, scr, &area);
		SDL_FreeSurface(saveImage);
	}
	return ok;
}
Exemple #14
0
int main(void)
{
	SDL_Surface *scr = wInitSDL();
	DrawFillRect(scr, NULL, SDL_MapRGB(scr->format, 0, 0, 0));
	wInitTheme(NULL);
	
	
	nSDL_Font *font = nSDL_LoadFont(NSDL_FONT_VGA, 255, 255, 255);
	nSDL_DrawStringCF(scr, font, 5, 5, "Couco\45 u !");
	SDL_Flip(scr);
	wait_key_pressed();
	
	nSDL_FreeFont(font);
	
	
	/*
	// Déclaration des widgets
	Widget *mainWidget = wWindow("Aide");
	Widget *tabs = wTab();
	
	// 1er onglet
	Widget *body1 = wBasicLayout(0);
	Widget *subody1 = wHorizontalLayout(0);
	Widget *im_tbtton = wPixmapNTI(image_buttonScratchpad);
	Widget *navigation = wText("Use the T-Button to navigate between tabs.\n\nIf you maintain this button while using RIGHT or LEFT buttons, you will be able to select your tab.\n\nMaintaining the T-Button plus pushing DEL will delete the selected tab from your work space.\n\nTo navigate faster in your texts, use CTRL+Directional Arrow.", 15);
	
	//2e onglet
	Widget *keys = wText("DOC - Quicksave the current file\nSHIFT + DOC - Quickave all files\n\nSHIFT + Directional Arrow - Select text\nCTRL + VAR - Copy selection\nVAR - Paste selection\n\nUse CTRL + (Character Button) or SHIFT + (Character Button) to get another character.\n\nHere are some useful examples :\nCTRL + ' , '  -->   ;\nCTRL + ' 0 '  -->   :\nCTRL + '.'  -->   !\nCTRL + '(-)'  -->   ?\nqu'est-ce qui bug au fond ??? Est-ce quand j'ai un wText avec progressbar mais non éditable ???\nCTRL+'2' = '\"'\nCTRL+'/' '\%'\nCTRL+'(' = '['\nSHIFT+'(' = '{'\nSHIFT+1 = '<'\nSHIT+'2' = '_'\nSHIFT+'3' = '>'\netc...\n\nUse CTRL+'?!>' to get some special characters.	", 17);
// 
	// 3e onglet
	Widget *body3 = wGridLayout(1, 3,0);
	Widget *text1 = wText("Rename a file with '.py' or '.py.tns' extension to get Python's syntax highlights.", 3);
	Widget *text2 = wText("You can then click ENTER at any time to execute and test your program.", 3);
	Widget *text3 = wText("If you placed the Micropython executable into a specific location, indicate his path via the 'Options' dialog box.", 3);
	
	
	wText_SetUnEditable(navigation);
	wText_SetUnEditable(keys);
	wText_SetUnEditable(text1);
	wText_SetUnEditable(text2);
	wText_SetUnEditable(text3);
	wTab_AddTab(tabs, "Navigation", body1);
	wTab_AddTab(tabs, "Keys", keys);
	wTab_AddTab(tabs, "Python", body3);
	
	wAddWidget(mainWidget, tabs);
	
	wAddWidget(body1, subody1);
	wAddWidget(subody1, im_tbtton);
	wAddWidget(subody1, wExLabel("<--- This is the awesome T-BUTTON.", ALIGN_LEFT, nSDL_LoadFont(NSDL_FONT_VGA, 204,15,225)));
	wAddWidget(body1, navigation);
	
	wAddWidget(body3, text1);
	wAddWidget(body3, text2);
	wAddWidget(body3, text3);
	
	wSetHeight(subody1, 24);
	wSetWidth(mainWidget, 300);
	wSetHeight(mainWidget, 220);
		
	wExecConstruct(mainWidget);//*/

	wCloseTheme();
	SDL_Quit();
	return 1;
}