// Calculate the thumb colors based on the specified background color.
void Slider::setThumbColorBasedOnColor(const GFXColor& c) {
	if(!isClear(c)) {
		if(isColorLight(c)) {
			// Light color.  Make thumb darker.
			setThumbColor(darkenColor(c,.3), GUI_OPAQUE_WHITE());
		} else {
			// Dark Color.
			setThumbColor(lightenColor(c,.3), GUI_OPAQUE_WHITE());
		}
	}
}
Exemple #2
0
//Draw all visible windows.
void WindowManager::draw()
{
    GFXHudMode( true );            //Load identity matrices.
    GFXColorf( GUI_OPAQUE_WHITE() );

    GFXDisable( DEPTHTEST );
    GFXEnable( DEPTHWRITE );
    GFXDisable( LIGHTING );
    GFXDisable( CULLFACE );
    GFXClear( GFXTRUE );
    GFXDisable( DEPTHWRITE );
    GFXBlendMode( SRCALPHA, INVSRCALPHA );
    GFXDisable( TEXTURE1 );
    GFXEnable( TEXTURE0 );
    //Just loop through all the windows, and remember if anything gets drawn.
    //Since the first window in the list is drawn first, z-order is
    //maintained.  First entry is the bottom window, last is the top window.
    //FIXME mbyron -- I think the event manager needs to get involved with window z-order.
    //(Mouse events should go to windows in zorder, shouldn't they?)
    for (size_t i = 0; i < m_windows.size(); i++) 
    {
        if ( m_windows[i]->controller() )//it's a controller
            m_windows[i]->controller()->draw();//that can draw
        if ( i < m_windows.size() ) 
        m_windows[i]->draw();
    }
    //Emulate EndGUIFrame.
    static VSSprite MouseVSSprite( "mouse.spr", BILINEAR, GFXTRUE );
    static Texture  dummy( "white.bmp", 0, NEAREST, TEXTURE2D, TEXTURE_2D, GFXTRUE );
    GFXDisable( CULLFACE );
    ConditionalCursorDraw( true );
    //Figure position of cursor sprite.
    float sizex     = 0.0, sizey = 0.0;
    const Point loc = globalEventManager().mouseLoc();
    MouseVSSprite.GetSize( sizex, sizey );
    float tempx     = 0.0, tempy = 0.0;
    MouseVSSprite.GetPosition( tempx, tempy );
    MouseVSSprite.SetPosition( tempx+loc.x+sizex/2, tempy+loc.y+sizey/2 );

    dummy.MakeActive();
    GFXBlendMode( SRCALPHA, INVSRCALPHA );
    GFXColorf( GUI_OPAQUE_WHITE() );

    //Draw the cursor sprite.
    GFXEnable( TEXTURE0 );
    GFXDisable( DEPTHTEST );
    GFXDisable( TEXTURE1 );
    MouseVSSprite.Draw();

    GFXHudMode( false );
    GFXEnable( CULLFACE );
    MouseVSSprite.SetPosition( tempx, tempy );
}