本文整理汇总了C++中GetEngine函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEngine函数的具体用法?C++ GetEngine怎么用?C++ GetEngine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEngine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
/**
Draw the player object.
Could be a simple shape but this makes a fake ball shape and labels it.
*/
void BouncingBall::Draw()
{
// Do not draw if it should not be visible
if ( !IsVisible() )
return;
unsigned int uiColourMult = 0x010001;
unsigned int uiColourText = 0xffffff;
// Choose one of 8 colours:
switch( m_iColour % 8 )
{
case 1: uiColourMult = 0x010000; uiColourText = 0xffffff; break;
case 2: uiColourMult = 0x000100; uiColourText = 0xffffff; break;
case 3: uiColourMult = 0x000001; uiColourText = 0xffffff; break;
case 4: uiColourMult = 0x010001; uiColourText = 0; break;
case 5: uiColourMult = 0x010100; uiColourText = 0; break;
case 6: uiColourMult = 0x000101; uiColourText = 0; break;
case 7: uiColourMult = 0x010101; uiColourText = 0; break;
default: uiColourMult = 0x000000; break;
}
// Concentric circles for pseudo-sphere
int iRadiusSquared = (m_iDrawWidth/2) * (m_iDrawWidth/2);
int iCentreX = m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth/2;
int iCentreY = m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight/2;
for ( int iX = m_iCurrentScreenX + m_iStartDrawPosX ; iX < (m_iCurrentScreenX + m_iStartDrawPosX + m_iDrawWidth) ; iX++ )
for ( int iY = m_iCurrentScreenY + m_iStartDrawPosY ; iY < (m_iCurrentScreenY + m_iStartDrawPosY + m_iDrawHeight) ; iY++ )
if ( ( (iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY) ) <= iRadiusSquared )
{
// 0xB0 is the range of values, 0xff is the brightest value.
unsigned int uiColour = (0xB0 * ((iX-iCentreX)*(iX-iCentreX) + (iY-iCentreY)*(iY-iCentreY))) / iRadiusSquared;
uiColour = 0xff - uiColour;
GetEngine()->SafeSetScreenPixel( iX, iY, uiColourMult * uiColour );
}
// If there is a label then draw the text
if ( (m_szLabel!=NULL) && (strlen(m_szLabel)>0) )
{
//GetEngine()->DrawString( iCentreX+m_iXLabelOffset+1, iCentreY+m_iYLabelOffset+1, m_szLabel, 0xffffff );
GetEngine()->DrawScreenString( iCentreX+m_iXLabelOffset, iCentreY+m_iYLabelOffset, m_szLabel, uiColourText );
}
// Store the position at which the object was last drawn
// You MUST do this to ensure that the screen is updated when only drawing movable objects
// This tells the system where to 'undraw' the object from
StoreLastScreenPositionAndUpdateRect();
}
示例2: GetEngine
void EngineRunningBase::DrawLensflare()
{
// Lensflare: draw if the sparkling sun is on screen.
if (!m_pLevel->IsCurrentRoomIndoors() &&
GetEngine()->GetDayNightSky()->IsSparkleVisible())
{
// Make a bounding sphere around the sun coords.
Vec3f sunPos = GetEngine()->GetDayNightSky()->GetSunPosition();
BoundingSphere sunBs(sunPos, 50.0f); // sun's "radius"
// Find out if the sun intersects the view frustum
if (Frustum::Instance()->Contains(sunBs))
{
PCamera pCam = GetCamera();
Assert(pCam.GetPtr());
Vec3f eyePos(pCam->GetOrientation()->GetX(),
pCam->GetOrientation()->GetY(),
pCam->GetOrientation()->GetZ());
// We have to draw the lens flare, unless the sun is obscured by part of
// the scene.
// Test the line from camera to sun for obstructions.
//Mgc::Segment3 seg;
//seg.Origin() = Mgc::Vector3(eyePos.x, eyePos.y, eyePos.z);
//seg.Direction() = Mgc::Vector3(
// sunPos.x - eyePos.x,
// sunPos.y - eyePos.y,
// sunPos.z - eyePos.z);
// Do intersection test on the scenery for the current room.
if (m_pLevel->GetScene()->LineIntersects(eyePos, sunPos, 1.0f /* some radius */ ))
{
return; // Sun is obscured.
}
// We should draw the lens flare. Get the Camera eye position and
// "look at" position (some point along the line we are pointing at).
GetEngine()->PushColour(1.0f, 1.0f, 1.0f, 1.0f);
//GetEngine()->GetLensflare()->Draw(
// GetEngine()->GetDayNightSky()->GetSunPosition(),
// eyePos,
// pCam->GetLookAtPos() );
GetEngine()->PopColour();
}
}
}
示例3: DoUpdate
// Called frequently, this should move the item
// In this case we also accept cursor key presses to change the speed
// Space will set the speed to zero
void DoUpdate( int iCurrentTime )
{
// Change speed if player presses a key
if ( GetEngine()->IsKeyPressed( SDLK_UP ) )
m_dSY -= 0.001;
if ( GetEngine()->IsKeyPressed( SDLK_DOWN ) )
m_dSY += 0.001;
if ( GetEngine()->IsKeyPressed( SDLK_LEFT ) )
m_dSX -= 0.001;
if ( GetEngine()->IsKeyPressed( SDLK_RIGHT ) )
m_dSX += 0.001;
if ( GetEngine()->IsKeyPressed( SDLK_SPACE ) )
m_dSX = m_dSY = 0;
// Alter position for speed
m_dX += m_dSX;
m_dY += m_dSY;
// Check for bounce off the edge
if ( (m_dX+m_iStartDrawPosX) < 0 )
{
m_dX = - m_iStartDrawPosX;
if ( m_dSX < 0 )
m_dSX = -m_dSX;
}
if ( (m_dX+m_iStartDrawPosX+m_iDrawWidth) > (GetEngine()->GetScreenWidth()-1) )
{
m_dX = GetEngine()->GetScreenWidth() -1 - m_iStartDrawPosX - m_iDrawWidth;
if ( m_dSX > 0 )
m_dSX = -m_dSX;
}
if ( (m_dY+m_iStartDrawPosY) < 0 )
{
m_dY = -m_iStartDrawPosY;
if ( m_dSY < 0 )
m_dSY = -m_dSY;
}
if ( (m_dY+m_iStartDrawPosY+m_iDrawHeight) > (GetEngine()->GetScreenHeight()-1) )
{
m_dY = GetEngine()->GetScreenHeight() -1 - m_iStartDrawPosY - m_iDrawHeight;
if ( m_dSY > 0 )
m_dSY = -m_dSY;
}
// Set current position - you NEED to set the current positions
m_iCurrentScreenX = (int)(m_dX+0.5);
m_iCurrentScreenY = (int)(m_dY+0.5);
printf("Position %f, %f\n", m_dX, m_dY );
// Ensure that the object gets redrawn on the display, if something changed
RedrawObjects();
}
示例4: Enter
void CMessageBoxScene::Enter()
{
mpJoy=GetEngine()->FindComponent<CJoystickComponent>();
mPopup=true;
mTransOnTime=mTransOffTime=0.2f;
mpTexture=LoadSpriteTex(GetDevice(),mBgName.c_str());
}
示例5: start
int Ardb::FlushScripts()
{
KeyObject start(Slice(), SCRIPT, ARDB_GLOBAL_DB);
Iterator* iter = FindValue(start, false);
BatchWriteGuard guard(GetEngine());
while (NULL != iter && iter->Valid())
{
Slice tmpkey = iter->Key();
KeyObject* kk = decode_key(tmpkey, NULL);
if (NULL != kk)
{
if (kk->type == SCRIPT)
{
DelValue(*kk);
} else
{
break;
}
}
DELETE(kk);
iter->Next();
}
DELETE(iter);
return 0;
}
示例6: GetEngine
void LocationDlg::OnReset( wxCommandEvent &event )
{
vtAnimPathEngine *engine = GetEngine(m_iAnim);
engine->Reset();
if (m_bActive)
engine->UpdateTargets();
}
示例7: GetAnim
void LocationDlg::RefreshAnimsText()
{
wxTreeItemIdValue cookie;
wxTreeItemId id;
uint i, num = m_pAnimPaths->size();
for (i = 0; i < num; i++)
{
vtAnimEntry &entry = m_pAnimPaths->at(i);
vtAnimPath *anim = GetAnim(i);
vtAnimPathEngine *eng = GetEngine(i);
if (id.IsOk())
id = GetAnimTree()->GetNextChild(m_root, cookie);
else
id = GetAnimTree()->GetFirstChild(m_root, cookie);
wxString str(entry.m_Name, wxConvUTF8);
wxString str2;
str2.Printf(_T(" (%.1f/%.1f, %d)"), eng->GetTime(),
(float) anim->GetLastTime(), anim->NumPoints());
str += str2;
GetAnimTree()->SetItemText(id, str);
}
}
示例8: InitializeIIDs
CLREnvelopeEditorCtrl::CLREnvelopeEditorCtrl()
{
InitializeIIDs(&IID_DLREnvelopeEditor, &IID_DLREnvelopeEditorEvents);
//control data
m_lFirstKeyPosition=0;
m_lLastKeyPosition=60;
m_lMouseMode=0;
m_fLowValue=0.0f;
m_fHighValue=1.0f;
m_lEnvelopeType=LR::SHAPE_TCB;
m_bDirtyValues=m_bDirtyPositions=FALSE;
m_lDragMode=0;
m_bHasSelection=FALSE;
m_lFirstSelectedPosition=0;
m_lLastSelectedPosition=0;
//does not really matter since OnDraw will update it before any mouse
//events get to the control but ...
m_RCCtrlArea.left=0;
m_RCCtrlArea.right=1;
m_RCCtrlArea.top=0;
m_RCCtrlArea.bottom=1;
m_bMouseOverKeyRange=FALSE;
m_lKeyUnderMouse=-1;
m_lDraggedKey=-1;
m_lSelectedKey=-1;
m_bIsDragging=FALSE;
m_CurveColor=RGB(255,0,0);
LR::Engine *pEngine=NULL;
GetEngine(&pEngine);
pEngine->createEnvelope(m_pEnvelope);
pEngine->Release();
}
示例9: GetEngine
void ScriptController::onKeyRelease( const KeyEvent& event )
{
if( !enabled || !state )
return;
Engine* engine = GetEngine();
}
示例10: if
LONG CSkinItemEdit::GetBorderHelper(LONG clrNormal, LONG clrHover, LONG clrFocus, LONG clrReadOnly, LONG clrDisabled)
{
LONG color = 0;
if (IsReadOnly() && m_bReadOnlyBorder) {
color = clrReadOnly;
} else if (IsFocused() && m_bFocusBorder) {
color = clrFocus;
} else if (IsHot()) {
color = clrHover;
} else {
color = clrNormal;
}
if (GetDisabled())
color = clrDisabled;
if (color == -1)
color = clrNormal;
if (color == -1)
return -1;
if (GetColorTransform()) {
GetEngine()->TransformColor(color, color);
}
return color;
}
示例11: Assert
void EngineRunningBase::DrawGameObjectShadows()
{
Assert(m_pLevel.GetPtr());
// Iterate over the game objects which are in the current level/room.
int levelId = m_pLevel->GetId();
int roomId = m_pLevel->GetRoomId();
// Get the game objects which are in the same room as the player.
GameObjectMap& objs = GetEngine()->GetGameObjects(levelId, roomId);
// Iterate through map of Game Objects. Check each one in the Game State
// to see if it has been collected/killed/whatever.
for (GameObjectMap::iterator it = objs.begin(); it != objs.end(); ++it)
{
PPoolGameObject pGo = it->second;
if (pGo->IsVisible())
{
VisibleGameObject* pVgo = dynamic_cast<VisibleGameObject*>(pGo.GetPtr());
// Check state of object.
State s = pVgo->GetState();
//Engine::Instance()->GetEngineState()->GetState(gameObjId, &s);
// POOL: some pool-specific states here
if (s != OUT_OF_PLAY &&
s != BALL_IN_POCKET &&
s != BALL_OUT_OF_BOUNDS)
{
pVgo->DrawShadow();
}
}
}
}
示例12: CreateD3DFont
void CreditScene::Enter()
{
std::cout << "HelpScene::enter\n";
mTransOnTime = 2; // slow fade in
mTransOffTime = 0; // slow fade out
// load the media
mpFont = CreateD3DFont(GetDevice(), "Arial", 24, true);
mpButtonTex[0] = LoadSpriteTex(GetDevice(), "../media/scene/Back1.png");
mpButtonTex[1] = LoadSpriteTex(GetDevice(), "../media/scene/Back2.png");
mpBG = LoadSpriteTex(GetDevice(), "../media/scene/Credits.png");
mpButtonB = LoadSpriteTex(GetDevice(), "../media/scene/ButtonB.png");
mpCreditSFX = GetEngine()->FindComponent<CSoundComponent>();
mpGamepad = GetEngine()->FindComponent<CGamepadComponent>();
}
示例13: PowerupProperties
Super::Super(BaseEngine* pEngine )
: PowerupProperties( pEngine )
{
// Current and previous coordinates for the object - set them the same
//initially
m_iCurrentScreenX = m_iPreviousScreenX = (rand() % GetEngine()->GetScreenWidth());
m_iCurrentScreenY = m_iPreviousScreenY = (rand() % GetEngine()->GetScreenHeight());
// The object coordinate will be the top left of the object
m_iStartDrawPosX = 0;
m_iStartDrawPosY = 0;
setPowerupType(SUPER);
// And make it visible
SetVisible(true);
}
示例14: WinMain
DGLE_DYNAMIC_FUNC
#define APP_CAPTION "Asteroids Game"
#ifdef _DEBUG
# define DLL_PATH "..\\..\\..\\..\\bin\\windows\\DGLE.dll"
#else
# define DLL_PATH "..\\..\\DGLE.dll"
#endif
#define SCREEN_WIDTH 1024u
#define SCREEN_HEIGHT 768u
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
IEngineCore *pEngineCore = NULL;
if (GetEngine(DLL_PATH, pEngineCore))
{
CGame game(pEngineCore);
if (SUCCEEDED(pEngineCore->InitializeEngine(NULL, APP_CAPTION, TEngineWindow(SCREEN_WIDTH, SCREEN_HEIGHT, false, false, MM_4X))))
pEngineCore->StartEngine();
FreeEngine();
}
else
MessageBox(NULL,"Couldn't load \""DLL_PATH"\"!", APP_CAPTION, MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
return 0;
}
示例15: SetSearchDirection
void SetSearchDirection(V3 direction) {
searchDirection = direction;
if (Equals(searchDirection, V3(0.0f))) {
LogError("GJK Set searchDirection to [0, 0, 0]");
GetEngine()->isPaused = true;
}
}