Commits

Pierre Surply committed f70cd52

:odif light

Comments (0)

Files changed (2)

 ** <pierre.surply@gmail.com>
 ** 
 ** Started on  Mon Aug 20 16:44:28 2012 Pierre Surply
-** Last update Tue Aug 21 00:23:30 2012 Pierre Surply
+** Last update Tue Aug 21 01:33:17 2012 Pierre Surply
 */
 
 #include <SDL/SDL.h>
 #define WINDOW_H 480
 #define WINDOW_TITLE "Empty Dungeon"
 
+#define GAME_SPEED 10
+
+#define LIGHT_EFFECT 1
+
 void init(void)
 {
   SDL_Init(SDL_INIT_VIDEO);
 
   glMatrixMode(GL_PROJECTION);
   glLoadIdentity();
-  gluPerspective(40,(double)WINDOW_W/WINDOW_H,0.005,1000);
+  gluPerspective(40,(double)WINDOW_W/WINDOW_H,0.001,1000);
   glEnable(GL_DEPTH_TEST);
   glEnable(GL_TEXTURE_2D);
+#if LIGHT_EFFECT == 1
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
   glEnable(GL_COLOR_MATERIAL);
+#endif
 }
 
 void draw(map* m, player* p, textures* t)
 {
+#if LIGHT_EFFECT == 1
   float LightPos[4] = {.5f,.5f,0.9f,1.0f};
   float LightDif[4] = {1.f,.5f,0.f,1.f};
-  float LightAmbient[4] = {-0.15f,-0.15f,-0.15f,1.0f};
+  float LightAmbient[4] = {0.4f,0.4f,0.4f,1.0f};
 
   glColorMaterial(GL_FRONT,GL_AMBIENT_AND_DIFFUSE);
   glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,LightAmbient);
   glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,LightDif);
+#endif
 
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
   glMatrixMode( GL_MODELVIEW );
   glLoadIdentity();
-
+#if LIGHT_EFFECT == 1
   glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmbient);
   glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
   glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDif);
-  
+#endif
   gluLookAt(0, 0, 0.5f,\
 	    1, 0, 0.5f, \
 	    0, 0, 1);
       events_update(&e);
       player_events(&p, &e, &m);
       draw(&m, &p, &t);
-      SDL_Delay(20);
+#if GAME_SPEED > 0
+      SDL_Delay(GAME_SPEED);
+#endif
     }
   
   SDL_Quit();
 ** <pierre.surply@gmail.com>
 ** 
 ** Started on  Mon Aug 20 19:07:56 2012 Pierre Surply
-** Last update Mon Aug 20 22:52:01 2012 Pierre Surply
+** Last update Tue Aug 21 01:27:12 2012 Pierre Surply
 */
 
 #include <SDL/SDL.h>
 #include "player.h"
 
 #define PI 3.14159265
-#define SPEED 0.15
+#define SPEED 0.2
 #define SPEED_ROT 3
 #define SPEED_LAT 0.1
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.