Florian DORMONT 10 anni fa
parent
commit
1745093737
4 ha cambiato i file con 8 aggiunte e 3 eliminazioni
  1. 1 2
      include/Map.h
  2. 3 1
      include/timers.h
  3. 3 0
      src/Map.cpp
  4. 1 0
      src/main.cpp

+ 1 - 2
include/Map.h

@@ -15,7 +15,7 @@ namespace WalrusRPG
 			unsigned int height;
 			unsigned *layer0;
 			unsigned *layer1;
-
+			// TODO?: add a boolean/getter to know if a second layer exist?
 		public:
 			Map(int width, int height, unsigned *layer0, unsigned *layer1);
 			~Map();
@@ -26,4 +26,3 @@ namespace WalrusRPG
 }
 
 #endif
-

+ 3 - 1
include/timers.h

@@ -6,6 +6,9 @@ extern "C"
 {
 #endif
 
+// TODO : Move these functions to C++ namespace
+// TODO : add defines/const values to make the modes more clearer to read
+
 void timer_init(unsigned timer);
 void timer_restore(unsigned timer);
 void timer_mode(unsigned timer, unsigned mode);
@@ -16,4 +19,3 @@ unsigned timer_read(unsigned timer);
 }
 #endif
 #endif
-

+ 3 - 0
src/Map.cpp

@@ -38,6 +38,7 @@ void MAP::render(WalrusRPG::Camera &camera, unsigned dt) const
 	signed end_y = start_y + 16;
 
 	// Bound-checking code. To avoid reading outside of the map.
+	// The offset edition allows the map to be correctly moved to the right to make up for the lack of renderable tiles.
 	if(start_x < 0){
 		offset_x -= start_x*24;
 		start_x = 0;
@@ -47,6 +48,7 @@ void MAP::render(WalrusRPG::Camera &camera, unsigned dt) const
 		offset_y -= start_y*24;
 		start_y = 0;
 	}
+	// warning fix. Even if end_x/y is negative, it should be higher than width/height.
 	if((unsigned)end_x > this->width) end_x = this->width;
 	if((unsigned)end_y > this->height) end_y = this->height;
 
@@ -54,6 +56,7 @@ void MAP::render(WalrusRPG::Camera &camera, unsigned dt) const
 	signed delta_x = end_x - start_x;
 	signed delta_y = end_y - start_y;
 
+	// Creating a region clip. Why does it smell like SDL?
 	WalrusRPG::Graphics::Rect_t sprite;
 	sprite.y = 0;
 	sprite.w = 24;

+ 1 - 0
src/main.cpp

@@ -27,6 +27,7 @@ void map_loop(unsigned x, unsigned y, Map &map)
 		// Frameskip
 		if (timer_read(0) > loop_next)
 		{
+			// TODO?: Preset color macros/consts?
 			buffer_fill(0xff0000);
 			map.render(camera, 1);
 			lcd_vsync();