Explorar o código

Various fixes

Eiyeron Fulmincendii %!s(int64=10) %!d(string=hai) anos
pai
achega
3f5fd3d4ee
Modificáronse 4 ficheiros con 10 adicións e 10 borrados
  1. 5 5
      platform/nspire/Texure.cpp
  2. 3 3
      src/engine/main.cpp
  3. 1 1
      src/render/TileRenderer.cpp
  4. 1 1
      src/render/TileRenderer.h

+ 5 - 5
platform/nspire/Texure.cpp

@@ -38,14 +38,14 @@ Texture::Texture(File entry)
     for(unsigned y = 0; y < height; y++)
     {
         for (unsigned x = 0; x < width; x++) {
-            uint16_t color = (pic[(y*width + x)]>>3)<<11;
-            color |= (pic[(y*width + x + 1)]>>2)<<5;
-            color |= (pic[(y*width + x + 2)]>>3);
-            if(pic[(y*width + x +3)] == 0)
+            uint16_t color = (pic[(y*width + x)*4]>>3)<<11;
+            color |= (pic[(y*width + x)*4 + 1]>>2)<<5;
+            color |= (pic[(y*width + x)*4 + 2]>>3);
+            if(pic[(y*width + x)*4+3] == 0)
             {
                 data[2] = color;
             }
-            data[y*width + x] = color;
+            data[y*width + x+3] = color;
         }
     }
     delete[] pic;

+ 3 - 3
src/engine/main.cpp

@@ -31,10 +31,10 @@ int main(int argc, char *argv[])
     uint16_t* dungeonTest = new uint16_t[f1.file_size/2+1];
     uint16_t* dungeonTest2 = new uint16_t[f1.file_size/2+1];
 
-    for(unsigned i = 0; i < f1.file_size; i+=2)
+    for(unsigned i = 0; i < f1.file_size; i++)
     {
-        dungeonTest[i/2] = read_big_endian_value<uint16_t>(&l1[i]);
-        dungeonTest2[i/2] = read_big_endian_value<uint16_t>(&l2[i]);
+        dungeonTest[i] = read_big_endian_value<uint16_t>(&l1[i*1]);
+        dungeonTest2[i] = read_big_endian_value<uint16_t>(&l2[i*1]);
     }
 
     Map map(20, 20, dungeonTest, dungeonTest2, tex);

+ 1 - 1
src/render/TileRenderer.cpp

@@ -5,7 +5,7 @@
 using namespace WalrusRPG;
 using namespace WalrusRPG::Utils;
 
-TILERENDERER::TileRenderer(WalrusRPG::Graphics::Texture _tilesheet, unsigned tile_width,
+TILERENDERER::TileRenderer(WalrusRPG::Graphics::Texture& _tilesheet, unsigned tile_width,
                            unsigned tile_height)
     : tilesheet(_tilesheet), tile_width(tile_width), tile_height(tile_height)
 {

+ 1 - 1
src/render/TileRenderer.h

@@ -15,7 +15,7 @@ namespace WalrusRPG
         unsigned tile_height;
 
       public:
-        TileRenderer(WalrusRPG::Graphics::Texture tilesheet, unsigned tile_width,
+        TileRenderer(WalrusRPG::Graphics::Texture& tilesheet, unsigned tile_width,
                      unsigned tile_height);
         void render(const unsigned id, const WalrusRPG::Utils::Rect &rect);