Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (!endApp)
- {
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
- //clears the frame buffer
- TheScreen::Instance()->ClearScreen();
- //updates input manager
- TheInput::Instance()->Update();
- KeyState key = TheInput::Instance()->GetKeyState();
- //break out of loop if X is clicked or space is pressed;
- if ((TheInput::Instance()->IsXClicked()) || (key[SDL_SCANCODE_SPACE]) || (key[SDL_SCANCODE_Q]))
- {
- endApp = true;
- }
- mouseX = TheInput::Instance()->GetMouseMotionX() / 100;
- mouseY = TheInput::Instance()->GetMouseMotionY() / 100;
- glPushMatrix();
- glTranslatef(mouseX, mouseY, 0.0f);
- glBegin(GL_QUADS);
- //Top left corner
- glColor3f(1, 0, 1);
- glVertex3f(0.0f, 0.0f, 0.0f);
- //Top right corner
- glColor3f(1, 0, 0);
- glVertex3f(128.0f, 0.0f, 0.0f);
- //Bottom right corner
- glColor3f(1, 0, 1);
- glVertex3f(128.0f, 128.0f, 0.0f);
- //Bottom left corner
- glColor3f(1, 0, 1);
- glVertex3f(0.0f, 128.0f, 0.0f);
- glEnd();
- glPopMatrix();
- // PUT THIS IN DEBUG MANAGER
- GLenum errorCode = glGetError();
- if (errorCode == GL_NO_ERROR)
- {
- std::cout << "no error" << std::endl;
- }
- else if (errorCode == GL_INVALID_OPERATION)
- {
- std::cout << "error" << std::endl;
- }
- //Swap buffers
- TheScreen::Instance()->SwapBuffer();
- SDL_Delay(10000 / 60);
- }
Add Comment
Please, Sign In to add comment