本文整理汇总了C++中samplerenderer::Renderer::print方法的典型用法代码示例。如果您正苦于以下问题:C++ Renderer::print方法的具体用法?C++ Renderer::print怎么用?C++ Renderer::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类samplerenderer::Renderer
的用法示例。
在下文中一共展示了Renderer::print方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: customizeRender
void SampleSubmarine::customizeRender()
{
SampleRenderer::Renderer* renderer = getRenderer();
const PxU32 yInc = 18;
const RendererColor textColor(255, 255, 255, 255);
PxU32 width, height;
renderer->getWindowSize(width, height);
char healthBar[20];
PxU32 h = gSubmarineHealth;
sprintf(healthBar, "Health:%c%c%c%c%c%c%c%c%c%c", (h>90?'I':' '), (h>80?'I':' '), (h>70?'I':' '),(h>60?'I':' '),(h>50?'I':' '),
(h>40?'I':' '), (h>30?'I':' '), (h>20?'I':' '),(h>10?'I':' '),(h>0?'I':' '));
renderer->print(width-130, height-yInc, healthBar);
if(gTreasureFound)
renderer->print(width-160, height-2*yInc, "Treasure Found!");
}
示例2: customizeRender
void SampleParticles::customizeRender()
{
SampleRenderer::Renderer* renderer = getRenderer();
// render the sight
SampleRenderer::RendererColor sightColor(200, 40, 40, 127);
PxReal sight[] = { 0.47f, 0.50f, 0.49f, 0.50f, // line 1
0.51f, 0.50f, 0.53f, 0.50f, // line 2
0.50f, 0.47f, 0.50f, 0.49f, // line 3
0.50f, 0.51f, 0.50f, 0.53f // line 4
};
renderer->drawLines2D(2, sight, sightColor);
renderer->drawLines2D(2, sight + 4, sightColor);
renderer->drawLines2D(2, sight + 8, sightColor);
renderer->drawLines2D(2, sight + 12, sightColor);
//settings for right lower corner info text (same hight as fps display)
const PxU32 yInc = 18;
const PxReal scale = 0.5f;
const PxReal shadowOffset = 6.0f;
PxU32 width, height;
renderer->getWindowSize(width, height);
PxU32 y = height-2*yInc;
PxU32 x = width - 240;
if (mLoadTextAlpha > 0)
{
const RendererColor textColor(255, 0, 0, PxU8(mLoadTextAlpha*255.0f));
const char* message[3] = { "Particle count: Moderate", "Particle count: Medium", "Particle count: High" };
renderer->print(x, y, message[mParticleLoadIndex], scale, shadowOffset, textColor);
y -= yInc;
}
#if PX_SUPPORT_GPU_PHYSX
{
const RendererColor textColor(255, 0, 0, 255);
renderer->print(x, y, mRunOnGpu ? "Running on GPU" : "Running on CPU", scale, shadowOffset, textColor);
}
#endif
}
示例3: helpRender
void SampleParticles::helpRender(PxU32 x, PxU32 y, PxU8 textAlpha)
{
SampleRenderer::Renderer* renderer = getRenderer();
const PxU32 yInc = 18;
const PxReal scale = 0.5f;
const PxReal shadowOffset = 6.0f;
const RendererColor textColor(255, 255, 255, textAlpha);
const bool isMouseSupported = getApplication().getPlatform()->getSampleUserInput()->mouseSupported();
const bool isPadSupported = getApplication().getPlatform()->getSampleUserInput()->gamepadSupported();
const char* msg;
if (isMouseSupported && isPadSupported)
renderer->print(x, y += yInc, "Use mouse or right stick to rotate", scale, shadowOffset, textColor);
else if (isMouseSupported)
renderer->print(x, y += yInc, "Use mouse to rotate", scale, shadowOffset, textColor);
else if (isPadSupported)
renderer->print(x, y += yInc, "Use right stick to rotate", scale, shadowOffset, textColor);
if (isPadSupported)
renderer->print(x, y += yInc, "Use left stick to move",scale, shadowOffset, textColor);
msg = mApplication.inputMoveInfoMsg("Press "," to move", CAMERA_MOVE_FORWARD,CAMERA_MOVE_BACKWARD, CAMERA_MOVE_LEFT, CAMERA_MOVE_RIGHT);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to move fast", CAMERA_SHIFT_SPEED, -1);
if(msg)
renderer->print(x, y += yInc, msg, scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to shoot raygun", RAYGUN_SHOT, -1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to toggle various debug visualization", TOGGLE_VISUALIZATION, -1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to change particle count", CHANGE_PARTICLE_CONTENT,-1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
#if defined(PX_WINDOWS)
msg = mApplication.inputInfoMsg("Press "," to toggle CPU/GPU", TOGGLE_CPU_GPU, -1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
#endif
}
示例4: customizeRender
void SampleCharacterCloth::customizeRender()
{
#if PX_SUPPORT_GPU_PHYSX
SampleRenderer::Renderer* renderer = getRenderer();
const PxU32 yInc = 18;
const PxReal scale = 0.5f;
const PxReal shadowOffset = 6.0f;
PxU32 width, height;
renderer->getWindowSize(width, height);
PxU32 y = height-2*yInc;
PxU32 x = width - 240;
{
const RendererColor textColor(255, 0, 0, 255);
renderer->print(x, y, mUseGPU ? "Running on GPU" : "Running on CPU", scale, shadowOffset, textColor);
}
#endif
}
示例5: helpRender
void SampleSubmarine::helpRender(PxU32 x, PxU32 y, PxU8 textAlpha)
{
SampleRenderer::Renderer* renderer = getRenderer();
const PxU32 yInc = 18;
const PxReal scale = 0.5f;
const PxReal shadowOffset = 6.0f;
const RendererColor textColor(255, 255, 255, textAlpha);
const bool isMouseSupported = getApplication().getPlatform()->getSampleUserInput()->mouseSupported();
const bool isPadSupported = getApplication().getPlatform()->getSampleUserInput()->gamepadSupported();
const char* msg;
msg = mApplication.inputInfoMsg("Press "," to toggle various debug visualization", TOGGLE_VISUALIZATION, -1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to restart", SCENE_RESET,-1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
if (isMouseSupported && isPadSupported)
renderer->print(x, y += yInc, "Use mouse or right stick to rotate the camera", scale, shadowOffset, textColor);
else if (isMouseSupported)
renderer->print(x, y += yInc, "Use mouse to rotate the camera", scale, shadowOffset, textColor);
else if (isPadSupported)
renderer->print(x, y += yInc, "Use right stick to rotate the camera", scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to switch between submarine/crab/flyCam", CAMERA_SWITCH, -1);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
if(mCameraAttachedToActor == mSubmarineActor)
{
renderer->print(x, y += yInc, "Submarine Controller:", scale, shadowOffset, textColor);
const char* msg = mApplication.inputInfoMsg("Press "," to move along view direction", SUBMARINE_FORWARD, SUBMARINE_BACKWARD);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to raise and dive", SUBMARINE_UP, SUBMARINE_DOWN);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
}
else if(gCrab && (mCameraAttachedToActor == gCrab->getCrabBody()))
{
renderer->print(x, y += yInc, "Crab Controller:", scale, shadowOffset, textColor);
if (isPadSupported)
renderer->print(x, y += yInc, "Use left stick to move the crab", scale, shadowOffset, textColor);
const char* msg = mApplication.inputMoveInfoMsg("Press "," to move the crab", CRAB_FORWARD, CRAB_BACKWARD, CRAB_LEFT, CRAB_RIGHT);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
}
else
{
renderer->print(x, y += yInc, "Fly Cam Controller:", scale, shadowOffset, textColor);
if (isPadSupported)
renderer->print(x, y += yInc, "Use left stick to move",scale, shadowOffset, textColor);
const char* msg = mApplication.inputMoveInfoMsg("Press "," to move", CAMERA_MOVE_FORWARD,CAMERA_MOVE_BACKWARD, CAMERA_MOVE_LEFT, CAMERA_MOVE_RIGHT);
if(msg)
renderer->print(x, y += yInc, msg,scale, shadowOffset, textColor);
msg = mApplication.inputInfoMsg("Press "," to move fast", CAMERA_SHIFT_SPEED, -1);
if(msg)
renderer->print(x, y += yInc, msg, scale, shadowOffset, textColor);
}
}