Ejemplo n.º 1
0
void CUIImageSplit::OnRender( CDrawPort* pDraw )
{
	if( m_bHide == TRUE )
		return;

	if( m_pTexData == NULL )
	{
#ifdef UI_TOOL
		RenderBorder(pDraw);
#endif // UI_TOOL
		return;
	}

	pDraw->InitTextureData( m_pTexData );

	int	nX, nY;
	GetAbsPos( nX, nY );

	if (_pSurface != NULL)
	{
		_pSurface->SetPos(nX, nY);
		_pSurface->RenderRectSurface(pDraw, m_color);
	}

	pDraw->FlushRenderingQueue();
#ifdef UI_TOOL
	RenderBorder(pDraw);
#endif // UI_TOOL
}
Ejemplo n.º 2
0
void UILabel::Draw(float xo, float yo ) {
	if (visible) {
				
		UIPos pos  = GetParentPos();
		pos.x += xo;
		pos.y += yo;
		
		if(display_border) {
			RenderBorder();
		}
		
		if (overflow) {
			font.DrawTextb(text.c_str(), pos.x, pos.y + char_height, font_color[kNone].r, font_color[kNone].g, font_color[kNone].b, 0);
		} else {
			string fixed_text = text;
			int len = text.length();
			int fixed_len = (int)rect.w / char_width;
			if (len > fixed_len) {
				fixed_text = text.substr(0, fixed_len);
			}
			font.DrawTextb(fixed_text.c_str(), pos.x, pos.y + char_height, font_color[kNone].r, font_color[kNone].g, font_color[kNone].b, 0);
		}
				
	}
}
Ejemplo n.º 3
0
void CUITextBox::OnRender( CDrawPort* pDraw )
{
	if( m_bHide == TRUE )
		return;

	int		nX, nY;
	GetAbsPos( nX, nY );

	if (m_pTexData != NULL && m_pBackground != NULL)
	{
		pDraw->InitTextureData( m_pTexData );

		m_pBackground->SetPos(nX, nY);
		m_pBackground->RenderRectSurface( pDraw, DEF_UI_COLOR_WHITE );

		pDraw->FlushRenderingQueue();
	}

	if ( m_pScroll )
		m_pScroll->OnRender( pDraw );

	_RenderString(pDraw, nX, nY);

#ifdef UI_TOOL
	RenderBorder(pDraw);
#endif // UI_TOOL
}
Ejemplo n.º 4
0
Size HotKeyInputWindow::RenderContent(Renderer* renderer)
{
    RenderBorder(renderer);

    int textOffset = borderWidth + padding;
    int fontAscent = GetFont()->GetAscent();

    if (currentHotkey == 0)
    {
        currentTextPoistion = Point(textOffset, textOffset);
        renderer->PrintText(
            L"Not assigned",
            GetFont(),
            Colors::Gray,
            Point(textOffset, fontAscent + textOffset));
    }
    else
    {
        currentTextPoistion = renderer->PrintText(
            GetHotkeyDisplayString().c_str(),
            GetFont(),
            Colors::Black,
            RenderPosition(textOffset, fontAscent + textOffset));
    }

    return renderer->GetSize();
}
Ejemplo n.º 5
0
void CUITree::Render( CDrawPort* pDraw )
{
	// tree 의 경우 child scroll 때문에 Hide 검사 건너 뜀
	RenderChild(pDraw);

#ifdef UI_TOOL
	RenderBorder(pDraw);
#endif // UI_TOOL
}
Ejemplo n.º 6
0
void CUIBase::Render(CDrawPort* pDraw)
{
    if (m_bHide == TRUE)
        return;

    OnRender(pDraw);
    RenderChild(pDraw);
    OnPostRender(pDraw);	// Child를 그리고, 추가로 그릴게 있을 경우

#ifdef UI_TOOL
    RenderBorder(pDraw);
#endif // UI_TOOL
}
    void Render( int realX, int realY, bool highlighted, bool clicked )
    {
        LandscapeGuideGridWindow *parent = (LandscapeGuideGridWindow *) m_parent;
        LandscapeTile *def = parent->m_tileDef;

        if( def->m_guideGrid )
        {
            RenderColours   ( realX, realY, highlighted, clicked );
            RenderGrid      ( realX, realY, highlighted, clicked );
            RenderBorder    ( realX, realY, highlighted, clicked );
            RenderMouse     ( realX, realY, highlighted, clicked );

            HandleMouseInput();
        }
    }
Ejemplo n.º 8
0
void CUIImageArray::OnRender( CDrawPort* pDraw )
{
    if (m_bHide == TRUE)
        return;

    if (m_pTexData == NULL)
    {
#ifdef UI_TOOL
        RenderBorder(pDraw);
#endif // UI_TOOL
        return;
    }

    if (m_bDepthMode == TRUE)
        pDraw->InitTextureData( m_pTexData, FALSE, PBT_BLEND, TRUE );
    else
        pDraw->InitTextureData( m_pTexData);

    if (m_nRenderIdx >= 0 && m_nRenderIdx < m_vecData.size())
    {
        UIRect rc = m_vecData[m_nRenderIdx].rc;
        UIRectUV uv = m_vecData[m_nRenderIdx].uv;

        int	nX, nY;
        GetAbsPos( nX, nY );

        pDraw->AddTexture( nX + rc.Left, nY + rc.Top, nX + rc.Left + rc.Right, nY + rc.Top + rc.Bottom,
                           uv.U0, uv.V0, uv.U1, uv.V1, m_color, m_fDepth );

        pDraw->FlushRenderingQueue();
    }

#ifdef UI_TOOL
    RenderBorder(pDraw);
#endif // UI_TOOL
}
Ejemplo n.º 9
0
/*
########  ######## ##    ## ########  ######## ########  
##     ## ##       ###   ## ##     ## ##       ##     ## 
##     ## ##       ####  ## ##     ## ##       ##     ## 
########  ######   ## ## ## ##     ## ######   ########  
##   ##   ##       ##  #### ##     ## ##       ##   ##   
##    ##  ##       ##   ### ##     ## ##       ##    ##  
##     ## ######## ##    ## ########  ######## ##     ## 
*/
void SpaceInvadersState::Render(RenderState* renderState)
{
	// Apply the camera transformation
	ApplyCamera(renderState);

	Shader *shader = shaderMan->GetShader(SHADER_NORMAL);

    // Apply renderState settings
    //renderState->renderAABB = this->renderAABB;
    //renderState->renderOutline = this->renderOutline;

    // Render the grid
	if(renderGrid)
		RenderGrid(renderState);
    // Render the border
	if(renderBorder)
		RenderBorder(renderState);

	glUseProgram(shader->program);
    
    /*RigidBody **objects = physics->GetObjects();
    int amountObjects = physics->AmountObjects();
    for(int i = 0; i < amountObjects; ++i){
        if(objects[i])
            objects[i]->Render(renderState);
    }*/
    
    // Render Spaceship
    if(spaceship)
    	RenderSpaceShip(renderState);

	//PrintSentence(renderState, "Made by Blankycan", Vector2f(1.5f * 16.f * (float)windowState->GetWindow()->GetXPixel(), -4.5f * 16.f * (float)windowState->GetWindow()->GetYPixel()));

    
	glUseProgram(shader->program);
   
   
	glUseProgram(0);
}
Ejemplo n.º 10
0
void UITextbox::Render() {
	
	if (!visible) {
		return;
	}
	
	UIPos pos = GetParentPos();
	float x =  pos.x;
	float y =   pos.y;
	
	RenderBg();
	
	if(gCarot == this) {
		glLineWidth(2.0f);
		//glColor3ub(36,36,36);
		glColor3ub(border_color[state].r,border_color[state].g,border_color[state].b);
		glBegin(GL_LINE_LOOP);
		glVertex2f(x + rect.w, y);
		glVertex2f(x, y);
		glVertex2f(x, y + rect.h);
		glVertex2f(x + rect.w, y + rect.h );
		glEnd();
	}
	RenderBorder();
	
	
	//Render Text
	string fixed_text = text;
	int len = text.length();
	int fixed_len = (int)(rect.w - padding*2) / char_width;
	if (len > fixed_len) {
		int start = len - fixed_len;
		fixed_text = text.substr(start, fixed_len);
	}
	font.DrawTextb(fixed_text.c_str(), pos.x + padding, pos.y + char_height, font_color[kNone].r, font_color[kNone].g, font_color[kNone].b, 0);
	
}
Ejemplo n.º 11
0
void UIListbox::Render() {
	if (!visible) {
		return;
	}
	
	RenderBg();
	RenderBorder();
	UIPos pos = GetParentPos();
	
	//Render selected background
	
	//Render each item
	for (int i = 0; i < view_count; ++i) {
		float x = pos.x;
		float y = pos.y + (i * item_height);
		int index = view_pos + i;
		if (index < items.size()) {
			if (selected_index == index  && !chat_mode) {
				
				float local_y = pos.y + (( selected_index - view_pos) * item_height);
				glColor3ub (selected_bg.r,selected_bg.g,selected_bg.b);
				glBegin(GL_QUADS);
				glVertex2f(x  + rect.w - 1, local_y + 1);
				glVertex2f(x + 2, local_y + 1);
				glVertex2f(x + 2, local_y + item_height - 1);
				glVertex2f(x + rect.w - 1, local_y + item_height - 1);
				glEnd();
			}
		
			std::string text = (items[index].length() > max_chars) ? items[index].substr(0,max_chars) : items[index];
			float textOffset = 0;
			if (icons[index] != NULL) {
				textOffset = 20;
				
				icons[index]->bindTexture();
				glEnable(GL_TEXTURE_2D);
				glBegin(GL_QUADS);
				glColor3f(1.0f, 1.0f, 1.0f);
				float iconx, icony, iconw;
				iconx = x + 1;
				icony = y ;
				iconw = 15;
				glTexCoord2f(1.0f, 1.0f); glVertex3f(iconx  + iconw , icony ,0.0f);
				glTexCoord2f(0.0f, 1.0f); glVertex3f(iconx , icony ,0.0f);
				glTexCoord2f(0.0f, 0.0f); glVertex3f(iconx , icony +iconw ,0.0f);
				glTexCoord2f(1.0f, 0.0f);glVertex3f(iconx + iconw , icony + iconw ,0.0f);
				
				glEnd();	
				glDisable(GL_TEXTURE_2D);
			
			}

			// Instead of using font_color, we use the color stored in the row of the element.
			// So we can have multicolored line chat boxes if we want.
			// font_color is the default if you add an item without a color though.
			font.DrawTextb(text.c_str(), x + 1 + textOffset,y + char_height, colors[index].r, colors[index].g, colors[index].b, 0);
		}
	}
	
	//Render the scrollbar
	if (items.size() > view_count) {
		
		//Render top box
		float x = upbox.x + pos.x;
		float y = upbox.y + pos.y;
		
		//Background
		glColor3ub (button_color.r,button_color.g,button_color.b);
		glBegin(GL_QUADS);
		glVertex2f(x  + upbox.w , y);
		glVertex2f(x , y );
		glVertex2f(x , y + upbox.h);
		glVertex2f(x + upbox.w, y + upbox.h);
		glEnd();
		
		//Border
		glColor3ub (border_color[kNone].r,border_color[kNone].g,border_color[kNone].b);
		glBegin(GL_LINE_LOOP);
		glVertex2f(x  + upbox.w , y);
		glVertex2f(x , y );
		glVertex2f(x , y + upbox.h);
		glVertex2f(x + upbox.w, y + upbox.h);
		glEnd();
		
		//Triangle
		
		glColor3ub (39,39,39);
		glBegin(GL_TRIANGLES);
		glVertex2f(x  + tri_offsetx + tri_length/2  , y + tri_offsety);
		glVertex2f(x + tri_offsetx , y + tri_length + tri_offsety);
		glVertex2f(x +tri_offsetx + tri_length, y + tri_offsety + tri_length);
		glEnd();
		
		//======================================================
		//Render bottom box
		x = downbox.x + pos.x;
		y = downbox.y + pos.y;
		
		//Background
		glColor3ub (button_color.r,button_color.g,button_color.b);
		glBegin(GL_QUADS);
		glVertex2f(x  + downbox.w , y);
		glVertex2f(x , y );
		glVertex2f(x , y + downbox.h);
		glVertex2f(x + downbox.w, y + downbox.h);
		glEnd();
		
		//Border
		glColor3ub (border_color[kNone].r,border_color[kNone].g,border_color[kNone].b);
		glBegin(GL_LINE_LOOP);
		glVertex2f(x  + downbox.w , y);
		glVertex2f(x , y );
		glVertex2f(x , y + downbox.h);
		glVertex2f(x + downbox.w, y + downbox.h);
		glEnd();
		
		
		//Triangle
		
		glColor3ub (39,39,39);
		glBegin(GL_TRIANGLES);
		glVertex2f(x  + tri_offsetx + tri_length/2  , y + tri_offsety + tri_length);
		glVertex2f(x + tri_offsetx , y + tri_offsety);
		glVertex2f(x +tri_offsetx + tri_length, y + tri_offsety);
		glEnd();
		
		//draw bar
		glColor3ub (39,39,39);
		glBegin(GL_QUADS);
		glVertex2f(bar.x  + bar.w + pos.x , bar.y + pos.y);
		glVertex2f(bar.x + pos.x , bar.y + pos.y );
		glVertex2f(bar.x  + pos.x, bar.y + bar.h + pos.y);
		glVertex2f(bar.x + bar.w + pos.x, bar.y + bar.h + pos.y);
		glEnd();
		
		
		//draw slider box
		total_views = (int)items.size() - view_count;
		if ( total_views < 0 ) {
			total_views = 0;
		}
		total_views++; //Add one so if we have 1 view change, we have 2 spots
		float box_height = bar.h / total_views;
		if ( box_height < 1.0f ) {
			box_height = 1.0f;
		}
		UIPos box_pos = UIPos(bar.x, bar.y + (view_pos *box_height));
		float width = bar.w + 0.5f;
		
		glColor3ub (219,219,219);
		glBegin(GL_QUADS);
		glVertex2f(box_pos.x  + width + pos.x -1 , box_pos.y + pos.y);
		glVertex2f(box_pos.x + pos.x , box_pos.y + pos.y );
		glVertex2f(box_pos.x  + pos.x, box_pos.y + box_height + pos.y);
		glVertex2f(box_pos.x +width + pos.x -1, box_pos.y + box_height + pos.y);
		glEnd();
		
	}
	
}
Ejemplo n.º 12
0
void CUICheckButton::OnRender( CDrawPort* pDraw )
{
	if( m_pTexData == NULL )
	{
#ifdef UI_TOOL
		RenderBorder(pDraw);
#endif // UI_TOOL
		return;
	}

	// Add render regions
	int	nUVIndex;
	if( m_bChecked )
		nUVIndex = UCBS_CHECK;
	else
		nUVIndex = UCBS_NONE;

	// Get position
	int	nX, nY;
	GetAbsPos( nX, nY );

	pDraw->InitTextureData( m_pTexData );

	pDraw->AddTexture( nX, nY, nX + m_nWidth, nY + m_nHeight,
		m_rtUV[nUVIndex].U0, m_rtUV[nUVIndex].V0,
		m_rtUV[nUVIndex].U1, m_rtUV[nUVIndex].V1,
		0xFFFFFFFF );

	pDraw->FlushRenderingQueue();

	if (m_bHighlightOn == true)
	{
		pDraw->InitTextureData(m_pTexData, FALSE, PBT_ADD);
		
		pDraw->AddTexture( nX, nY, nX + m_nWidth, nY + m_nHeight,
			m_rtUV[nUVIndex].U0, m_rtUV[nUVIndex].V0,
			m_rtUV[nUVIndex].U1, m_rtUV[nUVIndex].V1,
			m_colHighlight );

		pDraw->FlushRenderingQueue();
	}

	int		outX = 0;

	if(m_bValidText)
	{
		if (m_eAlignText_h == eALIGN_H_CENTER)
		{
			int str_width = pDraw->GetTextWidth2(m_strText);
			outX += (m_nTextArea - str_width) / 2;
		}
		else if (m_eAlignText_h == eALIGN_H_RIGHT)
		{
			int str_width = pDraw->GetTextWidth2(m_strText);
			outX = m_nTextArea - str_width;
		}	

		if (m_bTextEdge == true)
		{
			pDraw->PutTextEx( m_strText, nX + m_nTextSX + outX-1, nY + m_nTextSY-1, DEF_UI_FONT_SHADOW_COLOR );
			pDraw->PutTextEx( m_strText, nX + m_nTextSX + outX+1, nY + m_nTextSY-1, DEF_UI_FONT_SHADOW_COLOR );
			pDraw->PutTextEx( m_strText, nX + m_nTextSX + outX+1, nY + m_nTextSY+1, DEF_UI_FONT_SHADOW_COLOR );
			pDraw->PutTextEx( m_strText, nX + m_nTextSX + outX-1, nY + m_nTextSY+1, DEF_UI_FONT_SHADOW_COLOR );
		}

		pDraw->PutTextEx( m_strText, nX + m_nTextSX + outX, nY + m_nTextSY, m_colText[nUVIndex] );

		pDraw->EndTextEx();
	}	
#ifdef UI_TOOL
	RenderBorder(pDraw);

	// Text Area
	if (m_bSelect)
		pDraw->DrawBorder( (PIX)(nX + m_nTextSX - 1), (PIX)(nY - 1), (PIX)m_nTextArea+1, (PIX)m_nHeight+1, 0xFFB90FFF );
#endif // UI_TOOL
}
Ejemplo n.º 13
0
void HUD::RenderHud(int i, int j){
    RenderBorder(i, j);
}
Ejemplo n.º 14
0
void CUIText::OnRender( CDrawPort* pDraw )
{
    if( m_bHide == TRUE )
        return;

    int		nX, nY;
    GetAbsPos( nX, nY );

    if (m_pTexData != NULL)
    {
        if (m_pBackground != NULL)
        {
            pDraw->InitTextureData( m_pTexData );

            m_pBackground->SetPos(nX, nY);
            m_pBackground->RenderRectSurface( pDraw, DEF_UI_COLOR_WHITE );

            pDraw->FlushRenderingQueue();
        }
    }

    int		outX = nX;

    if (m_eAlignText_h == eALIGN_H_CENTER)
    {
        int str_width = pDraw->GetTextWidth2(m_strView);
        outX += (m_nWidth - str_width) / 2;
    }
    else if (m_eAlignText_h == eALIGN_H_RIGHT)
    {
        int str_width = pDraw->GetTextWidth2(m_strView);
        outX = outX + m_nWidth - str_width;
    }

    if (m_vecData.size() <= 0)
    {
        if (m_bShadow == FALSE && m_bEdge == TRUE)
        {
            pDraw->PutTextEx( m_strView, outX-1, nY-1, m_colShadow, m_fZ );
            pDraw->PutTextEx( m_strView, outX+1, nY-1, m_colShadow, m_fZ );
            pDraw->PutTextEx( m_strView, outX+1, nY+1, m_colShadow, m_fZ );
            pDraw->PutTextEx( m_strView, outX-1, nY+1, m_colShadow, m_fZ );
        }

        pDraw->PutTextEx( m_strView, outX, nY, m_color, m_fZ, m_bShadow, m_colShadow );
    }
    else
    {
        CTString str;
        COLOR col;

        for (int i = 0; i < m_vecData.size(); ++i)
        {
            str = m_vecData[i].str.c_str();
            col = m_vecData[i].col;

            if (i > 0)
                outX += pDraw->GetTextWidth2(m_vecData[i - 1].str.c_str());

            if (m_bShadow == FALSE && m_bEdge == TRUE)
            {
                pDraw->PutTextEx( str, outX-1, nY-1, m_colShadow, m_fZ );
                pDraw->PutTextEx( str, outX+1, nY-1, m_colShadow, m_fZ );
                pDraw->PutTextEx( str, outX+1, nY+1, m_colShadow, m_fZ );
                pDraw->PutTextEx( str, outX-1, nY+1, m_colShadow, m_fZ );
            }

            pDraw->PutTextEx( str, outX, nY, col, m_fZ, m_bShadow, m_colShadow );
        }
    }

    pDraw->EndTextEx();
#ifdef UI_TOOL
    RenderBorder(pDraw);
#endif // UI_TOOL
}