Merge branch 'master' of https://github.com/jsmaniac/2011-m2s3-city-builder
Conflit pas complètement résolu. Conflicts: Makefile view.cpp
This commit is contained in:
commit
9bda8b0370
2
Makefile
2
Makefile
|
@ -8,7 +8,7 @@ CFLAGS=-O0 -g -rdynamic -I. $(CCWARN)
|
||||||
|
|
||||||
SOURCES = $(shell echo *.cpp geometry/*.cpp rules/*.cpp)
|
SOURCES = $(shell echo *.cpp geometry/*.cpp rules/*.cpp)
|
||||||
HEADERS = $(shell echo *.hh geometry/*.hh rules/*.hh)
|
HEADERS = $(shell echo *.hh geometry/*.hh rules/*.hh)
|
||||||
LIBS = -lm -lGL -lGLU -lSDL -lSDL_image -lGLEW
|
LIBS = -lm -lGL -lGLU -lSDL -lSDL_image -lGLEW -lglut
|
||||||
EXECUTABLE = city
|
EXECUTABLE = city
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
|
@ -4,10 +4,11 @@ Minimal requirements
|
||||||
* `g++` et GNU `make` (paquet `build-essential`)
|
* `g++` et GNU `make` (paquet `build-essential`)
|
||||||
* `libsdl-dev`
|
* `libsdl-dev`
|
||||||
* `libglew-dev`
|
* `libglew-dev`
|
||||||
|
* `freeglut3-dev`
|
||||||
|
|
||||||
The following command should install the required packages on ubuntu.
|
The following command should install the required packages on ubuntu.
|
||||||
|
|
||||||
sudo apt-get install build-essential libsdl-dev libglew-dev
|
sudo apt-get install build-essential libsdl-dev libglew-dev freeglut3-dev
|
||||||
|
|
||||||
How to run this program ?
|
How to run this program ?
|
||||||
=========================
|
=========================
|
||||||
|
|
|
@ -21,6 +21,12 @@ class Chose;
|
||||||
#include <GL/glu.h>
|
#include <GL/glu.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
|
|
||||||
|
// Affichage du FPS
|
||||||
|
#include <GL/freeglut.h>
|
||||||
|
//#include <openglut.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
#include "geometry/directions.hh"
|
#include "geometry/directions.hh"
|
||||||
#include "geometry/vertex.hh"
|
#include "geometry/vertex.hh"
|
||||||
#include "geometry/angle.hh"
|
#include "geometry/angle.hh"
|
||||||
|
|
1
main.cpp
1
main.cpp
|
@ -1,6 +1,7 @@
|
||||||
#include "all_includes.hh"
|
#include "all_includes.hh"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
glutInit(&argc, argv);
|
||||||
// Générer une tile de base
|
// Générer une tile de base
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
Chose::initialSeed = (unsigned int) atoi(argv[1]);
|
Chose::initialSeed = (unsigned int) atoi(argv[1]);
|
||||||
|
|
|
@ -47,7 +47,7 @@ bool MurQuad::split() {
|
||||||
Quad lefth = Quad(ch[NE],ch[SE],windowPosh[SE],windowPosh[NE]);
|
Quad lefth = Quad(ch[NE],ch[SE],windowPosh[SE],windowPosh[NE]);
|
||||||
Quad top = Quad(windowPosh[NE],windowPosh[NW],windowPosh[SW],windowPosh[SE]);
|
Quad top = Quad(windowPosh[NE],windowPosh[NW],windowPosh[SW],windowPosh[SE]);
|
||||||
|
|
||||||
addChild(new MurQuad(c,windowPos,false, !door, false));
|
if (!door) addChild(new MurQuad(c,windowPos,false, true, false));
|
||||||
addChild(new MurQuad(windowPosh,ch, false, false, true));
|
addChild(new MurQuad(windowPosh,ch, false, false, true));
|
||||||
addChild(new MurQuad(left,lefth,false));
|
addChild(new MurQuad(left,lefth,false));
|
||||||
addChild(new MurQuad(right,righth,false));
|
addChild(new MurQuad(right,righth,false));
|
||||||
|
|
33
view.cpp
33
view.cpp
|
@ -162,6 +162,15 @@ void View::renderScene(int lastTime, int currentTime) {
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float fps = (int)(1000/(currentTime-lastTime));
|
||||||
|
char text[100]; // Text
|
||||||
|
snprintf(&(text[0]), 100, "FPS: %4.2f", fps);
|
||||||
|
glLoadIdentity ();
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glColor3f(0.0f, 0.0f, 0.0f);
|
||||||
|
//glRasterPos3f (0, 0, 0);
|
||||||
|
glutBitmapString(GLUT_BITMAP_TIMES_ROMAN_24, (unsigned char*)(&(text[0])));
|
||||||
|
|
||||||
glFlush();
|
glFlush();
|
||||||
SDL_GL_SwapBuffers();
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
@ -257,6 +266,29 @@ void Camera::keyboard(const SDL_KeyboardEvent &eventKey) {
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
default :
|
||||||
|
switch(SDL_GetKeyName(eventKey.keysym.sym)[0]) {
|
||||||
|
case 'q':
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
if (eventKey.type != SDL_KEYDOWN) break;
|
||||||
|
moveSensitivity = std::min(50000,std::max(moveSensitivity+1, moveSensitivity*10/9));
|
||||||
|
break;
|
||||||
|
case 'x':
|
||||||
|
if (eventKey.type != SDL_KEYDOWN) break;
|
||||||
|
moveSensitivity = std::max(10, moveSensitivity*9/10);
|
||||||
|
break;
|
||||||
|
case 'p': // _Print _Position
|
||||||
|
if (eventKey.type != SDL_KEYDOWN) break;
|
||||||
|
std::cout << *this << std::endl;
|
||||||
|
break;
|
||||||
|
case SDLK_PAGEDOWN:
|
||||||
|
pageDown = (eventKey.type == SDL_KEYDOWN);
|
||||||
|
break;
|
||||||
|
case SDLK_ESCAPE:
|
||||||
|
exit(0);
|
||||||
|
break;
|
||||||
default :
|
default :
|
||||||
switch(SDL_GetKeyName(eventKey.keysym.sym)[0]) {
|
switch(SDL_GetKeyName(eventKey.keysym.sym)[0]) {
|
||||||
case 'q':
|
case 'q':
|
||||||
|
@ -280,6 +312,7 @@ void Camera::keyboard(const SDL_KeyboardEvent &eventKey) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user