本文整理汇总了C#中Box2D.Common.b2Color.Set方法的典型用法代码示例。如果您正苦于以下问题:C# b2Color.Set方法的具体用法?C# b2Color.Set怎么用?C# b2Color.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box2D.Common.b2Color
的用法示例。
在下文中一共展示了b2Color.Set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
protected override void Draw(Settings settings)
{
base.Draw(settings);
for (int i = 0; i < e_actorCount; ++i)
{
Actor actor = m_actors[i];
if (actor.proxyId == b2_nullNode)
continue;
b2Color c = new b2Color(0.9f, 0.9f, 0.9f);
if (actor == m_rayActor && actor.overlap)
{
c.Set(0.9f, 0.6f, 0.6f);
}
else if (actor == m_rayActor)
{
c.Set(0.6f, 0.9f, 0.6f);
}
else if (actor.overlap)
{
c.Set(0.6f, 0.6f, 0.9f);
}
m_debugDraw.DrawAABB(actor.aabb, c);
}
b2Color cc = new b2Color(0.7f, 0.7f, 0.7f);
m_debugDraw.DrawAABB(m_queryAABB, cc);
m_debugDraw.DrawSegment(m_rayCastInput.p1, m_rayCastInput.p2, cc);
b2Color c1 = new b2Color(0.2f, 0.9f, 0.2f);
b2Color c2 = new b2Color(0.9f, 0.2f, 0.2f);
m_debugDraw.DrawPoint(m_rayCastInput.p1, 6.0f, c1);
m_debugDraw.DrawPoint(m_rayCastInput.p2, 6.0f, c2);
if (m_rayActor != null)
{
b2Color cr = new b2Color(0.2f, 0.2f, 0.9f);
b2Vec2 p = m_rayCastInput.p1 + m_rayActor.fraction * (m_rayCastInput.p2 - m_rayCastInput.p1);
m_debugDraw.DrawPoint(p, 6.0f, cr);
}
{
int height = m_tree.GetHeight();
m_debugDraw.DrawString(5, m_textLine, "dynamic tree height = {0}", height);
m_textLine += 15;
}
}
示例2: Draw
protected virtual void Draw(Settings settings)
{
m_world.DrawDebugData();
if (settings.drawStats)
{
int bodyCount = m_world.BodyCount;
int contactCount = m_world.ContactCount;
int jointCount = m_world.JointCount;
m_debugDraw.DrawString(5, m_textLine, "bodies/contacts/joints = {0}/{1}/{2}", bodyCount, contactCount,
jointCount);
m_textLine += 15;
int proxyCount = m_world.GetProxyCount();
int height = m_world.GetTreeHeight();
int balance = m_world.GetTreeBalance();
float quality = m_world.GetTreeQuality();
m_debugDraw.DrawString(5, m_textLine, "proxies/height/balance/quality = {0}/{1}/{2}/{3}", proxyCount,
height, balance, quality);
m_textLine += 15;
}
#if PROFILING
// Track maximum profile times
{
b2Profile p = m_world.Profile;
m_maxProfile.step = Math.Max(m_maxProfile.step, p.step);
m_maxProfile.collide = Math.Max(m_maxProfile.collide, p.collide);
m_maxProfile.solve = Math.Max(m_maxProfile.solve, p.solve);
m_maxProfile.solveInit = Math.Max(m_maxProfile.solveInit, p.solveInit);
m_maxProfile.solveVelocity = Math.Max(m_maxProfile.solveVelocity, p.solveVelocity);
m_maxProfile.solvePosition = Math.Max(m_maxProfile.solvePosition, p.solvePosition);
m_maxProfile.solveTOI = Math.Max(m_maxProfile.solveTOI, p.solveTOI);
m_maxProfile.broadphase = Math.Max(m_maxProfile.broadphase, p.broadphase);
m_totalProfile.step += p.step;
m_totalProfile.collide += p.collide;
m_totalProfile.solve += p.solve;
m_totalProfile.solveInit += p.solveInit;
m_totalProfile.solveVelocity += p.solveVelocity;
m_totalProfile.solvePosition += p.solvePosition;
m_totalProfile.solveTOI += p.solveTOI;
m_totalProfile.broadphase += p.broadphase;
}
if (settings.drawProfile)
{
b2Profile p = m_world.Profile;
b2Profile aveProfile = new b2Profile();
if (m_stepCount > 0)
{
float scale = 1.0f / m_stepCount;
aveProfile.step = scale * m_totalProfile.step;
aveProfile.collide = scale * m_totalProfile.collide;
aveProfile.solve = scale * m_totalProfile.solve;
aveProfile.solveInit = scale * m_totalProfile.solveInit;
aveProfile.solveVelocity = scale * m_totalProfile.solveVelocity;
aveProfile.solvePosition = scale * m_totalProfile.solvePosition;
aveProfile.solveTOI = scale * m_totalProfile.solveTOI;
aveProfile.broadphase = scale * m_totalProfile.broadphase;
}
m_debugDraw.DrawString(5, m_textLine, "step [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.step,
aveProfile.step, m_maxProfile.step);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "collide [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.collide,
aveProfile.collide, m_maxProfile.collide);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "solve [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.solve,
aveProfile.solve, m_maxProfile.solve);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "solve init [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.solveInit,
aveProfile.solveInit, m_maxProfile.solveInit);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "solve velocity [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})",
p.solveVelocity, aveProfile.solveVelocity, m_maxProfile.solveVelocity);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "solve position [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})",
p.solvePosition, aveProfile.solvePosition, m_maxProfile.solvePosition);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "solveTOI [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.solveTOI,
aveProfile.solveTOI, m_maxProfile.solveTOI);
m_textLine += 15;
m_debugDraw.DrawString(5, m_textLine, "broad-phase [ave] (max) = {0:00000.00} [{1:000000.00}] ({2:000000.00})", p.broadphase,
aveProfile.broadphase, m_maxProfile.broadphase);
m_textLine += 15;
}
#endif
if (m_mouseJoint != null)
{
b2Vec2 p1 = m_mouseJoint.GetAnchorB();
b2Vec2 p2 = m_mouseJoint.GetTarget();
b2Color c = new b2Color();
c.Set(0.0f, 1.0f, 0.0f);
m_debugDraw.DrawPoint(p1, 4.0f, c);
m_debugDraw.DrawPoint(p2, 4.0f, c);
c.Set(0.8f, 0.8f, 0.8f);
m_debugDraw.DrawSegment(p1, p2, c);
//.........这里部分代码省略.........
示例3: Draw
/// <summary>
/// Standard Cocos2d method
/// </summary>
protected override void Draw()
{
base.Draw();
m_debugDraw.Begin();
//m_debugDraw.DrawString(50, 15, "bodies");
m_world.DrawDebugData();
if (m_touch.m_mouseJoint != null)
{
b2Vec2 p1 = m_touch.m_mouseJoint.GetAnchorB();
b2Vec2 p2 = m_touch.m_mouseJoint.GetTarget();
b2Color c = new b2Color(0.0f, 1.0f, 0.0f);
m_debugDraw.DrawPoint(p1, 4.0f, c);
m_debugDraw.DrawPoint(p2, 4.0f, c);
c.Set(0.8f, 0.8f, 0.8f);
m_debugDraw.DrawSegment(p1, p2, c);
}
m_debugDraw.End();
}