예제 #1
0
UIMenu::UIMenu() { 
	_options.clear();
	_selected = -1;
    _id = IDManager::instance()->getPickID();
    fillCol(Color4D ( 0.8, 0.8, 1.0, 0.5 ) );
    lineCol(Color4D ( 0,0,0,1.0) ) ;
}
예제 #2
0
    void Render( int realX, int realY, bool highlighted, bool clicked )
    {
        //
        // Background

        Colour background = g_styleTable->GetPrimaryColour(STYLE_INPUT_BACKGROUND);
        Colour borderA = g_styleTable->GetPrimaryColour(STYLE_INPUT_BORDER);
        Colour borderB = g_styleTable->GetSecondaryColour(STYLE_INPUT_BORDER);

        g_renderer->RectFill    ( realX, realY, m_w, m_h, background );
        g_renderer->Line        ( realX, realY, realX + m_w, realY, borderA );
        g_renderer->Line        ( realX, realY, realX, realY + m_h, borderA );
        g_renderer->Line        ( realX + m_w, realY, realX + m_w, realY + m_h, borderB );
        g_renderer->Line        ( realX, realY + m_h, realX + m_w, realY + m_h, borderB );

        //
        // Caption

        g_renderer->SetFont( "lucon" );

        strncpy(m_buf, m_string, sizeof(m_buf) - 1);
        strupr( m_buf );

        float fontSize = 20;
        //float textWidth = g_renderer->TextWidth(m_buf, fontSize);
        //float fieldX = realX + m_w/2 - textWidth/2;
        //float yPos = realY + m_h/2 - fontSize/2;

        //g_renderer->TextSimple( fieldX, yPos, White, fontSize, m_buf );

        float xPos = realX + 5;
        float yPos = realY + 5;
        bool authKeyFound = (stricmp( m_buf, "authkey not found" ) != 0);

        for( int i = 0; i < AUTHENTICATION_KEYLEN-1; ++i )
        {
            if( authKeyFound )
            {
                char thisChar = ' ';
                if( i < strlen(m_buf) )
                {
                    thisChar = m_buf[i];
                }

                g_renderer->Text( xPos, yPos, White, fontSize, "%c", thisChar );
            }

            Colour lineCol(255,255,255,20);
            if( i % 7 >= 5 ) lineCol.m_a = 100;
            g_renderer->Line( xPos+16, realY+1, xPos+16, realY+m_h-1, lineCol );

            xPos += fontSize * 1.0f;
        }
        
        g_renderer->SetFont();


        //
        // Cursor

        if (m_parent->m_currentTextEdit && 
            strcmp(m_parent->m_currentTextEdit, m_name) == 0 )
        {
            if (fmodf(GetHighResTime(), 1.0f) < 0.5f ||
                GetHighResTime() < m_lastKeyPressTimer+1.0f )
            {
                float cursorX = realX + 5 + strlen(m_buf) * fontSize;
                g_renderer->RectFill( cursorX, realY + 5, 10, 20, White );
            }
        }


        g_renderer->Rect( realX, realY, m_w, m_h, Colour(255,255,255,10) );
    }