本文整理汇总了C++中Entity::DrawSpriteSheetSprite方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::DrawSpriteSheetSprite方法的具体用法?C++ Entity::DrawSpriteSheetSprite怎么用?C++ Entity::DrawSpriteSheetSprite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::DrawSpriteSheetSprite方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render(const int* runAnimationTemp, int& index) {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
ship.DrawSpriteSheetSprite(ship.textureID, runAnimationTemp[index], 8, 4);
SDL_GL_SwapWindow(displayWindow);
}
示例2: main
int main(int argc, char *argv[]) {
bool done = false;
bool gameOn = false;
float lastFrameTicks = 0.0f;
float ballAngle = 0.0f;
const int runAnimation[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
const int numFrames = 8;
float animationElapsed = 0.0f;
float framesPerSecond = 30.0f;
int currentIndex = 0;
Setup();
while (!done) {
float ticks = (float)SDL_GetTicks() / 1000.0f;
float elapsed = ticks - lastFrameTicks;
lastFrameTicks = ticks;
animationElapsed += elapsed;
if (animationElapsed > 1.0 / framesPerSecond) {
currentIndex++;
animationElapsed = 0.0;
if (currentIndex > numFrames - 1) {
currentIndex = 0;
}
}
ProcessEvents(done, elapsed, gameOn);
Update();
Render(runAnimation, currentIndex);
}
ship.DrawSpriteSheetSprite(ship.textureID, runAnimation[currentIndex], 8, 4);
SDL_Quit();
return 0;
}