本文整理汇总了C++中AnimatedSprite::SetAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimatedSprite::SetAnimation方法的具体用法?C++ AnimatedSprite::SetAnimation怎么用?C++ AnimatedSprite::SetAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimatedSprite
的用法示例。
在下文中一共展示了AnimatedSprite::SetAnimation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//new object
float Spoints[] = {
-0.25f, -0.5f, 0.0f,
-0.25f, -0.75f, 0.0f,
0.25f, -0.5f, 0.0f,
0.25f, -0.75f, 0.0f
};
GLuint VBO2 = 0;
glGenBuffers(1, &VBO2);
glBindBuffer(GL_ARRAY_BUFFER, VBO2);
glBufferData(GL_ARRAY_BUFFER, 12 * sizeof (float), Spoints, GL_STATIC_DRAW);
GLuint VAO2 = 0;
glGenVertexArrays(1, &VAO2);
glBindVertexArray(VAO2);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (GLubyte*)NULL);
const char* vertex_shader2 =
"#version 330\n"
"in vec3 vp;\n"
"void main() {"
"gl_position = vec4(vp, 2.0);\n"
"}";
const char* fragment_shader2 =
"#version 330\n"
"out vec4 frag_colour;\n"
"void main() {"
"frag_colour = vec4(0.5, 0.0, 0.0, 1.0);\n"
"}";
//create a shader
GLuint vs2 = glCreateShader(GL_VERTEX_SHADER);
//put the actual char* in the shader
glShaderSource(vs2, 1, &vertex_shader2, NULL);
//compile the shader
glCompileShader(vs2);
PrintShaderInfoLog(vs2);
GLuint fs2 = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fs2, 1, &fragment_shader2, NULL);
glCompileShader(fs2);
PrintShaderInfoLog(fs2);
//create the container that holds the shaders
GLuint secondProgram = glCreateProgram();
//attach the shaders
glAttachShader(secondProgram, fs2);
glAttachShader(secondProgram, vs2);
//this inks the shaders together, its kinda like a compile
glLinkProgram(secondProgram);
PrintProgramInfoLog(secondProgram);
*/
Ortho = new Matrix4();
Orthographic(0, g_gl_width, g_gl_height, 0, 0, -1, Ortho);
//Quad * tester1 = new Quad();
AnimatedSprite * tester = new AnimatedSprite("../resources/MegamanXSheet.xml", window);
tester->SetAnimation("teleport", ONCE);
while (!glfwWindowShouldClose(window)) {
//_update_fps_counter(window);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5);
glEnable(GL_ALPHA);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glFrontFace(GL_CW);
//wipe the drawing surface
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//resize window
glViewport (0, 0, g_gl_width, g_gl_height);
tester->Update();
//tester->Draw();
//tester->Input();
//update other events like input handling
glfwPollEvents();
//put the stuff we've been drawing into the display
glfwSwapBuffers(window);
resetDeltaTime();
if (GLFW_PRESS == glfwGetKey(window, GLFW_KEY_ESCAPE)) {
glfwSetWindowShouldClose(window, 1);
}
}
//close GL context and any other GLFW resources
//delete Ortho;
//delete tester;
glfwTerminate();
return 0;
}