Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // oglApplication.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "3rd\glew\include\GL\glew.h"
- #include "3rd\glm\glm.hpp"
- #include "3rd\GLFW\include\glfw3.h"
- #include "Game.h"
- #include "Content.h"
- #include "Effect.h"
- #include "Keyboard.h"
- double xpos;
- double ypos;
- int _tmain(int argc, _TCHAR* argv[]) {
- // inicjlizacja GLFW
- if (!glfwInit()) {
- return -1;
- }
- glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
- glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
- glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
- glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_FALSE);
- glfwWindowHint(GLFW_SAMPLES, 2);
- GLFWwindow* window;
- window = glfwCreateWindow( 800, 600, "GlGame4", NULL, NULL);
- if ( !window ) {
- glfwTerminate();
- return -1;
- }
- glfwMakeContextCurrent(window);
- GLenum err = glGetError();
- if( err ) {
- fprintf( stderr, "ERROR: %s\n", glewGetErrorString( err ) );
- exit(EXIT_FAILURE);
- }
- // inicjalizacja GLEW
- glewExperimental = GL_TRUE;
- GLenum GlewInitResult;
- GlewInitResult = glewInit();
- if (GLEW_OK != GlewInitResult) {
- fprintf( stderr, "ERROR: %s\n", glewGetErrorString(GlewInitResult));
- exit(EXIT_FAILURE);
- }
- // glowna petla gry
- Game game;
- game.Init();
- Keyboard::KeyboardInit();
- glEnable(GL_DEPTH_TEST);
- while (!glfwWindowShouldClose(window))
- {
- // rendering
- game.Update();
- game.Redraw();
- glfwSwapBuffers(window);
- glfwPollEvents();
- //mysz - obrot kamery dookola
- int state_left = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT);
- if (state_left == GLFW_PRESS)
- {
- Game::lewy = 1;
- }
- if (state_left == GLFW_RELEASE)
- {
- Game::lewy = 0;
- }
- int state_right = glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_RIGHT);
- if (state_right == GLFW_PRESS)
- {
- Game::prawy = 1;
- }
- if (state_right == GLFW_RELEASE)
- {
- Game::prawy = 0;
- }
- //mysz - blokowanie
- //glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
- //mysz - chowanie kursora
- //glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
- glfwGetCursorPos(window, &xpos, &ypos);
- glfwSetWindowTitle(window, "GL GAME");
- }
- glfwTerminate();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement