Exemple #1
0
void drawScene()
{
	float x, y;
    tiny3d_Project2D(); // change to 2D context (remember you it works with 848 x 512 as virtual coordinates)
    DrawBackground2D(0x0040ffff) ; // light blue 

    SetFontSize(12, 24);
    
    x= 0.0; y = 0.0;

    SetCurrentFont(1);
    SetFontColor(0xffffffff, 0x0);
    x = DrawString(x,y, "Hello World!. My nick is ");
    SetFontColor(0x00ff00ff, 0x0);
    SetCurrentFont(0);
    x = DrawString(x,y, "Hermes ");
    SetCurrentFont(1);
    SetFontColor(0xffffffff, 0x0);
    x = DrawString(x,y, "and this is one sample working with\nfonts.");

    SetCurrentFont(2);
    
    x= 0; y += 64;
    SetCurrentFont(1);
    DrawString(x, y, "I am using 3 fonts:");
    
    SetCurrentFont(0);
    y += 64;
    SetFontColor(0xffffffff, 0x00a000ff);
    DrawString(x, y, "Font 0 is one array of 224 chars 16 x 32 pix and 2 bit depth");

    SetCurrentFont(1);
    y += 64;
    SetFontColor(0xffffffff, 0xa00000ff);
    DrawString(x, y, "Font 1 is one array of 224 chars 16 x 32 pix and 2 bit depth");

    SetCurrentFont(2);
    y += 64;
    SetFontColor(0x000000ff, 0xffff00ff);
    DrawString(x, y, "Font 2 is one array of 255 chars 8 x 8 pix and 1 bit depth");

    y += 64;
    SetCurrentFont(1);
    SetFontSize(32, 64);
    SetFontColor(0xffffffff, 0x000000ff);
    SetFontAutoCenter(1);
    DrawString(0, y, "You can resize letters");
    SetFontAutoCenter(0);

    SetFontSize(12, 24);
    SetFontColor(0xffffffff, 0x00000000);
    y += 72;
    DrawString(0, y, "change the color, background color and center the text\nwith SetFontAutoCenter()");
    y += 72;

    SetFontColor(0x00ff00ff, 0x00000000);
    DrawFormatString(0, y, "Here %s font 0 uses %i bytes as texture", "using DrawFormatString()", 224*(16*2/8)*32);

}
Exemple #2
0
void CInputRichEdit::SetFontInfo(core::MessageFont& FontInfo ) 
{
	SetFontName( FontInfo.font_type ) ;
	SetFontSize( FontInfo.font_size ) ;
	SetFontColor( FontInfo.font_color ) ;

	if ( FontInfo.font_style&core::FONTSTYLETYPE_BOLD )
	{
		SetFontBold( true ) ;
	}
	else
	{
		SetFontBold( false ) ;
	}
	if ( FontInfo.font_style&core::FONTSTYLETYPE_UNDERLINE )
	{
		SetFontItalic( true ) ;
	}
	else
	{
		SetFontItalic( false ) ;
	}
	if ( FontInfo.font_style&core::FONTSTYLETYPE_ITALICS )
	{
		SetFontUnderLine( true ) ;
	}
	else
	{
		SetFontUnderLine( false ) ;
	}

}
Exemple #3
0
float DrawButton2(float x, float y, float w, char * t, int select)
{
    int len = strlen(t);
    u32 rgba = 0xffffffff, brgba = 0x0000c080;

    if(w < (len + 2) * 10) w = (len + 2) * 10;

    SetFontAutoCenter(0);
    SetCurrentFont(FONT_BUTTON);
    SetFontSize(10, 32);

    if(select == 2) {rgba = 0xffffffff; brgba = 0xc01000ff;}
        else
    if(select == 1) {rgba = 0xffffffff; brgba = 0x00c000ff;}
        else
    if(select == -1) {rgba = 0xffffff6f; brgba = 0x00c0006f;}
        
    SetFontColor(rgba, 0x0);

    DrawBox(x, y, 0.0f, w, 40, brgba);
    DrawLineBox(x, y, 0.0f, w, 40, 0xc0c0c0ff);

    DrawString(x + (w - len * 10) / 2, y + 4, t);

    return x + w;

}
Exemple #4
0
/*
 * Cheats Code Options Menu
 */
void DrawOptions(struct option_entry option, u8 alpha, int y_inc, int selIndex)
{
    if (!option.name || !option.value)
        return;
    
    int c = 0, yOff = 80, cIndex = 0;
    
    int maxPerPage = (512 - (yOff * 2)) / y_inc;
    int startDrawX = selIndex - (maxPerPage / 2);
    int max = maxPerPage + startDrawX;
    
    SetFontSize(y_inc-6, y_inc-4);

    for (c = startDrawX; c < max; c++)
    {
        if (c >= 0 && c < option.size)
        {
            SetFontColor(0x00000000 | ((alpha * CalculateAlphaList(c, selIndex, maxPerPage)) / 0xFF), 0);
            
            if (option.name[c])
                DrawString(MENU_SPLIT_OFF + MENU_ICON_OFF, yOff, option.name[c]);
            
            //Selector
            if (c == selIndex)
            {
                int i = 0;
				for (i = MENU_SPLIT_OFF; i < 848; i++)
					DrawTexture(menu_textures[mark_line_png_index], i, yOff, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);
            }
            
            cIndex++;
        }
        yOff += y_inc;
    }
}
Exemple #5
0
void drawScene()
{

    /*
    tiny3d_Project3D();
    tiny3d_SetProjectionMatrix(NULL);

	DrawBackground3D(0xffff00ff) ; // yellow
   */

    tiny3d_Project2D(); // change to 2D context (remember you it works with 848 x 512 as virtual coordinates)

    // fix Perspective Projection Matrix

    DrawBackground2D(0x0040ffff) ; // light blue 


    SetFontSize(16, 24);
    SetFontColor(0xffffffff, 0x0);

    SetFontAutoCenter(1);
    DrawString(0, (512 - 24)/2 - 64, "Use LEFT/RIGHT/UP/DOWN to adjust the screen");

    DrawFormatString(0, (512 - 24)/2, "Video Scale X: %i Y: %i", videoscale_x, videoscale_y);

    DrawString(0, (512 - 24)/2 + 64, "Press 'X' to exit");
    SetFontAutoCenter(0);
  
    
}
Exemple #6
0
 CairoFont::CairoFont(cairo_scaled_font_t* fontface)
 {
     mFontFace=fontface;
     cairo_scaled_font_reference(mFontFace);
     cairo_scaled_font_extents(mFontFace,&mFontExtents);
     SetFontColor(Color(0,0,0,255));
 }
Exemple #7
0
void HTMLView::DoFontTagAttributes( char* tag ) {

	char attrib[100];		// general size assumptions for attribs and values
	char value[100];
	bool Changed;
	fontInfo savedInfo;
	
	// first save the relevant font info in case we need to push it on the stack
	savedInfo.color = insertstyle.color;
	savedInfo.size = insertstyle.font.Size();
	
	// Loop through, getting all the attibutes, and process them
	bool more = GetTagAttribute( tag, attrib, value );
	while( more ) {	

		// starts with 's' (probably size)
		if( (*attrib == 'S') || (*attrib == 's') ) {
			if( FirstWordMatch( attrib, "size" ) ) {
				Changed = true;
				int fontSize = atoi( value );
				if( fontSize == 1 )
					SetFontSize( 8 );
				else if( fontSize == 2 )
					SetFontSize( 10 );		
				else if( fontSize == 3 )
					SetFontSize( 12 );	
				else if( fontSize == 4 )
					SetFontSize( 14 );	
				else if( fontSize == 5 )
					SetFontSize( 18 );
				else if( fontSize == 6 )
					SetFontSize( 24 );
				else if( (fontSize >= 7) && (fontSize < 42) )
					SetFontSize( 38 );	
			}
		}
		
		// starts with 'c' (probably color)
		if( (*attrib == 'C') || (*attrib == 'c') ) {
			if( FirstWordMatch( attrib, "color" ) ) {
				Changed = true;
				
				// must be in the form #xxxxxx
				if( strlen(value) != 7 || value[0] != '#' )
					continue;
				rgb_color fontColor;
				fontColor.red = 16*HexcharToInt(value[1]) + HexcharToInt(value[2]);
				fontColor.green = 16*HexcharToInt(value[3]) + HexcharToInt(value[4]);
				fontColor.blue = 16*HexcharToInt(value[5]) + HexcharToInt(value[6]);
				SetFontColor( fontColor );
			}
		}		
													
		more = GetTagAttribute( NULL, attrib, value );
	}
	
	// if the styles have changed at all, push the old style onto the stack
	fontStack.Push( savedInfo );
}
Exemple #8
0
// -------------------------------------------------------------------
CairoDevice::CairoDevice(cairo_t * dev, VGSystem * sys) 
	: fNativeDevice(0), fSystem(sys), fTextFont(0), fMusicFont(0), fFillColor(0,0,0), fPenColor(0,0,0)
{
	fNativeDevice = cairo_reference (dev);
	SetFontColor( VGColor(0,0,0,ALPHA_OPAQUE) );
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	// transparent
	SetFontAlign( kAlignLeft | kAlignBase );
}
Exemple #9
0
/*
 * Cheats Codes Selection Menu
 */
void DrawGameList(int selIndex, struct game_entry * games, int glen, u8 alpha)
{
    SetFontSize(14, 16);
	SetCurrentFont(font_comfortaa_regular);
    
    int game_y = 80, y_inc = 20;
    int maxPerPage = (512 - (game_y * 2)) / y_inc;
    
    int x = selIndex - (maxPerPage / 2);
    int max = maxPerPage + selIndex;
    
    if (max > glen)
        max = glen;
    
    
    for (; x < max; x++)
    {
        int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x));
        
        if (x >= 0)
        {
			u8 a = ((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF);
			if (isGameActivated(games[x]))
			{
				DrawTextureCentered(menu_textures[mark_arrow_png_index], MENU_ICON_OFF + (MENU_TITLE_OFF / 2), game_y + (y_inc / 2), 0, MENU_TITLE_OFF / 3, y_inc / 2, 0xFFFFFF00 | a);
			}
            SetFontColor(0x00000000 | a, 0x00000000);
			if (games[x].name)
			{
				char * nBuffer = (char*)malloc(strlen(games[x].name));
				strcpy(nBuffer, games[x].name);
				int game_name_width = 0;
				while ((game_name_width = WidthFromStr(nBuffer)) > 0 && (MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo + game_name_width) > (800 - (MENU_ICON_OFF * 3) - xo))
					nBuffer[strlen(nBuffer) - 1] = '\0';
				DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 1) - xo, game_y, nBuffer);
				free(nBuffer);
			}
			if (games[x].title_id)
				DrawString(800 - (MENU_ICON_OFF * 3) - xo, game_y, games[x].title_id);
			if (games[x].version)
				DrawString(800 - (MENU_ICON_OFF * 1) - xo, game_y, games[x].version);
        }
        
        if (x == selIndex)
        {
            int c;
            for (c = 0; c < 848; c++)
				DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);
        
			DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha);
		}
        
        game_y += y_inc;
    }
    
    DrawScrollBar(selIndex, glen, y_inc, 800, alpha);
    
}
Exemple #10
0
void UITouchButton::Init()
{
    UIButton::Init();
    SetBackgroundColor(ColorManager::knWhite);
    SetFocusedBackgroundColor(ColorManager::knBlack);
    SetFontColor(ColorManager::knBlack);
    SetFocusedFontColor(ColorManager::knWhite);

}
Exemple #11
0
CairoDevice::CairoDevice(int w, int h, VGSystem * sys) 
	: fNativeDevice(0), fSystem(sys), fTextFont(0), fMusicFont(0), fFillColor(255,255,255), fPenColor(0,0,0)
{
	cairo_surface_t* surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
	fNativeDevice = cairo_create (surface);
	cairo_surface_destroy (surface);	
	SetFontColor( VGColor(0,0,0,ALPHA_OPAQUE) );
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	// transparent
	SetFontAlign( kAlignLeft | kAlignBase );
}
Exemple #12
0
void MAS::HyperText::MsgInitSkin() {
    for (int i=0; i<4; i++) {
        if (GetFontColor(i) == Color::transparent) SetFontColor(skin->fcol[Skin::INFO_HYPER][i], skin->scol[Skin::INFO_HYPER][i], i);
        if (GetFontIndex(i) == -1) SetFont(skin->fnt[Skin::INFO_HYPER][i], i);
    }
    if (GetTextMode() == Color::transparent) SetTextMode(skin->c_face);
    SetFlag(D_AUTOSIZE);
    UpdateSize();
    ClearFlag(D_TOGGLE | D_SPINNER);
    Button::MsgInitSkin();
}
Exemple #13
0
void MAS::RadioButton::MsgInitSkin() {
   Button::MsgInitSkin();
   for (int i=0; i<4; i++) {
      if (GetFontColor(i) == Color::transparent) SetFontColor(skin->fcol[Skin::INFO_RADIO][i], skin->scol[Skin::INFO_RADIO][i], i);
      if (GetFontIndex(i) == -1) SetFont(skin->fnt[Skin::INFO_RADIO][i], i);
   }
   if (GetTextMode() == Color::transparent) SetTextMode(skin->c_face);
   if (GetBitmapIndex() == Skin::BUTTON) SetBitmap(Skin::RADIO);
   SetFlag(D_TOGGLE);
   ClearFlag(D_SPINNER | D_AUTOSIZE);
}
Exemple #14
0
// --------------------------------------------------------------
void GDeviceWin32::initialize(VGSystem* sys)
{
	SelectPen( VGColor(0,0,0,ALPHA_OPAQUE), 1);		//opaque black
	SelectFillColor( VGColor(0,0,0,ALPHA_OPAQUE) );	//opaque black
	SetFontColor( VGColor(0,0,0) );					//opaque black
	SetFontBackgroundColor( VGColor(255,255,255,ALPHA_TRANSPARENT) );	//transp. white
	SetFontAlign( kAlignLeft | kAlignBase );

	// guido hack - must be removed asap
	mSys = sys;
}
void CFlyingInputRichEdit::OnKillFocus(CWnd* pNewWnd)
{
	CInputRichEdit::OnKillFocus(pNewWnd);

	CString strText;
	GetWindowText(strText);

	if (m_strDefaultContent != L"" && strText == L"")
	{
		SetFontColor(RGB(128, 128, 128));
		SetWindowText(m_strDefaultContent);
	}
}
void CFlyingInputRichEdit::OnSetFocus(CWnd* pOldWnd)
{
	CInputRichEdit::OnSetFocus(pOldWnd);

	CString strText;
	GetWindowText(strText);

	if (strText == m_strDefaultContent)
	{
		SetWindowText(L"");
		SetFontColor(RGB(0, 0, 0));
	}
}
Exemple #17
0
//--------------------------------------------------------------------
void CForm::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop,
                    int p_nWidth, int p_nHeight )
{
    IGUIControl::Create();
    SetParent( p_pParent );
    SetLeft( p_nLeft );
    SetTop( p_nTop );
    SetWidth( p_nWidth );
    SetHeight( p_nHeight );
    if( m_pColor == NULL )
    {
        SetFontColor( *(new CColor( CColor::WHITE )) );
    }
}
Exemple #18
0
	//--------------------------------------------------------------------
	void CButton::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop, 
		CBitmap& p_Bitmap,const std::wstring& p_szCaption )
	{
		IGUIControl::Create();
		SetParent( p_pParent );
		SetLeft( p_nLeft );
		SetTop( p_nTop );
		SetGlygh( p_Bitmap );
		SetCaption( p_szCaption );
		if( m_pColor == NULL )
		{
			SetFontColor( *(new CColor( CColor::WHITE )) );
		}
	}
Exemple #19
0
//--------------------------------------------------------------------
void CForm::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop,
                    CBitmap& p_Bitmap )
{
    IGUIControl::Create();
    SetParent( p_pParent );
    SetLeft( p_nLeft );
    SetTop( p_nTop );
    SetBG( p_Bitmap );
    SetWidth( p_Bitmap.Width() );
    SetHeight( p_Bitmap.Height() );
    if( m_pColor == NULL )
    {
        SetFontColor( *(new CColor( CColor::WHITE )) );
    }
}
Exemple #20
0
BLOCO_API HumanView::Console::Console()
	: CILKeyboardState("console keyboard handler"), m_bActive( false ), m_bExecuteStringOnUpdate( false )
{
	m_CurrentInputString = std::string("");

	SetFontColor(Col( 1.0f, 1.0f, 1.0f, 1.0f ));
	SetFontSize(20.0f);

	m_CursorBlinkTimer = kCursorBlinkTimeMS;
	m_bCursorOn = true;
	
	m_helperPos = 0;

	g_pInput->AddListener((ICILKeyboardHandler*)this);
}
Exemple #21
0
	//--------------------------------------------------------------------
	void CScrollBar::Create(  IGUIControl* p_pParent, int p_nLeft, int p_nTop,
		ENUM_ScrollBarType p_eType, CBitmap& p_Bitmap, int p_nLength )
	{
		IGUIControl::Create();

		SetParent( p_pParent );
		SetLeft( p_nLeft );
		SetTop( p_nTop );
		SetType( p_eType );
		SetLength( p_nLength );
		SetSlider( p_Bitmap );
		if( m_pColor == NULL )
		{
			SetFontColor( *(new CColor( CColor::WHITE )) );
		}
	}
LRESULT LyricForm::HandleMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0L;
	switch (message)
	{
	case WM_CREATE:
		lRes = OnCreate(message, wParam, lParam);
		break;
	case WM_PAINT:
		PaintLyric();
		break;
	case WM_DESTROY:
		_writeText->Release();
		PostQuitMessage(0);
		break;
	case WM_NCPAINT:
		break;
	case WM_NCCALCSIZE:
		break;
	case WM_NCACTIVATE:
		lRes = wParam == NULL ? TRUE : FALSE;
		break;
	case WM_NCHITTEST:
		lRes = OnNCHitTest(message, wParam, lParam);
	case WM_SIZE:
		_writeText->OnFormChange();
		break;
	case WM_TIMER:
		break;
	case CM_LYRIC:
		SetLyric(std::wstring((wchar_t*)wParam));
		PaintLyric();
		break;
	case CM_FONTCOLOR:
		SetFontColor(MakeColor((DWORD)wParam, (DWORD)lParam));
		break;
	case CM_FONTSIZE:
		SetFontSize((float)wParam);
		break;
	case CM_CLOSE:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(m_hWnd, message, wParam, lParam);
	}
	return lRes;
}
Exemple #23
0
void OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
		case IDM_STARTSERVICE:
		{
			//开始服务器
			g_fTerminated = FALSE;
			
			UINT			dwThreadIDForMsg = 0;
			unsigned long	hThreadForMsg = 0;
			
			//创建一条线程
			hThreadForMsg = _beginthreadex(NULL, 0, LoadAccountRecords, NULL, 0, &dwThreadIDForMsg);
			
			return;
		}
		case IDM_STOPSERVICE:
		{
			ClearSocket(g_gcSock);

			SwitchMenuItem(FALSE);

			return;
		}
		case IDM_FONTCOLOR:
			SetFontColor();
			return;
		case IDM_BACKCOLOR:
			SetBackColor();
			return;
		case IDM_CONFIG:
		{
			CreateConfigProperties();
			return;
		}
	}
}
UIListbox::UIListbox(UIWidget *ptr) {
	AddParent(ptr);
	BaseInit();
	char_width = 8;
	char_height = 13;
	SetViewCount(3);
	SetBounds(UIRect(10,10,100,100));
	item_height = 15;
	selected_text = UIColor(0,0,0);
	selected_bg = UIColor(100,142,208);
	SetBgColor(kNone, UIColor(39,39,39));
	SetFontColor(kNone, UIColor(253,253,253));
	button_color = UIColor(159,159,159);
	view_pos = 0;
	selected_index = 0;
	tri_offsetx = 4;
	tri_offsety = 3;
	tri_length = 8;
	chat_mode = false;
	max_lines = 100;
	
	//icon = new UIImage(NULL);
}
Exemple #25
0
void HTMLView::HandleHTMLTag( char* tag ) {

	char* p;
	bool off = false;
	bool handled = false;

	// Trim all the whitespace off the left side of the tag
	p = tag;
	while( *p == ' ' )
		++p;
		
	// return if there is nothing left
	if( !(*p) )
		return;

	// is this an end tag?
	if( *p == '/' ) {
		off = true;

		// make sure there is something after the slash
		if( !(*(++p)) )
			return;		
	}
		
	// starts with 'b' (body, bold, or line break)
	if( (*p == 'B') || (*p == 'b') ) {
		
		// if it is just a b (for bold)
		if( !(*(p+1)) || *(p+1) == ' ' ) {
			SetFontAttribute( B_BOLD_FACE, !off );
			handled = true;
		}

		// if it is a body tag		
		else if( FirstWordMatch( p, "body" ) )
			handled = true;
			
		// if it is a line break		
		else if( FirstWordMatch( p, "br" ) ) {
			InsertHTMLText( "\n" );
			handled = true;
		}
	}
		
	// starts with 'i' (probably italic)
	else if( (*p == 'I') || (*p == 'i') ) {
		if( !(*(p+1)) || *(p+1) == ' ' ) {
			SetFontAttribute( B_ITALIC_FACE, !off );
			handled = true;
		}
	}
	
	// starts with 'f' (probably <FONT> )
	else if( (*p == 'F') || (*p == 'f') ) {
		if( FirstWordMatch( p, "font" ) ) {
			if( !off && showFontColorSizes )
				DoFontTagAttributes( p );
			else {
				if( !fontStack.IsEmpty() ) {
					fontInfo savedInfo;
					fontStack.Pop( savedInfo );
					SetFontColor( savedInfo.color );
					SetFontSize( savedInfo.size );
				} else
					ResetFontToBase();
			}			
			handled = true;
		}
	}
	
	// starts with 'a' (probably <a href="..."> )
	else if( (*p == 'A') || (*p == 'a') ) {
		if( FirstWordMatch( p, "a" ) ) {
			if( !off )
				DoLinkAttributes( p );
			else {
				// Insert the URL (kind of cheap, but it works for now)
				InsertHTMLText( " [" );
				InsertHTMLText( URL );
				InsertHTMLText( "]" );
				URL[0] = '\0';
				urlOn = false;
			}
			handled = true;
		}
	}	
	
	// starts with 'h' (probably <HTML> )
	else if( (*p == 'H') || (*p == 'h') ) {
		if( FirstWordMatch( p, "html" ) )
			handled = true;
	}
	
	// starts with 'u' (underline)
	else if( (*p == 'U') || (*p == 'u') ) {
		if( !(*(p+1)) || *(p+1) == ' ' )
			handled = true;
	}
	
	// starts with 's' (<sub> or <sup> )
	else if( (*p == 'S') || (*p == 's') ) {
		if( FirstWordMatch(p,"sub") || FirstWordMatch(p,"sup") )
			handled = true;
	}	
	
	// if it wasn't handled, it was probably some silly user
	//   saying stuff like <this>, so print it out raw
	if( !handled ) {
		InsertHTMLText( "<" );
		InsertHTMLText( tag );
		InsertHTMLText( ">" );
	}
}
Exemple #26
0
void DrawCheatsList(int selIndex, struct game_entry game, u8 alpha)
{
    SetFontSize(14, 16);
    
    int game_y = 80, y_inc = 20;
    int maxPerPage = (512 - (game_y * 2)) / y_inc;
    
    int x = selIndex - (maxPerPage / 2);
    int max = maxPerPage + selIndex;
    
    if (max > game.code_count)
        max = game.code_count;
    
    for (; x < max; x++)
    {
        int xo = 0; //(((selIndex - x) < 0) ? -(selIndex - x) : (selIndex - x));
        
        if (x >= 0 && game.codes[x].name)
        {
            //u32 color = game.codes[x].activated ? 0x4040C000 : 0x00000000;
			u8 a = (u8)((alpha * CalculateAlphaList(x, selIndex, maxPerPage)) / 0xFF);
            SetFontColor(0x00000000 | a, 0x00000000);
            //printf ("Drawing code name %d\n", x);
			SetCurrentFont(font_comfortaa_regular);
            float dx = DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3) - xo, game_y, game.codes[x].name);
            //DrawString(MENU_ICON_OFF + (MENU_TITLE_OFF * 3), game_y, game.codes[x].name);
            
            if (game.codes[x].activated)
            {
				DrawTexture(menu_textures[cheat_png_index], MENU_ICON_OFF, game_y, 0, (MENU_TITLE_OFF * 3) - 15, y_inc + 2, 0xFFFFFF00 | a);

				SetFontSize((int)(y_inc * 0.6), (int)(y_inc * 0.6));
                SetFontAlign(3);
				//SetCurrentFont(font_comfortaa_light);
				SetFontColor(0xFFFFFF00 | a, 0);
				DrawString(MENU_ICON_OFF + ((MENU_TITLE_OFF * 3) - 15) / 2, game_y + 2, game.codes[x].cwrite ? "constant" : "once");
                SetFontAlign(0);
                SetFontSize(14, 16);
                
                if (game.codes[x].options_count > 0 && game.codes[x].options)
                {
                    int od = 0;
                    for (od = 0; od < game.codes[x].options_count; od++)
                    {
                        if (game.codes[x].options[od].sel >= 0 && game.codes[x].options[od].name && game.codes[x].options[od].name[game.codes[x].options[od].sel])
                        {
							SetCurrentFont(font_comfortaa_bold);

                            //Allocate option
                            char * option = malloc(strlen(game.codes[x].options[od].name[game.codes[x].options[od].sel]) + 4);
                            memset(option, 0, sizeof(option));
                            //If first print "(NAME", else add to list of names ", NAME"
                            sprintf(option, (od == 0) ? " (%s" : ", %s", game.codes[x].options[od].name[game.codes[x].options[od].sel]);
                            
                            //If it's the last one then end the list
                            if (od == (game.codes[x].options_count - 1))
                                option[strlen(option)] = ')';
                            
							SetFontColor(0x00000000 | a, 0x00000000);
                            dx = DrawString(dx, game_y, option);
                            
                            free (option);
                        }
                    }
                }
                
            }
        }
        
        if (x == selIndex)
        {
            //Draw selection bar
            int c = 0;
            for (c = 0; c < 848; c++)
				DrawTexture(menu_textures[mark_line_png_index], c, game_y, 0, menu_textures[mark_line_png_index].texture.width, menu_textures[mark_line_png_index].texture.height, 0xFFFFFF00 | alpha);
        
			DrawTextureCenteredX(menu_textures[mark_arrow_png_index], MENU_ICON_OFF - 20, game_y, 0, (2 * y_inc) / 3, y_inc + 2, 0xFFFFFF00 | alpha);
		}
        
        game_y += y_inc;
    }
    
    DrawScrollBar(selIndex, game.code_count, y_inc, 800, alpha);
    
}
Exemple #27
0
	const F32 FreetypeFont::RenderText(const std::string & text, const Color & color, const Vector3<F32> & origin, const Vector3<F32> & forward, const Vector3<F32> & up)
	{
		SetFontColor(color);

		return RenderText(text, origin, forward, up);
	}
Exemple #28
0
void drawScene(int frame)
{

    int type = 0;

    tiny3d_Project2D(); // change to 2D context (remember you it works with 848 x 512 as virtual coordinates)


    if(!((frame/300) & 1)) {

        // enable YUV 
        tiny3d_Enable_YUV(USE_AYUV_32BITS_TEXTURE); 
      
        // set AYUV 32 bits texture
        tiny3d_SetTextureWrap(0, texture[0].offset, texture[0].w, texture[0].h, texture[0].stride,  
            TINY3D_TEX_FORMAT_A8R8G8B8, TEXTWRAP_CLAMP, TEXTWRAP_CLAMP, TEXTURE_LINEAR);

        type = 0;

    } else {
    
        tiny3d_Enable_YUV(USE_YUV_8BIT_TEXTURES);

        // set Y 8 bit texture
        tiny3d_SetTextureWrap(0, texture[1].offset, texture[1].w, texture[1].h, texture[1].stride,
            TINY3D_TEX_FORMAT_L8, TEXTWRAP_CLAMP, TEXTWRAP_CLAMP, TEXTURE_LINEAR);
       
        // set U 8 bit texture
        tiny3d_SetTextureWrap(1, texture[2].offset, texture[2].w, texture[2].h, texture[2].stride,
            TINY3D_TEX_FORMAT_L8, TEXTWRAP_CLAMP, TEXTWRAP_CLAMP, TEXTURE_LINEAR);
        
        // set V 8 bit texture
        tiny3d_SetTextureWrap(2, texture[3].offset, texture[3].w, texture[3].h, texture[3].stride,
            TINY3D_TEX_FORMAT_L8, TEXTWRAP_CLAMP, TEXTWRAP_CLAMP, TEXTURE_LINEAR);

        type = 1;
    }
    
    // draw YUV image
                                         // r    g    b    a   result = (color + a) * (r, g, b)
    DrawColorSquare(0, 0,  0, 847.0, 511.0, 1.0, 1.0, 1.0, 0.0);

    tiny3d_Disable_YUV();

    SetFontSize(16, 32);
    SetFontColor(0x0040ffff, 0x0);

    if(!type) {

       DrawString(16, 16, "Drawing AYUV 32bits, surface A8R8G8B8");
       
       DrawFormatString(16, 16 + 48, "AYUV (%i x %i x 4)", texture[0].w, texture[0].h);

    } else {

       DrawString(16, 16, "Drawing Y,U,V 8 bits, 3 surfaces L8");
       
       DrawFormatString(16, 16 + 48, "Y (%i x %i), U (%i x %i), V (%i x %i)", texture[1].w, texture[1].h, texture[2].w, texture[2].h,
           texture[3].w, texture[3].h);

    }
        
        
}
Exemple #29
0
void OnCommand(WPARAM wParam, LPARAM lParam)
{
	switch (LOWORD(wParam))
	{
		case IDM_STARTSERVICE:
		{
			//开始服务器
			DWORD	dwIP = 0;
			int		nPort = 0;

			g_fTerminated = FALSE;
		
			g_pRandom.Random_Seed(0);

			//初始化等待ip
			ENGINE_COMPONENT_INFO info = g_SeverConfig.getLoginGateInfo();
			
			nPort = info.extport?info.extport:7000;

			
			//初始化完成端口
			InitServerSocket(g_ssock, &g_saddr, _IDM_SERVERSOCK_MSG, nPort, FD_ACCEPT);

			//初始化等待ip
			ENGINE_COMPONENT_INFO loginsrvinfo = g_SeverConfig.getLoginSrvInfo();

			nPort = loginsrvinfo.intport?loginsrvinfo.intport:5500;

			//连接loginsrv
			ConnectToServer(g_csock, &g_caddr, _IDM_CLIENTSOCK_MSG, loginsrvinfo.intip.c_str(), dwIP, nPort, FD_CONNECT|FD_READ|FD_CLOSE);

			HMENU hMainMenu = GetMenu(g_hMainWnd);
			HMENU hMenu = GetSubMenu(hMainMenu, 0);

			EnableMenuItem(hMenu, IDM_STARTSERVICE, MF_GRAYED|MF_BYCOMMAND);
			EnableMenuItem(hMenu, IDM_STOPSERVICE, MF_ENABLED|MF_BYCOMMAND);

			SendMessage(g_hToolBar, TB_SETSTATE, (WPARAM)IDM_STARTSERVICE, (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
			SendMessage(g_hToolBar, TB_SETSTATE, (WPARAM)IDM_STOPSERVICE, (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));

			InsertLogMsg(IDS_STARTSERVICE);

			SendMessage(g_hStatusBar, SB_SETTEXT, MAKEWORD(0, 0), (LPARAM)_TEXT("Ready"));

			return;
		}
		case IDM_STOPSERVICE:
		{
			g_fTerminated = TRUE;

/*			if (g_hAcceptThread != INVALID_HANDLE_VALUE)
			{
				TerminateThread(g_hAcceptThread, 0);
				WaitForSingleObject(g_hAcceptThread, INFINITE);
				CloseHandle(g_hAcceptThread);
				g_hAcceptThread = INVALID_HANDLE_VALUE;
			}

			if (g_hMsgThread != INVALID_HANDLE_VALUE)
			{
				TerminateThread(g_hMsgThread, 0);
				WaitForSingleObject(g_hMsgThread, INFINITE);
				CloseHandle(g_hMsgThread);
				g_hMsgThread = INVALID_HANDLE_VALUE;
			}
*/
			ClearSocket(g_ssock);
			ClearSocket(g_csock);

			CloseHandle(g_hIOCP);

			HMENU hMainMenu = GetMenu(g_hMainWnd);
			HMENU hMenu = GetSubMenu(hMainMenu, 0);

			EnableMenuItem(hMenu, IDM_STARTSERVICE, MF_ENABLED|MF_BYCOMMAND);
			EnableMenuItem(hMenu, IDM_STOPSERVICE, MF_GRAYED|MF_BYCOMMAND);

			SendMessage(g_hToolBar, TB_SETSTATE, (WPARAM)IDM_STARTSERVICE, (LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
			SendMessage(g_hToolBar, TB_SETSTATE, (WPARAM)IDM_STOPSERVICE, (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));

			InsertLogMsg(IDS_STOPSERVICE);

			SendMessage(g_hStatusBar, SB_SETTEXT, MAKEWORD(0, 0), (LPARAM)_TEXT("Not Ready"));

			return;
		}
		// ORZ:
		case IDM_FONTCOLOR:
			SetFontColor();
			return;
		case IDM_BACKCOLOR:
			SetBackColor();
			return;
		case IDM_CONFIG:
		{
			DialogBox(g_hInst, MAKEINTRESOURCE(IDD_CONFIGDLG), g_hMainWnd, (DLGPROC)ConfigDlgFunc);

			return;
		}
	}
}
void CFlyingInputRichEdit::SetDefaultContent(CString strContent)
{
	m_strDefaultContent = strContent;
	SetFontColor(RGB(128, 128, 128));
	SetWindowText(strContent);
}