Ejemplo n.º 1
1
void RingDragger::Drag(int xMouse,int yMouse)
{
	EraseRect(xMouse,yMouse);
	DrawRect(m_width);
}
Ejemplo n.º 2
0
void CDDrawRecord::ClearScreen(DWORD color)
{
	DrawRect(color, NULL, lpDDSBack);
}
Ejemplo n.º 3
0
void AeroControlBase::DrawFocusRect(LPRECT prcFocus, HDC hdcPaint)
{
    DrawRect(prcFocus, hdcPaint, DashStyleDot, Color(0xFF, 0,0,0), 1.0);
}
Ejemplo n.º 4
0
 Drawing drawRect( const QPen & pen, const QBrush & brush, const QRectF & rect )
 {
     return DrawRect( pen, brush, rect );
 }
Ejemplo n.º 5
0
void FormView::Paint(Draw& w)
{
	if (!IsLayout())
	{
		w.DrawRect(GetRect(), White());
		return;
	}

	Rect r = Zoom(GetPageRect());

	DrawGrid(w);
	DrawRect(w, r, 1, LtBlue());

	w.DrawRect(0, 0, r.left, 3000, White());
	w.DrawRect(r.right + 1, 0, 3000, 3000, White());
	w.DrawRect(r.left, 0, 5000, r.top, White());
	w.DrawRect(r.left, r.bottom + 1, 3000, 3000, White());

//	if (_showInfo)
//	{
//		r.SetSize( Zoom(Size(804, 604)) );
//		DrawRect(w, r.Offseted( Zoom(Size(-2, -2)) ), 1, LtMagenta());
//		r = Zoom(GetPageRect());
//	}

	if (GetObjectCount() > 0 && _showInfo == 2)
	{
		Rect b = Zoom(GetObjectsRect()).Offseted(1, 1);
		b.SetSize( b.GetSize() + Size(-2, -2) );
		DrawRect(w, b, 1, Yellow());
	}

	Vector<int> sel = GetSelected();

	bool coloring = GetBool("View.Coloring");
	int ci = 0;
	if (sel.GetCount() > 0)
	{
		if (sel.GetCount() == 1)
		{
			for (int i = 0; i < GetObjectCount(); ++i)
			{
				if (ci++ == _colors.GetCount() - 1) ci = 0;

				if (coloring && i != sel[0])
					DrawObject(w, i, _colors[ci], false);
				else
					DrawObject(w, i, (!coloring && (i == sel[0])) ? _colors[ci] : LtGray(),
						i == sel[0]);
			}
		}
		else
		{
			for (int i = 0; i < GetObjectCount(); ++i)
			{
				if (ci++ == _colors.GetCount() - 1) ci = 0;

				bool found = false;
				for (int j = 0; j < sel.GetCount(); ++j)
					if ( i == sel[j])
					{
						found = true;
						break;
					}
				if (coloring && !found)
					DrawObject(w, i, _colors[ci], false);
				else
					DrawObject(w, i, (!coloring && found) ? _colors[ci] : LtGray(), false);
			}

			Size g = GetGridSize();
			Rect s = GetSelectionRect().Offseted(-g.cx / 2, -g.cy / 2);
			s.SetSize(s.GetSize() + Size(g.cx, g.cy));

			Vector<int> sel = GetSelected();

			bool a1 = true;	// allow horz align
			bool a2 = true;	// allow vert align
			dword f1;		// first horz align
			dword f2;		// first vert align
	
			for (int i = 0; i < sel.GetCount(); ++i)
			{
				FormObject *pI = GetObject(sel[i]);
				if (!pI) continue;

				if (i == 0) { f1 = pI->GetHAlign(); f2 = pI->GetVAlign(); }

				if (f1 != pI->GetHAlign()) { a1 = false; }
				if (f2 != pI->GetVAlign()) { a2 = false; }
			}

			DrawSprings(w, Zoom(s), f1, f2, a1, a2, a1, a2, false);
			DrawRect(w, Zoom(s), 1, LtRed());

			s = GetSelectionRect().Offseted(-g.cx, -g.cy);
			s.SetSize(s.GetSize() + Size(g.cx * 2, g.cy * 2));

			DrawGroupTools(w, Zoom(s));
		}
		return;
	}

	for (int i = 0; i < GetObjectCount(); ++i)
	{
		if (ci++ == _colors.GetCount() - 1) ci = 0;
		DrawObject(w, i, coloring ? _colors[ci] : LtGray());
	}

	if (sel.GetCount() == 0)
		w.DrawImage(r.right, r.bottom, FormViewImg::SizerBR());
}
Ejemplo n.º 6
0
bool GUIFillRect( gui_window *wnd, gui_rect *rect, gui_attr attr )
{
    return( DrawRect( wnd, rect, attr, true, false, DRAW( BLOCK ) ) );
}
//---------------------------------------------------------------------------
void    TRForm::HandleSelRect(int   X ,int  Y)
{
    TPoint  temp(X ,Y);
    temp -= leftDownPt;
    switch(Image1->Cursor)
    {
    case TCursor(crSizeAll_): // crSizeAll
    {
        DrawRect(originPt, movePt, pmNotXor);
        //DrawRect(Point(selectedRt.left,selectedRt.top) ,
        //         Point(selectedRt.right,selectedRt.bottom) , pmNotXor);
        // 重新构造originPt movePt,左上角,右下角
        originPt = TPoint(selectedRt.left,selectedRt.top);
        originPt += temp;
        movePt = TPoint(selectedRt.right,selectedRt.bottom);
        movePt += temp;
        DrawRect(originPt, movePt, pmNotXor);
        break;
    }
    case TCursor(crSizeNWSE_): //crSizeNWSE
    {
        if(selectdPos==epLeftUp)
        {
            //ShowMessage("selectdPos==epLeftUp");
            DrawRect(originPt, movePt, pmNotXor);
            originPt = TPoint(selectedRt.right,selectedRt.bottom);
            movePt = TPoint(selectedRt.left,selectedRt.top);
            movePt += temp;
            DrawRect(originPt, movePt, pmNotXor);
        }
        else
        {
            DrawRect(originPt, movePt, pmNotXor);
            originPt = TPoint(selectedRt.left,selectedRt.top);
            movePt = TPoint(selectedRt.right,selectedRt.bottom);
            movePt += temp;
            DrawRect(originPt, movePt, pmNotXor);
        }
        break;
    }
    case TCursor(crSizeNESW_): // crSizeNESW
    {
        if(selectdPos==epLeftDown)
        {
            //ShowMessage("selectdPos==epLeftUp");
            DrawRect(originPt, movePt, pmNotXor);
            originPt = TPoint(selectedRt.right,selectedRt.top);
            movePt = TPoint(selectedRt.left,selectedRt.bottom);
            movePt += temp;
            DrawRect(originPt, movePt, pmNotXor);
        }
        else
        {
            DrawRect(originPt, movePt, pmNotXor);
            originPt = TPoint(selectedRt.left,selectedRt.bottom);
            movePt = TPoint(selectedRt.right,selectedRt.top);
            movePt += temp;
            DrawRect(originPt, movePt, pmNotXor);
        }
        break;
    }
    case crCross:
    {
        /*------ */
        break;
    }
    case TCursor(crCursor_):
        break;
    default :
        break;
    }
}
Ejemplo n.º 8
0
void MyApp::DrawSingleMode()
{
	FvRobotClientAppPtr spApp = FvRobotMainApp::Instance().GetRobotInSingleMode();

	int lineStart(LINE_START);
	int lineStep(LINE_STEP);

	//! 显示地图信息
	DrawString(0, lineStart, CLR_WHITE, "-------Single Mode-------");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowHelpInfo: H");
	lineStart += lineStep;
	if(!spApp)
	{
		DrawString(0, lineStart, CLR_WHITE, "Err: No Selected Robot");
		lineStart += lineStep;
		return;
	}
	if(1)
	{
		DrawString(0, lineStart, CLR_WHITE, "ServerTime:%.1f", spApp->GetServerConnection()->ServerTime());
		lineStart += lineStep;

		DrawString(0, lineStart, CLR_WHITE, "ServerToDScaling:%.2f,ServerToD:%.2f", spApp->GetToDScaling(), spApp->GetToD());
		lineStart += lineStep;

		DrawString(0, lineStart, CLR_WHITE, "SpaceID:%d, Type:%d, RobotID:%d", spApp->SpaceID(), spApp->SpaceType(), spApp->RobotID());
		lineStart += lineStep;

		//! 显示Space
		const FvRobotMainApp::SpaceInfo* pkSpaceInfo = FvRobotMainApp::Instance().FindSpaceInfo(spApp->SpaceType());
		if(!pkSpaceInfo)
		{
			DrawString(0, lineStart, CLR_WHITE, "Err:No Space Info");
			lineStart += lineStep;
			return;
		}
		else
		{
			if(m_bResetWindow4Space)
			{
				m_bResetWindow4Space = false;
				SetWindowFit2Rect(pkSpaceInfo->kSpaceRect);
			}

			for(int i=0; i<(int)pkSpaceInfo->kCells.size(); ++i)
			{
				DrawRect(pkSpaceInfo->kCells[i], CLR_YELLOW);
			}
			DrawRect(pkSpaceInfo->kSpaceRect, CLR_YELLOW);
		}

		//! 显示实体
		if(1)
		{
			const FvRobotClientApp::EntityMap& kEntityMap = spApp->GetEntityMap();
			//! 显示实体数量
			DrawString(0, lineStart, CLR_WHITE, "Entities:%d", kEntityMap.size());
			lineStart += lineStep;
			FvRobotClientApp::EntityMap::const_iterator itrB = kEntityMap.begin();
			FvRobotClientApp::EntityMap::const_iterator itrE = kEntityMap.end();
			while(itrB != itrE)
			{
				FvEntity* pkEntity = itrB->second;
				p2Clr clr;
				const FvVector3& p3 = pkEntity->GetPos();
				FvVector2 p2(p3.x, p3.y);
				int x,y;
				char charID[32] = {0};
				char robotID[32] = {0};
				char charPos[64] = {0};
				bool bConvertPos(false);
				if(m_bShowEntityID)
				{
					bConvertPos = true;
					sprintf(charID, "%d", pkEntity->GetEntityID());
				}
				if(m_bShowRobotID)
				{
					bConvertPos = true;
					sprintf(robotID, "%d", pkEntity->GetRobotID());
				}
				if(m_bShowEntityPos)
				{
					bConvertPos = true;
					sprintf(charPos, "%.2f,%.2f,%.2f", p3.x, p3.y, p3.z);
				}
				if(bConvertPos)
				{
					ConvertWorldToScreen(p2, x, y);
				}

				if(pkEntity->IsCtrler())//! ctrler
				{
					clr = CLR_RED;
					DrawPoint(p3, clr);
					if(m_bShowEntityID)
					{
						DrawString(x, y, clr, charID);
					}
					if(m_bShowRobotID)
					{
						DrawString(x, y-lineStep, clr, robotID);
					}
					if(m_bShowEntityPos)
					{
						DrawString(x, y+lineStep, clr, charPos);
					}
				}
				else//! others
				{
					clr = CLR_BLUE;
					DrawPoint(p3, clr);
					if(m_bShowEntityID)
					{
						DrawString(x, y, clr, charID);
					}
					if(m_bShowEntityPos)
					{
						DrawString(x, y+lineStep, clr, charPos);
					}
				}

				//! 显示非Ctrler实体的属性,测试Lod
				if(m_bShowEntityProp)
				{
/**
					FvEntity* pkOther = pkEntity;
					DrawString(0, lineStart, CLR_WHITE, "-------------");
					lineStart += lineStep;
					DrawString(0, lineStart, CLR_WHITE, "Entity:%d", pkOther->GetEntityID());
					lineStart += lineStep;
					const FvEntityDescription* pkEntityDes = pkOther->GetEntityDes();
					FvUInt32 cnt = pkEntityDes->PropertyCount();
					for(FvUInt32 i=0; i<cnt; ++i)
					{
						FvDataDescription* pkDataDes = pkEntityDes->Property(i);
						FvObjPtr spObj = pkOther->FindProperty(i);
						if(!spObj)
							continue;
						switch(spObj->RTTI())
						{
						case FVOBJ_RTTI_INT8:
							{
								FvInt8 v = FVOBJ_GETVAL(spObj, FvObjInt8);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_UINT8:
							{
								FvUInt8 v = FVOBJ_GETVAL(spObj, FvObjUInt8);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_INT16:
							{
								FvInt16 v = FVOBJ_GETVAL(spObj, FvObjInt16);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_UINT16:
							{
								FvUInt16 v = FVOBJ_GETVAL(spObj, FvObjUInt16);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_INT32:
							{
								FvInt32 v = FVOBJ_GETVAL(spObj, FvObjInt32);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_UINT32:
							{
								FvUInt32 v = FVOBJ_GETVAL(spObj, FvObjUInt32);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_INT64:
							{
								FvInt64 v = FVOBJ_GETVAL(spObj, FvObjInt64);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%I64d", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_UINT64:
							{
								FvUInt64 v = FVOBJ_GETVAL(spObj, FvObjUInt64);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%I64u", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_FLOAT:
							{
								float v = FVOBJ_GETVAL(spObj, FvObjFloat);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%f", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_DOUBLE:
							{
								double v = FVOBJ_GETVAL(spObj, FvObjDouble);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%f", pkDataDes->Name().c_str(), v);
							}
							break;
						case FVOBJ_RTTI_STRING:
							{
								FvString v = FVOBJ_GETVAL(spObj, FvObjString);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%s", pkDataDes->Name().c_str(), v.c_str());
							}
							break;
						case FVOBJ_RTTI_MAILBOX:
							{
								FVOBJ_CONVERT_P(spObj, FvObjMailBox, pMB);
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%s", pkDataDes->Name().c_str(), pMB->c_str());
							}
							break;
						default:
							{
								DrawString(0, lineStart, CLR_WHITE, "PropName:%s", pkDataDes->Name().c_str());
							}
							break;
						}
						lineStart += lineStep;
					}
**/
				}

				++itrB;
			}
		}
	}
}
Ejemplo n.º 9
0
void TextInput::Draw( Rect area )
{
   FillRect( Bounds(), 0x888888 );
   DrawRect( Bounds(), 0x999999 );
   DrawString( 2,2, m_text, 0 );
}
Ejemplo n.º 10
0
void Car::Draw()
{
	Update();

	if (yDraw < (float)(y - 1) || yDraw >(float)(y + 1))
	{
		yDraw += ((float)y - yDraw) / 10.0f;
	}

	int yInt = (int)yDraw;

	if (mode == 'n' && y <= -200)
	{
		DrawRect(x, y, 122, 135, color.r, color.g, color.b);

		if (btnBubble->ClickedOnThisFrame() && gPause)
		{
			mode = 'w';
			chargeCurrent = 0.0;
			timeDue = gTime + addTime;
			active = false;
		}

		btnBubble->Draw();
	}
	else
	{
		active = true;

		//sprite->Draw(x, yInt);
		DrawRect(x, yInt, 122, 192, color.r, color.g, color.b);


		text->Draw(x + 5, yInt + 10, "Chrg:     " + std::to_string(((int)chargeCurrent)) + "%");
		text->Draw(x + 5, yInt + 25, "ChrgRate: " + std::to_string((int)(chargeRate*gFramesToSeconds)) + "ps");

		text->Draw(x + 5, yInt + 50, "TimeWait: " + SecondsToTime(waitTime));

		if (timeDue + GetChargeTime() >= gTime) text->Draw(x + 5, yInt + 80, "TimeToCh: " + ToTime(GetChargeTime()), 0, 150, 0);
		else									text->Draw(x + 5, yInt + 80, "TimeToCh: " + ToTime(GetChargeTime()), 150, 0, 0);

		if (timeDue >= gTime)	text->Draw(x + 5, yInt + 95, "TimeDue:  " + SecondsToTime(timeDue), 0, 225, 0);
		else					text->Draw(x + 5, yInt + 95, "TimeDue:  " + SecondsToTime(timeDue), 225, 0, 0);


		//text->Draw(x + 20, yInt + 30, "Max: " + std::to_string((int)(chargeMax)) + "kWh");
		//text->Draw(x + 20, yInt + 110, "Use: " + std::to_string((int)(chargeUse*100.0f)) + "pf");

		std::string bar = "";
		for (unsigned i = 0; i < (int)chargeCurrent; i += 10)
		{
			bar += "|";
		}

		text->Draw(x + 24, yInt + 140, bar, 0, 200, 0);

		if (gPause)
		{
			btnReturn->y = yInt + 160;
			btnReturn->Draw();
		}

		if (btnReturn->ClickedOnThisFrame() && gPause)
		{
			Reset();
		}

		if (gPause)
		{
			btnL1->y = yInt + 75;
			btnR1->y = yInt + 75;
			btnL2->y = yInt + 92;
			btnR2->y = yInt + 92;

			if (btnL1->Clicked())
			{
				if (GetChargeTime() > 0.01)
				{
					chargeRate += 0.0005;
				}
			}
			if (btnR1->Clicked())
			{
				if (chargeRate > 0.005)
				{
					chargeRate -= 0.0005;

					if (timeDue < gTime + GetMaxChargeTime() + 1)
					{
						addTime = GetMaxChargeTime() + 1;
						timeDue = gTime + addTime;
					}
				}
			}

			if (btnR2->Clicked())
			{
				addTime += 0.1;
				timeDue = gTime + addTime;
			}
			if (btnL2->Clicked())
			{
				if (timeDue > gTime + GetMaxChargeTime() + 1)
				{
					addTime -= 0.1;
					timeDue = gTime + addTime;
				}
			}

			btnL1->Draw();
			btnR1->Draw();
			btnL2->Draw();
			btnR2->Draw();
		}
	}
}
Ejemplo n.º 11
0
void MyApp::DrawGlobalMode()
{
	FvRobotMainApp::SpaceList& kSpaceList = FvRobotMainApp::pInstance()->GetSpaceList();
	FvRobotMainApp::SpaceEntityList& kSpaceEntityList = FvRobotMainApp::pInstance()->GetSpaceEntityList();

	int lineStart(LINE_START);
	int lineStep(LINE_STEP);

	//! 显示地图信息
	DrawString(0, lineStart, CLR_WHITE, "-------Global Mode-------");
	lineStart += lineStep;
	DrawString(0, lineStart, CLR_WHITE, "ShowHelpInfo: H");
	lineStart += lineStep;
	if(1)
	{
		int iCtrlers(0), iOthers(0);
		if(kSpaceEntityList.size())
		{
			FvRobotMainApp::SpaceEntity* pkSpaceEntity(NULL);
			if(m_iSpaceIdx >= (int)kSpaceEntityList.size())
			{
				m_bResetWindow4Space = true;
				m_iSpaceIdx = m_iSpaceIdx % kSpaceEntityList.size();
			}
			DrawString(0, lineStart, CLR_WHITE, "Spaces:%d,Idx:%d", kSpaceEntityList.size(), m_iSpaceIdx);
			lineStart += lineStep;
			int idx(0);
			FvRobotMainApp::SpaceEntityList::iterator itrB = kSpaceEntityList.begin();
			FvRobotMainApp::SpaceEntityList::iterator itrE = kSpaceEntityList.end();
			while(itrB != itrE)
			{
				if(idx == m_iSpaceIdx)
				{
					pkSpaceEntity = &(*itrB);
					break;
				}
				++itrB;
				++idx;
			}
			DrawString(0, lineStart, CLR_WHITE, "id:%d, type:%d", pkSpaceEntity->m_iSpaceID, pkSpaceEntity->m_uiSpaceType);
			lineStart += lineStep;

			//! 显示Space
			{
				const FvRobotMainApp::SpaceInfo* pkSpaceInfo = FvRobotMainApp::Instance().FindSpaceInfo(pkSpaceEntity->m_uiSpaceType);
				FV_ASSERT(pkSpaceInfo);
				if(m_bResetWindow4Space)
				{
					m_bResetWindow4Space = false;
					SetWindowFit2Rect(pkSpaceInfo->kSpaceRect);
				}

				for(int i=0; i<(int)pkSpaceInfo->kCells.size(); ++i)
				{
					DrawRect(pkSpaceInfo->kCells[i], CLR_YELLOW);
				}
				DrawRect(pkSpaceInfo->kSpaceRect, CLR_YELLOW);
			}

			//! 显示实体
			if(1)
			{
				FvRobotMainApp::Entities& kEntityMap = pkSpaceEntity->m_kEntities;
				//! 显示实体数量
				DrawString(0, lineStart, CLR_WHITE, "Entities:%d", kEntityMap.size());
				lineStart += lineStep;
				FvRobotMainApp::Entities::iterator itrB = kEntityMap.begin();
				FvRobotMainApp::Entities::iterator itrE = kEntityMap.end();
				while(itrB != itrE)
				{
					FvEntity* pkEntity = itrB->second;
					p2Clr clr;
					const FvVector3& p3 = pkEntity->GetPos();
					FvVector2 p2(p3.x, p3.y);
					int x,y;
					char charID[32] = {0};
					char robotID[32] = {0};
					char charPos[64] = {0};
					bool bConvertPos(false);
					if(m_bShowEntityID)
					{
						bConvertPos = true;
						sprintf(charID, "%d", pkEntity->GetEntityID());
					}
					if(m_bShowRobotID)
					{
						bConvertPos = true;
						sprintf(robotID, "%d", pkEntity->GetRobotID());
					}
					if(m_bShowEntityPos)
					{
						bConvertPos = true;
						sprintf(charPos, "%.2f,%.2f,%.2f", p3.x, p3.y, p3.z);
					}
					if(bConvertPos)
					{
						ConvertWorldToScreen(p2, x, y);
					}

					if(pkEntity->IsCtrler())//! ctrler
					{
						++iCtrlers;
						clr = CLR_RED;
						DrawPoint(p3, clr);
						if(m_bShowEntityID)
						{
							DrawString(x, y, clr, charID);
						}
						if(m_bShowRobotID)
						{
							DrawString(x, y-lineStep, clr, robotID);
						}
						if(m_bShowEntityPos)
						{
							DrawString(x, y+lineStep, clr, charPos);
						}
					}
					else//! others
					{
						++iOthers;
						clr = CLR_BLUE;
						DrawPoint(p3, clr);
						if(m_bShowEntityID)
						{
							DrawString(x, y, clr, charID);
						}
						if(m_bShowEntityPos)
						{
							DrawString(x, y+lineStep, clr, charPos);
						}
					}

					//! 显示非Ctrler实体的属性,测试Lod
					if(m_bShowEntityProp)
					{
/**
						FvEntity* pkOther = pkEntity;
						DrawString(0, lineStart, CLR_WHITE, "-------------");
						lineStart += lineStep;
						DrawString(0, lineStart, CLR_WHITE, "Entity:%d", pkOther->GetEntityID());
						lineStart += lineStep;
						const FvEntityDescription* pkEntityDes = pkOther->GetEntityDes();
						FvUInt32 cnt = pkEntityDes->PropertyCount();
						for(FvUInt32 i=0; i<cnt; ++i)
						{
							FvDataDescription* pkDataDes = pkEntityDes->Property(i);
							FvObjPtr spObj = pkOther->FindProperty(i);
							if(!spObj)
								continue;
							switch(spObj->RTTI())
							{
							case FVOBJ_RTTI_INT8:
								{
									FvInt8 v = FVOBJ_GETVAL(spObj, FvObjInt8);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_UINT8:
								{
									FvUInt8 v = FVOBJ_GETVAL(spObj, FvObjUInt8);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_INT16:
								{
									FvInt16 v = FVOBJ_GETVAL(spObj, FvObjInt16);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_UINT16:
								{
									FvUInt16 v = FVOBJ_GETVAL(spObj, FvObjUInt16);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_INT32:
								{
									FvInt32 v = FVOBJ_GETVAL(spObj, FvObjInt32);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_UINT32:
								{
									FvUInt32 v = FVOBJ_GETVAL(spObj, FvObjUInt32);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_INT64:
								{
									FvInt64 v = FVOBJ_GETVAL(spObj, FvObjInt64);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%I64d", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_UINT64:
								{
									FvUInt64 v = FVOBJ_GETVAL(spObj, FvObjUInt64);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%I64u", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_FLOAT:
								{
									float v = FVOBJ_GETVAL(spObj, FvObjFloat);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%f", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_DOUBLE:
								{
									double v = FVOBJ_GETVAL(spObj, FvObjDouble);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%f", pkDataDes->Name().c_str(), v);
								}
								break;
							case FVOBJ_RTTI_STRING:
								{
									FvString v = FVOBJ_GETVAL(spObj, FvObjString);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%s", pkDataDes->Name().c_str(), v.c_str());
								}
								break;
							case FVOBJ_RTTI_MAILBOX:
								{
									FVOBJ_CONVERT_P(spObj, FvObjMailBox, pMB);
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s,Val:%s", pkDataDes->Name().c_str(), pMB->c_str());
								}
								break;
							default:
								{
									DrawString(0, lineStart, CLR_WHITE, "PropName:%s", pkDataDes->Name().c_str());
								}
								break;
							}
							lineStart += lineStep;
						}
**/
					}

					++itrB;
				}
			}

			DrawString(0, lineStart, CLR_WHITE, "Ctrler:%d, Others:%d", iCtrlers, iOthers);
			lineStart += lineStep;
		}
		else
		{
			DrawString(0, lineStart, CLR_WHITE, "Spaces:%d,Idx:%d", 0, 0);
			lineStart += lineStep;
			DrawString(0, lineStart, CLR_WHITE, "Entities:%d", 0);
			lineStart += lineStep;
			DrawString(0, lineStart, CLR_WHITE, "Ctrler:%d, Others:%d", 0, 0);
			lineStart += lineStep;
		}
	}
}
NS_IMETHODIMP
nsThebesRenderingContext::DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
{
    DrawRect(nsRect(aX, aY, aWidth, aHeight));
    return NS_OK;
}
Ejemplo n.º 13
0
void Renderer::DrawRect(const Vector2D& lefttop, const Vector2D& rightbottom, float lineWidth) 
{ 
	DrawRect(Rect2D(lefttop, rightbottom), lineWidth); 
}
Ejemplo n.º 14
0
void Renderer::DrawRect(double left, double top, double width, double height, float lineWidth) 
{ 
	DrawRect(Rect2D(left, top, left + width, top + height), lineWidth); 
}
Ejemplo n.º 15
0
static SDL_bool
WatchJoystick(SDL_Joystick * joystick)
{
    SDL_Window *window = NULL;
    SDL_Renderer *screen = NULL;
    const char *name = NULL;
    SDL_bool retval = SDL_FALSE;
    SDL_bool done = SDL_FALSE;
    SDL_Event event;
    int i;

    /* Create a window to display joystick axis position */
    window = SDL_CreateWindow("Joystick Test", SDL_WINDOWPOS_CENTERED,
                              SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
                              SCREEN_HEIGHT, 0);
    if (window == NULL) {
        fprintf(stderr, "Couldn't create window: %s\n", SDL_GetError());
        return SDL_FALSE;
    }

    screen = SDL_CreateRenderer(window, -1, 0);
    if (screen == NULL) {
        fprintf(stderr, "Couldn't create renderer: %s\n", SDL_GetError());
        SDL_DestroyWindow(window);
        return SDL_FALSE;
    }

    SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
    SDL_RenderClear(screen);
    SDL_RenderPresent(screen);
    SDL_RaiseWindow(window);

    /* Print info about the joystick we are watching */
    name = SDL_JoystickName(joystick);
    printf("Watching joystick %d: (%s)\n", SDL_JoystickInstanceID(joystick),
           name ? name : "Unknown Joystick");
    printf("Joystick has %d axes, %d hats, %d balls, and %d buttons\n",
           SDL_JoystickNumAxes(joystick), SDL_JoystickNumHats(joystick),
           SDL_JoystickNumBalls(joystick), SDL_JoystickNumButtons(joystick));

    /* Loop, getting joystick events! */
    while (!done) {
        /* blank screen, set up for drawing this frame. */
        SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0x00, SDL_ALPHA_OPAQUE);
        SDL_RenderClear(screen);

        while (SDL_PollEvent(&event)) {
            switch (event.type) {
            case SDL_JOYAXISMOTION:
                printf("Joystick %d axis %d value: %d\n",
                       event.jaxis.which,
                       event.jaxis.axis, event.jaxis.value);
                break;
            case SDL_JOYHATMOTION:
                printf("Joystick %d hat %d value:",
                       event.jhat.which, event.jhat.hat);
                if (event.jhat.value == SDL_HAT_CENTERED)
                    printf(" centered");
                if (event.jhat.value & SDL_HAT_UP)
                    printf(" up");
                if (event.jhat.value & SDL_HAT_RIGHT)
                    printf(" right");
                if (event.jhat.value & SDL_HAT_DOWN)
                    printf(" down");
                if (event.jhat.value & SDL_HAT_LEFT)
                    printf(" left");
                printf("\n");
                break;
            case SDL_JOYBALLMOTION:
                printf("Joystick %d ball %d delta: (%d,%d)\n",
                       event.jball.which,
                       event.jball.ball, event.jball.xrel, event.jball.yrel);
                break;
            case SDL_JOYBUTTONDOWN:
                printf("Joystick %d button %d down\n",
                       event.jbutton.which, event.jbutton.button);
                break;
            case SDL_JOYBUTTONUP:
                printf("Joystick %d button %d up\n",
                       event.jbutton.which, event.jbutton.button);
                break;
            case SDL_KEYDOWN:
                if ((event.key.keysym.sym != SDLK_ESCAPE) &&
                    (event.key.keysym.sym != SDLK_AC_BACK)) {
                    break;
                }
                /* Fall through to signal quit */
            case SDL_FINGERDOWN:
            case SDL_MOUSEBUTTONDOWN:
            case SDL_QUIT:
                done = SDL_TRUE;
                break;
            default:
                break;
            }
        }
        /* Update visual joystick state */
        SDL_SetRenderDrawColor(screen, 0x00, 0xFF, 0x00, SDL_ALPHA_OPAQUE);
        for (i = 0; i < SDL_JoystickNumButtons(joystick); ++i) {
            if (SDL_JoystickGetButton(joystick, i) == SDL_PRESSED) {
                DrawRect(screen, (i%20) * 34, SCREEN_HEIGHT - 68 + (i/20) * 34, 32, 32);
            }
        }

        SDL_SetRenderDrawColor(screen, 0xFF, 0x00, 0x00, SDL_ALPHA_OPAQUE);
        for (i = 0; i < SDL_JoystickNumAxes(joystick); ++i) {
            /* Draw the X/Y axis */
            int x, y;
            x = (((int) SDL_JoystickGetAxis(joystick, i)) + 32768);
            x *= SCREEN_WIDTH;
            x /= 65535;
            if (x < 0) {
                x = 0;
            } else if (x > (SCREEN_WIDTH - 16)) {
                x = SCREEN_WIDTH - 16;
            }
            ++i;
            if (i < SDL_JoystickNumAxes(joystick)) {
                y = (((int) SDL_JoystickGetAxis(joystick, i)) + 32768);
            } else {
                y = 32768;
            }
            y *= SCREEN_HEIGHT;
            y /= 65535;
            if (y < 0) {
                y = 0;
            } else if (y > (SCREEN_HEIGHT - 16)) {
                y = SCREEN_HEIGHT - 16;
            }

            DrawRect(screen, x, y, 16, 16);
        }

        SDL_SetRenderDrawColor(screen, 0x00, 0x00, 0xFF, SDL_ALPHA_OPAQUE);
        for (i = 0; i < SDL_JoystickNumHats(joystick); ++i) {
            /* Derive the new position */
            int x = SCREEN_WIDTH/2;
            int y = SCREEN_HEIGHT/2;
            const Uint8 hat_pos = SDL_JoystickGetHat(joystick, i);

            if (hat_pos & SDL_HAT_UP) {
                y = 0;
            } else if (hat_pos & SDL_HAT_DOWN) {
                y = SCREEN_HEIGHT-8;
            }

            if (hat_pos & SDL_HAT_LEFT) {
                x = 0;
            } else if (hat_pos & SDL_HAT_RIGHT) {
                x = SCREEN_WIDTH-8;
            }

            DrawRect(screen, x, y, 8, 8);
        }

        SDL_RenderPresent(screen);

        if (SDL_JoystickGetAttached( joystick ) == 0) {
            done = SDL_TRUE;
            retval = SDL_TRUE;  /* keep going, wait for reattach. */
        }
    }

    SDL_DestroyRenderer(screen);
    SDL_DestroyWindow(window);
    return retval;
}
Ejemplo n.º 16
0
//----CheckBox绘制函数----------------------------------------------------------
//功能:这是CheckBox控件的MSG_PAINT消息响应函数
//参数:pMsg,消息指针
//返回:固定true
//-----------------------------------------------------------------------------
static  bool_t CheckBox_Paint(struct WindowMsg *pMsg)
{
    HWND hwnd;
    HDC hdc;
    RECT rc;
    RECT rc0;

    hwnd=pMsg->hwnd;
    hdc =BeginPaint(hwnd);
    if(NULL!=hdc)
    {
        GetClientRect(hwnd,&rc0);

        SetTextColor(hdc,RGB(1,1,1));
        SetDrawColor(hdc,RGB(40,40,40));
        SetFillColor(hdc,RGB(200,200,200));

        FillRect(hdc,&rc0);

        if(hwnd->Style&CBS_SELECTED)
        {
            CopyRect(&rc,&rc0);
            rc.right =rc.left+RectH(&rc0);

            InflateRect(&rc,-2,-2);
            SetDrawColor(hdc,RGB(70,70,70));
            DrawRect(hdc,&rc);

            InflateRect(&rc,-1,-1);
            SetDrawColor(hdc,RGB(110,110,110));
            DrawRect(hdc,&rc);

            InflateRect(&rc,-1,-1);
            SetFillColor(hdc,RGB(240,240,240));
            FillRect(hdc,&rc);

            InflateRect(&rc,-4,-4);
            SetDrawColor(hdc,RGB(150,150,240));
            DrawRect(hdc,&rc);
            InflateRect(&rc,-1,-1);
            SetDrawColor(hdc,RGB(100,100,220));
            DrawRect(hdc,&rc);

            InflateRect(&rc,-1,-1);
            SetFillColor(hdc,RGB(50,50,200));
            FillRect(hdc,&rc);
        }
        else
        {
            CopyRect(&rc,&rc0);
            rc.right =rc.left+RectH(&rc0);

            InflateRect(&rc,-2,-2);
            SetDrawColor(hdc,RGB(100,100,100));
            DrawRect(hdc,&rc);

            InflateRect(&rc,-1,-1);
            SetDrawColor(hdc,RGB(160,160,160));
            DrawRect(hdc,&rc);

            InflateRect(&rc,-1,-1);
            SetFillColor(hdc,RGB(220,220,220));
            FillRect(hdc,&rc);

        }

        CopyRect(&rc,&rc0);
        InflateRectEx(&rc,-RectH(&rc),0,0,0);

        DrawText(hdc,hwnd->Text,-1,&rc,DT_LEFT|DT_VCENTER);
        EndPaint(hwnd,hdc);
    }

    return true;

}
Ejemplo n.º 17
0
void enemyS::Draw(int tex_id, int tex_id_bala, int estat)
{
	float xo = 0.0f, yo = 0.0f, xf = 0.0f, yf = 0.0f;
	char psentit = 'X';

	if (estat == 0) {
		switch (GetState())
		{
			//1
		case STATE_LOOKLEFT:	xo = 0.0f;	yo = 0.0f;
			psentit = 'L';
			break;
			//4
		case STATE_LOOKRIGHT:	xo = 0.0f;	yo = 0.0f;
			psentit = 'R';
			break;
			//1..3
			//11 sprites en dues files 1/11=0.0909
		case STATE_WALKLEFT:	xo = 0.093f + (GetFrame()*0.0909f);
			if (xo > 0.92f) yo = 0.5f;
			psentit = 'L';
			NextFrame(22);
			break;
			//4..6
		case STATE_WALKRIGHT:	xo = 0.093f + (GetFrame()*0.0909f);
			if (xo > 0.92f) yo = 0.5f;
			psentit = 'R';
			NextFrame(22);
			break;
		}
		xf = xo + 0.0909f;
		yf = yo + 0.5f;

		if (psentit == 'L') {
			DrawRect(tex_id, xo, yo, xf, yf, psentit, false);
			for (int i = 0; i < 100; ++i) {
				if (i <= aaa) {
					DrawRectBullet(psentit, tex_id_bala, i);
				}
			}
			if (aaa < 99) {
				if (GetFrame() == 1) bL = true;
				if (bL && GetFrame() != 1) {
					aaa = aaa + 1;
					bL = false;
				}
			}
			else aaa = 0;
		}
		else {
			DrawRect(tex_id, xo, yo, xf, yf, psentit, false);
			for (int i = 0; i < 100; ++i) {
				if (i <= bbb) {
					DrawRectBullet(psentit, tex_id_bala, i);
				}
			}
			if (bbb < 99) {
				if (GetFrame() == 1) bR = true;
				if (bR && GetFrame() != 1) {
					bbb = bbb + 1;
					bR = false;
				}
			}
			else bbb = 0;
		}
	}

	else if (estat == 1) {	//mort
		if (GetFrame() == 5) {
			xo = 0.833333f;
			xf = 1.0f;
			yo = 0.0f;
			yf = 1.0f;
			switch (GetState())
			{
			case STATE_LOOKLEFT:
				psentit = 'L';
				break;
			case STATE_LOOKRIGHT:
				psentit = 'R';
				break;
			case STATE_WALKLEFT:
				psentit = 'L';
				break;
			case STATE_WALKRIGHT:
				psentit = 'R';
				break;
			}
		}
		else {
			switch (GetState())
			{
			case STATE_LOOKLEFT:	xo = 0.0f;	yo = 0.0f;
				psentit = 'L';
				break;
			case STATE_LOOKRIGHT:	xo = 0.0f;	yo = 0.0f;
				psentit = 'R';
				break;
				//1/6=0.16667
			case STATE_WALKLEFT:	xo = 0.16667f + (GetFrame()*0.16667f);
				psentit = 'L';
				break;
			case STATE_WALKRIGHT:	xo = 0.16667f + (GetFrame()*0.16667f);
				psentit = 'R';
				break;
			}
			NextFrame(6);
			xf = xo + 0.16667f;
			yf = 1.0f;
		}
		DrawRect(tex_id, xo, yo, xf, yf, psentit, true);
	}
}
Ejemplo n.º 18
0
//------------------------------------------------------    
BOOL CRectTracker::TrackHandle( HWND hWnd, const LPPOINT point, int HitTest )
{
	ATLASSERT(point);

    if ((HitTest != hitBegin) && (HitTest != hitEnd) && (HitTest != hitMiddle))
        return FALSE;

    if (!IsValidPos())
        return FALSE;

    // set mouse cursor parameters
    RECT CursorRect;

    if (IsRectEmpty(&ValidRect))
    {
        GetClientRect(hWnd, &CursorRect);
    }
    else
    {
        // valid rectangle is not empty
        if (HitTest == hitMiddle)
        {
            RECT BeginRect = ValidRect;
			OffsetRect(&BeginRect, point->x, point->y);
			OffsetRect(&BeginRect,  -CurPos.Begin.x, -CurPos.Begin.y);
            NormalizeRect(&BeginRect);

            RECT EndRect = ValidRect;
			OffsetRect(&EndRect, point->x, point->y);
			OffsetRect(&EndRect,  -CurPos.End.x, -CurPos.End.y);
            NormalizeRect(&EndRect);

            CursorRect = ValidRect;
            IntersectRect(&CursorRect, &CursorRect, &BeginRect);
            IntersectRect(&CursorRect, &CursorRect, &EndRect);
        }
        else
            CursorRect = ValidRect;
    };

    if (IsRectEmpty(&CursorRect))
        return FALSE;

    ClientToScreen(hWnd, (LPPOINT)&CursorRect );
    ClientToScreen(hWnd, ((LPPOINT)&CursorRect)+1 );
    ClipCursor(&CursorRect);
    SetCapture(hWnd);

	// get DC for drawing
	HDC dc = GetDC(hWnd);

    // set dc parameters
    HPEN LinePen = CreatePen( PS_SOLID, LineWidth, CLR_WHITE );
    HPEN hOldPen = (HPEN)SelectObject(dc, LinePen);
    SetROP2(dc, R2_XORPEN );

    KLinePos OriginalPos = CurPos;
    BOOL bCanceled = FALSE;

    // draw the rectangle for the first time
	DrawRect(dc, &CurPos.Begin, &CurPos.End);

	// get messages until capture lost or cancelled/accepted
    BOOL bExit = FALSE;
    KLinePos NewPos;

	while (!bExit)
	{
		MSG msg;
		BOOL b = ::GetMessage(&msg, NULL, 0, 0);
		ATLASSERT(b);

		if (GetCapture() != hWnd)
			break; // exit loop

		switch (msg.message)
		{
		    // handle movement/accept messages
		    case WM_LBUTTONUP:
		    case WM_MOUSEMOVE:
                {
			        NewPos = CurPos;
                    POINT MousePoint = { (int)(short)LOWORD(msg.lParam), (int)(short)HIWORD(msg.lParam) };

                    switch (HitTest)
                    {
                        case hitBegin:
                            NewPos.Begin = MousePoint;
                            break;

                        case hitEnd:
                            NewPos.End = MousePoint;
                            break;

                        case hitMiddle:
                             NewPos.Begin.x = OriginalPos.Begin.x + (MousePoint.x-point->x);
                             NewPos.Begin.y = OriginalPos.Begin.y + (MousePoint.y-point->y);

                             NewPos.End.x = OriginalPos.End.x + (MousePoint.x-point->x);
                             NewPos.End.y = OriginalPos.End.y + (MousePoint.y-point->y);
                             break;
                    };

                    // redraw the line
                    if ((NewPos.Begin.x != CurPos.Begin.x) || (NewPos.Begin.y != CurPos.Begin.y) ||
						(NewPos.End.x != CurPos.End.x) || (NewPos.End.y != CurPos.End.y))
                    {
                        // draw new rectangle
						DrawRect(dc, &NewPos.Begin, &NewPos.End);

                        // erase old rectangle
						DrawRect(dc, &CurPos.Begin, &CurPos.End);
                    };

                    if (IsValidPos(NewPos))
                        CurPos = NewPos;

                    if (msg.message == WM_LBUTTONUP)
                        bExit = TRUE;
                };
    	        break;

		    // handle cancel messages
		    case WM_KEYDOWN:
			    if (msg.wParam == VK_ESCAPE)
                {
                    bCanceled = TRUE;
                    bExit = TRUE;
                };
			    break;

		    case WM_RBUTTONDOWN:
                bCanceled = TRUE;
                bExit = TRUE;
                break;

		    // just dispatch rest of the messages
		    default:
			    DispatchMessage(&msg);
			    break;
	    }
    };

    ClipCursor(NULL);
    ReleaseCapture();

    if (bCanceled)
        CurPos = OriginalPos;

    SelectObject(dc, hOldPen);
	DeleteObject(LinePen);
	ReleaseDC(hWnd, dc);
    return !bCanceled;
};
Ejemplo n.º 19
0
bool GUIFillBar( gui_window *wnd, gui_rect *rect, gui_attr attr )
{
    return( DrawRect( wnd, rect, attr, true, false, DRAW( TOP_HALF ) ) );
}
Ejemplo n.º 20
0
void NXSurface::DrawPixel(int x, int y, uint8_t r, uint8_t g, uint8_t b)
{
	DrawRect(x, y, x, y, r, g, b);
}
Ejemplo n.º 21
0
ULONG RENDER_Frame(piClass *cl,piObject *o,Msg msg)
{
	UWORD x,y,w,h;
	struct Node_Frame *nf;
	struct Node_Window *nw;
	BOOL fill=FALSE;

	piGetAttr(o,OBJ_Node,(ULONG *)&nf);
	piGetAttr(nf->nf_Window,OBJ_Node,(ULONG *)&nw);

	x=piCX(o);
	y=piCY(o);
	w=piCW(o);
	h=piCH(o);

	SetAPen(nw->nw_Window->RPort,DrawInfo->dri_Pens[BACKGROUNDPEN]);
	SetDrMd(nw->nw_Window->RPort,JAM1);
	RectFill(nw->nw_Window->RPort,x,y,x+w,y+h);

	switch(nf->nf_FrameType)
	{
		case FTYPE_BUTTON:
			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,
				GTBB_FrameType, BBFT_BUTTON,
				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,
				GT_VisualInfo,VisualInfo,
				TAG_DONE);
			break;
		case FTYPE_ICONDROPBOX:
			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,
				GTBB_FrameType, BBFT_ICONDROPBOX,
				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,
				GT_VisualInfo,VisualInfo,
				TAG_DONE);
			break;
		case FTYPE_RIDGE:
			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,
				GTBB_FrameType, BBFT_RIDGE,
				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,
				GT_VisualInfo,VisualInfo,
				TAG_DONE);
			break;
		case FTYPE_HORIZONTALLINE:
			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,2,
				GTBB_FrameType, BBFT_BUTTON,
				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,
				GT_VisualInfo,VisualInfo,
				TAG_DONE);
			nf->nf_Height=2;
			break;
		case FTYPE_VERTICALLINE:
			DrawBevelBox(nw->nw_Window->RPort,x,y,2,h+1,
				GTBB_FrameType, BBFT_BUTTON,
				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,
				GT_VisualInfo,VisualInfo,
				TAG_DONE);
			nf->nf_Width=2;
			break;
	}

	if(nf->nf_Selected && GUI.gui_Mode==MODE_FRAME)
	{
		SetAPen(nw->nw_Window->RPort,1);
		SetDrMd(nw->nw_Window->RPort,COMPLEMENT);
		DrawRect(nw->nw_Window->RPort,x,y,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y,fill);
		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y+h-5,fill);
		DrawRect(nw->nw_Window->RPort,x,y+(h/2)-2,fill);
		DrawRect(nw->nw_Window->RPort,x+w-5,y+(h/2)-2,fill);
/*
		RectFill(nw->nw_Window->RPort,x,        y,        x+6,      y+3);
		RectFill(nw->nw_Window->RPort,x+w-6,    y,        x+w,      y+3);
		RectFill(nw->nw_Window->RPort,x+w-6,    y+h-3,    x+w,      y+h);
		RectFill(nw->nw_Window->RPort,x,        y+h-3,    x+6,      y+h);
		RectFill(nw->nw_Window->RPort,x+(w/2)-3,y,        x+(w/2)+3,y+3);
		RectFill(nw->nw_Window->RPort,x+(w/2)-3,y+h-3,    x+(w/2)+3,y+h);
		RectFill(nw->nw_Window->RPort,x,        y+(h/2)-2,x+6,      y+(h/2)+2);
		RectFill(nw->nw_Window->RPort,x+w-6,    y+(h/2)-2,x+w,      y+(h/2)+2);
*/
	}
	return TRUE;
}
Ejemplo n.º 22
0
void Wall::draw() {
  DrawRect(x, y, w, h, (color){0.0f, 0.5f, 1.0f, 1.0f}, noTex);
}
Ejemplo n.º 23
0
void FormView::DrawObject(Draw& w, int id, const Color& c, bool springs)
{
	if (!IsLayout())
		return;

	FormObject *pI = GetObject(id);
	if (!pI) return;

	Rect offseted = Offseted(pI->GetRect());
	offseted = Zoom(offseted);

	if (_showInfo == 2)	
		w.DrawRect(offseted, c);

	String type = pI->Get("Type");
	if (type == "Label")
		DrawRect(w, offseted.Offseted(-1, 0), 1, LtGray());

	if (pI->IsSelected() && springs)
	{
		DrawSprings(w, offseted, pI->GetHAlign(), pI->GetVAlign());
		w.DrawImage(offseted.right, offseted.bottom, FormViewImg::SizerBR());
		DrawRect(w, offseted, 1, LtRed());
	}
	else if (pI->IsSelected() && !springs)
		DrawRect(w, Point(offseted.left, offseted.top),
			Size(offseted.Width(), offseted.Height()), 1, LtRed());
	else if (_showInfo == 2 || pI->GetBool("OutlineDraw"))
		DrawRect(w, offseted, 1, Black());

	if (pI->GetBool("OutlineDraw"))
	{
		Rect l = offseted.Offseted( ZoomX(3), ZoomY(3) );
		l = Rect( l.TopLeft(), l.GetSize() - Size(ZoomX(6), ZoomY(6)) );
		DrawRect(w, l, 1, LtCyan());
	}

	String temp = pI->Get("Variable");
	Size t = GetTextSize( temp, _Font );
	int cx = t.cx;

	int y = offseted.BottomCenter().y - t.cy - ZoomY(3);

	if (_showInfo > 0)
	{
		if (offseted.Width() > t.cx + 15)
		{
			int x1 = ZoomX(pI->GetRect().right) - DeZoomX(2) - 4 - t.cx + ZoomX(X(0));
			w.DrawRect( x1 - 2, y, t.cx + 3, t.cy, White());
//			DrawRect(w, Point(x1 - 2, y), Size(t.cx + 3, t.cy), 1, LtGray());
			w.DrawText( x1, y, temp, _Font, LtBlue);
		}

		temp = AsString(id) + " " + type;
		t = GetTextSize(temp, _Font);
		Size s = GetTextSize(AsString(id), _Font);

		if (offseted.Width() - cx > t.cx + 10)
		{
			w.DrawRect( offseted.left + ZoomX(5) - 2, y, t.cx + 3, t.cy, White());
//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(t.cx + 3, t.cy),
//				1, LtGray());
			w.DrawText( offseted.left + ZoomX(5), y, temp, _Font, Gray());
		}
		else if (offseted.Width() > s.cx + 5)
		{
			w.DrawRect( offseted.left + ZoomX(5) - 2, y, s.cx + 3, s.cy, White());
//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(s.cx + 3, s.cy),
//				1, LtGray());
			w.DrawText( offseted.left + ZoomX(5), y, AsString(id), _Font, Gray());
		}
	}
}
Ejemplo n.º 24
0
 // override base class border drawing routines: we always draw just a
 // single simple border
 void DrawSimpleBorder(wxDC& dc, wxRect *rect)
     { DrawRect(dc, rect, m_penFg); }
Ejemplo n.º 25
0
	MapilVoid D3DCanvas2D::Draw( const Rectangle2D& rect )
	{
		DrawRect( rect.m_X1, rect.m_Y1, rect.m_X2, rect.m_Y2, rect.m_Col, rect.m_Width, rect.m_IsFilled );
	}
Ejemplo n.º 26
0
void wxStdRenderer::DrawExtraBorder(wxDC& dc, wxRect *rect)
{
    DrawRect(dc, rect, m_penLightGrey);
}
Ejemplo n.º 27
0
LRESULT AeroControlBase::StaticWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
    case WM_SETTEXT:
    case WM_ENABLE:
    case WM_STYLECHANGED:
        {
            LRESULT res = DefSubclassProc(hWnd, uMsg, wParam, lParam);
            InvalidateRgn(hWnd, NULL, FALSE);
            return res;
        }
        break;
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            HDC hdc = BeginPaint(hWnd, &ps);

            if(hdc)
            {
                HDC hdcPaint = NULL;
                RECT rcClient;
                VERIFY(GetClientRect(hWnd, &rcClient));

                LONG_PTR dwStyle = GetWindowLongPtr(hWnd, GWL_STYLE);
                LONG_PTR dwStyleEx = GetWindowLongPtr(hWnd, GWL_EXSTYLE);

                HTHEME hTheme = OpenThemeData(NULL, L"ControlPanelStyle");
                if(hTheme)
                {
                    HPAINTBUFFER hBufferedPaint = NULL;
                    if (dwStyleEx & WS_EX_TRANSPARENT)
                    {
                        BP_PAINTPARAMS paintParams = {0};
                        paintParams.cbSize = sizeof(paintParams);
                        paintParams.dwFlags = BPPF_ERASE;
                        BLENDFUNCTION blendf = {0};
                        blendf.BlendOp = AC_SRC_OVER;
                        blendf.AlphaFormat = AC_SRC_ALPHA;
                        blendf.SourceConstantAlpha = 255;
                        paintParams.pBlendFunction = &blendf;
                        hBufferedPaint = BeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, &paintParams, &hdcPaint);
                    }
                    else
                        hBufferedPaint = BeginBufferedPaint(hdc, &rcClient, BPBF_TOPDOWNDIB, NULL, &hdcPaint);

                    if (hdcPaint)
                    {
                        VERIFY(PatBlt(hdcPaint, 0, 0, RECTWIDTH(rcClient), RECTHEIGHT(rcClient), BLACKNESS));
                        VERIFY(S_OK==BufferedPaintSetAlpha(hBufferedPaint, &ps.rcPaint, 0x00));
                        LONG_PTR dwStaticStyle = dwStyle&0x1F;


                        if(dwStaticStyle==SS_ICON || dwStaticStyle==SS_BITMAP)
                        {
                            bool bIcon = dwStaticStyle==SS_ICON;
                            HANDLE hBmpIco = (HANDLE)SendMessage(hWnd, STM_GETIMAGE, bIcon ? IMAGE_ICON:IMAGE_BITMAP, NULL);
                            if(hBmpIco)
                            {
                                std::unique_ptr<Bitmap> pBmp( bIcon ? new Bitmap((HICON)hBmpIco) : new Bitmap((HBITMAP)hBmpIco, NULL) );
                                std::unique_ptr<Graphics> myGraphics( new Graphics(hdcPaint) );
                                std::unique_ptr<CachedBitmap> pcbmp( new CachedBitmap(pBmp.get(), myGraphics.get()) );
                                VERIFY(Ok==myGraphics->DrawCachedBitmap(pcbmp.get(), 0,0));
                            }
                        }
                        else if(SS_BLACKRECT==dwStaticStyle || SS_GRAYRECT==dwStaticStyle || SS_WHITERECT==dwStaticStyle)
                        {
                            ARGB argb = 0L;
                            switch (dwStaticStyle)
                            {
                            case SS_BLACKRECT:
                                argb = 0xFF000000;
                                break;
                            case SS_GRAYRECT:
                                argb = 0xFF808080;
                                break;
                            case SS_WHITERECT:
                                argb = 0xFFFFFFFF;
                                break;
                            default:
                                ASSERT(0);
                                break;
                            }
                            Color clr(argb);

                            FillRect(&rcClient, hdcPaint, clr);
                        }
                        else if(SS_BLACKFRAME==dwStaticStyle || SS_GRAYFRAME==dwStaticStyle || SS_WHITEFRAME==dwStaticStyle)
                        {
                            ARGB argb = 0L;
                            switch (dwStaticStyle)
                            {
                            case SS_BLACKFRAME:
                                argb = 0xFF000000;
                                break;
                            case SS_GRAYFRAME:
                                argb = 0xFF808080;
                                break;
                            case SS_WHITEFRAME:
                                argb = 0xFFFFFFFF;
                                break;
                            }
                            Color clr(argb);

                            DrawRect(&rcClient, hdcPaint, DashStyleSolid, clr, 1.0);
                        }
                        else
                        {
                            DTTOPTS DttOpts = {sizeof(DTTOPTS)};
                            DttOpts.dwFlags = DTT_COMPOSITED | DTT_GLOWSIZE;
                            DttOpts.crText   = RGB(255, 255, 255);
                            DttOpts.iGlowSize = 12; // Default value

                            VERIFY(DetermineGlowSize(&DttOpts.iGlowSize));

                            HFONT hFontOld = (HFONT)SendMessage(hWnd, WM_GETFONT, 0L, NULL);
                            if(hFontOld)
                                hFontOld = (HFONT) SelectObject(hdcPaint, hFontOld);
                            int iLen = GetWindowTextLength(hWnd);

                            if(iLen)
                            {
                                iLen+=5; // 1 for terminating zero, 4 for DT_MODIFYSTRING
                                LPWSTR szText = (LPWSTR)LocalAlloc(LPTR, sizeof(WCHAR)*iLen);
                                if(szText)
                                {
                                    iLen = GetWindowTextW(hWnd, szText, iLen);
                                    if(iLen)
                                    {
                                        DWORD dwFlags = DT_WORDBREAK;

                                        switch (dwStaticStyle)
                                        {
                                        case SS_CENTER:
                                            dwFlags |= DT_CENTER;
                                            break;
                                        case SS_RIGHT:
                                            dwFlags |= DT_RIGHT;
                                            break;
                                        case SS_LEFTNOWORDWRAP:
                                            dwFlags &= ~DT_WORDBREAK;
                                            break;
                                        }

                                        if(dwStyle & SS_CENTERIMAGE)
                                        {
                                            dwFlags |= DT_VCENTER;
                                            dwFlags &= ~DT_WORDBREAK;
                                        }

                                        if(dwStyle & SS_ENDELLIPSIS)
                                            dwFlags |= DT_END_ELLIPSIS|DT_MODIFYSTRING;
                                        else if(dwStyle & SS_PATHELLIPSIS)
                                            dwFlags |= DT_PATH_ELLIPSIS|DT_MODIFYSTRING;
                                        else if(dwStyle & SS_WORDELLIPSIS)
                                            dwFlags |= DT_WORD_ELLIPSIS|DT_MODIFYSTRING;

                                        if (dwStyleEx&WS_EX_RIGHT)
                                            dwFlags |= DT_RIGHT;

                                        if(dwStyle & SS_NOPREFIX)
                                            dwFlags |= DT_NOPREFIX;

                                        VERIFY(S_OK==DrawThemeTextEx(hTheme, hdcPaint, 0, 0,
                                            szText, -1, dwFlags, &rcClient, &DttOpts));

                                        if(dwStyle&SS_SUNKEN || dwStyle&WS_BORDER)
                                            DrawRect(&rcClient, hdcPaint, DashStyleSolid, Color(0xFF, 0,0,0), 1.0);
                                    }
                                    VERIFY(!LocalFree(szText));
                                }
                            }

                            if (hFontOld)
                            {
                                SelectObject(hdcPaint, hFontOld);
                                hFontOld    = NULL;
                            }
                        }

                        VERIFY(S_OK==EndBufferedPaint(hBufferedPaint, TRUE));
                    }

                    VERIFY(S_OK==CloseThemeData(hTheme));
                }
            }

            EndPaint(hWnd, &ps);
            return 0;
        }
        break;
    case WM_NCDESTROY:
    case WM_DESTROY:
        RemoveWindowSubclass(hWnd, SubclassProc, Static);
        subclassedControls.erase(hWnd);
        break;
    }

    return DefSubclassProc(hWnd, uMsg, wParam, lParam);
}
Ejemplo n.º 28
0
void AppStateLobby::Draw() {
	if (!lobbyIsReady)
		return;

    Rect<double> viewport = Camera::getInstance()->Get_Viewport();

    ////////////////////////////////////////////////////////////////////////////
    // Draw players table
    TextureManager *textureManager = TextureManager::GetInstance();

    glColor4f(1, 1, 1, 1);
    textureManager->background_game2->DrawAtRect(0, 0, 1024, 1024);

    std::stringstream stream;
    stream << directedLobbyName;
    DrawText(10, 10, stream.str().c_str(), textureManager->fonts.font_Impact_20, &WHITE);

    int drawx = viewport.w - 300;
    int drawy = 70;

    DrawText(drawx, drawy - 22, "Team Red", textureManager->fonts.font_Impact_20, &WHITE);

    // Draw all team 0 players; not the fastest way, but we don't need speed.
    int offset = 0;
    for (int i = 0; i < MaximumClients; i++)
    {
        if (clients[i] == NULL || clients[i]->team_id == BLUE_TEAM)
            continue;

        // Add other things like exp lvl?
        stream.str(std::string());
        stream << clients[i]->player_name;
        DrawText(drawx, drawy + offset * 18, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);
        offset++;
    }

    drawy += offset * 18 + 80;
    DrawText(drawx, drawy - 22, "Team Blue", textureManager->fonts.font_Impact_20, &WHITE);

    // Draw all team 1 players
    offset = 0;
    for (int i = 0; i < MaximumClients; i++)
    {
        if (clients[i] == NULL || clients[i]->team_id == RED_TEAM)
            continue;

        // Add other things like exp lvl?
        stream.str(std::string());
        stream << clients[i]->player_name;
        DrawText(drawx, drawy + offset * 18, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);
        offset++;
    }
    ////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    // Draw Map
    DrawRect(10, 40, 480, 440, true, &BLACK);
    map->DrawLobbyPreview(10, 40, 480, 440);
    DrawRect(10, 40, 480, 440, false, &WHITE);

    stream.str(std::string());
    stream << "Map name (seed): MAP" << map->SEED;
    DrawText(10, 440, stream.str().c_str(), textureManager->fonts.font_FreeMono_20, &WHITE);

    stream.str(std::string());
    stream << "Min players per team: " << map->min_players_per_team;
    DrawText(10, 464, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);

    stream.str(std::string());
    stream << "Max players per team: " << map->max_players_per_team;
    DrawText(10, 482, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);
    ////////////////////////////////////////////////////////////////////////////

    stateText.Draw(viewport.w / 2 - stateText.width / 2, viewport.h - stateText.height - 10);
}
Ejemplo n.º 29
0
void CEditPrevWnd::OnMouseMove(UINT nFlags, CPoint point) 
{
	if(!m_bCropPress)
	{
		if(m_bMoveEnabled)
		{
			m_ptChanged = point - m_ptMoveStart;
			m_ptMoveStart = point;

			if(!m_bMoveFore)
			{
				if(m_ptChanged != CPoint(0,0))
					PointContrast();
			}
			else	//move fore image
			{
				CSize sz(0,0);
				sz = CSize((LONG)(m_ptChanged.x/m_dScaling), (LONG)(m_ptChanged.y/m_dScaling));
				if(sz != CSize(0,0))
				{
					(((CPhotoEditDlg*)m_pParentWnd)->GetCurObject())->MoveForeImage(sz);
					((CPhotoEditDlg*)m_pParentWnd)->SetCurImageModified(true);
					CDC* pDC = GetDC();
					DrawFore(pDC);
					ReleaseDC(pDC);
				}
			}
		}
		else
		{
			::SetCursor(::AfxGetApp()->LoadCursor(IDC_CURSOR_HAND_ON));
		}
	}
	else
	{
		if(((CPhotoEditDlg*)m_pParentWnd)->GetEditType() == EDIT_RESIZE)
		{
		if(!m_rtImageRect.PtInRect(point))
			return;
		::SetCursor(::AfxGetApp()->LoadStandardCursor(IDC_CROSS));
		{
			
			if((nFlags & MK_LBUTTON) == MK_LBUTTON)//&&(m_rtImageRect.PtInRect(m_OldPoint)))
			{
				if(m_bAfterCrop)
				{
					Invalidate();
					m_bAfterCrop = FALSE;
				}
			
				CDC * pDC = GetDC();
				CRect rtOld;
				if(m_OldPoint.x < m_rtImageRect.left)
					 m_OldPoint.x = m_rtImageRect.left;
				if (m_OldPoint.x > m_rtImageRect.right)
					 m_OldPoint.x = m_rtImageRect.right;
				if(m_OldPoint.y < m_rtImageRect.top)
					 m_OldPoint.y = m_rtImageRect.top;
				if (m_OldPoint.y > m_rtImageRect.bottom)
					 m_OldPoint.y = m_rtImageRect.bottom;
				int x1 = m_OldPoint.x;
				int y1 = m_OldPoint.y;
				int x2 = m_PrePoint.x;
				int y2 = m_PrePoint.y;
				rtOld.left = min(x1,x2);
				rtOld.top = min(y1,y2);
				rtOld.right = max(x1,x2);
				rtOld.bottom = max(y1,y2);
				DrawRect(pDC,rtOld);
				if(point.x < m_rtImageRect.left)
					 point.x = m_rtImageRect.left;
				if (point.x > m_rtImageRect.right)
					 point.x = m_rtImageRect.right;
				if(point.y < m_rtImageRect.top)
					 point.y = m_rtImageRect.top;
				if (point.y > m_rtImageRect.bottom)
					 point.y = m_rtImageRect.bottom;
				m_PrePoint = point;
				CRect rtNew;
				x1 = m_OldPoint.x;
				y1 = m_OldPoint.y;
				x2 = point.x;
				y2 = point.y;
				rtNew.left = min(x1,x2);
				rtNew.top = min(y1,y2);
				rtNew.right = max(x1,x2);
				rtNew.bottom = max(y1,y2);
				m_rtPreRect = rtNew;
				DrawRect(pDC,m_rtPreRect);
			
				m_bRectExist = TRUE;
				//Draw(pDC);
				ReleaseDC(pDC);
			}
			}
		}
	}
	CWnd::OnMouseMove(nFlags, point);
}
Ejemplo n.º 30
0
void CDDrawRecord::ClearScreen(int iWnd, DWORD color)
{
	RECT dst;
	GetWndRect(iWnd, dst);
	DrawRect(color, &dst, lpDDSBack);
}