From a0749269bae73cd050d3bf0258426489d0d2c706 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9au?= <theau.baton@etu.univ-amu.fr>
Date: Tue, 29 Oct 2024 16:58:39 +0100
Subject: [PATCH] Transfering file to the good place

---
 assets/textures/Cube_GLab_1.png | Bin 0 -> 282 bytes
 assets/textures/Cube_GLab_2.png | Bin 0 -> 282 bytes
 assets/textures/Cube_GLab_3.png | Bin 0 -> 282 bytes
 assets/textures/Cube_White.png  | Bin 0 -> 282 bytes
 source/main.cpp                 | 126 +++++++++++---------------------
 5 files changed, 44 insertions(+), 82 deletions(-)
 create mode 100644 assets/textures/Cube_GLab_1.png
 create mode 100644 assets/textures/Cube_GLab_2.png
 create mode 100644 assets/textures/Cube_GLab_3.png
 create mode 100644 assets/textures/Cube_White.png

diff --git a/assets/textures/Cube_GLab_1.png b/assets/textures/Cube_GLab_1.png
new file mode 100644
index 0000000000000000000000000000000000000000..dde2eea7829efe08f4841cd5e0c2f832fb243d6c
GIT binary patch
literal 282
zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4rT@h2A3sW#~2tG7>k44ofy`glX=O&z`&C3
z=<CS9u(6-}Pa-P=0|QThPl)SNOVgQZD*prh85kHU?0@8d)RhGJ1^@s5pTR+E<rfA9
z2F?PH$YKTtz5^i4n02j_lYxPu-P6S}#KQmWBu}vh1)if4@9NX7S)OSBvT2C?kTE&c
zTfFO_cuL7z1Gdu*yb+S0yJv2YV~l1LKF`eJ6MgTkd)Cv<OHH}wO-^&!;2(4T!Mr7L
zOuieA3C-cuo1h@f6VnuR)Bm5s#>Iyisvl$&GO9hukX_Sgd`Vyqr`TQ=<v?9WwN?6!
e>Z_{l8E&exE)3hvzl(u^fx*+&&t;ucLK6TM*<FqR

literal 0
HcmV?d00001

diff --git a/assets/textures/Cube_GLab_2.png b/assets/textures/Cube_GLab_2.png
new file mode 100644
index 0000000000000000000000000000000000000000..5529901db2254ea4a144a954502f548275c7c47e
GIT binary patch
literal 282
zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4rT@h2A3sW#~2tG7>k44ofy`glX=O&z`&C3
z=<CS9u(6-}Pa-P=0|QThPl)UP0_Pj?R{uNG7#J8HzG`FvsVfQc3;zHAKZAqT$}bEI
z44efXk;M!Qd<Q_7G3#0<Cj$dRyQhm|h=u>#NuFX23Oq+8-qojDvpmuMWz!J(A!Bl?
zw|Lh<@syIc25hGrcq1e~chB4)#~95he4d%bC;Hx7_pGOzmzr|Vo1Esd!9V8wgLzBh
zn0z-J6Pm-RH$g#|C#EUtrvE>Mjf)R4R6oclWK?^QA-ks0_>#aJPO-f#%7MC$YOC}c
e)mK&9Gu%{XT^P2Te-{G-1B0ilpUXO@geCw&*<Swu

literal 0
HcmV?d00001

diff --git a/assets/textures/Cube_GLab_3.png b/assets/textures/Cube_GLab_3.png
new file mode 100644
index 0000000000000000000000000000000000000000..5d5da902f3a75d14435bc76d5c0cb9fc7d2a4fdc
GIT binary patch
literal 282
zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4rT@h2A3sW#~2tG7>k44ofy`glX=O&z`&C3
z=<CS9u(6-}Pa-P=0|QThPl)UP<!Z+oWdHApV_;yAwO;oTq^=~$FZloe{|pXVE59%>
zFmM)lL>4nJ@ErhQ#;j|doD2*M?Vc`<Ar}5`CwYoBDDWJWcvqip&GJP1mrX<Dhm6Uo
z-r`*c#ZyY&8nB&i;Ej;{+&y!H9Ah-2@OfqypXhsU-Lsx<UTVrcZ*rQ;2LG7z59Te2
zWAfc_OlS_L-UJ0<o|vYnoBsb4HZDHIQ2ijIkWuYHhU}U~<4Xc_IK}p|C<p2~s;$y*
eR9{tX&u~+nbz#_U{#^_V3=E#GelF{r5}E)fj9%RU

literal 0
HcmV?d00001

diff --git a/assets/textures/Cube_White.png b/assets/textures/Cube_White.png
new file mode 100644
index 0000000000000000000000000000000000000000..7a051769c27b4638b734fbf8271301b351245541
GIT binary patch
literal 282
zcmeAS@N?(olHy`uVBq!ia0y~yU{C;I4rT@h2A3sW#~2tG7>k44ofy`glX=O&z`&C3
z=<CS9u(6-}Pa-P=0|QThPl)T&r%(U?|G$6#eg+1H#c`{;K<Y|@{DS}g|Igr{wekxC
z0|RG)M`SSr1K$A<X3V<Q$;rUL(C+Et7-Hf7c9N%9g96V{iFfts)+|r7f7vude#n@d
z>Mh=NP&}pNtpVHV2HptC&)qXO$T3DU3ZG|Y@rl0o);;U#=B1|G^CqXcZ19gc|6tyd
zI40i>$Aso^>P=7(=80*Fy6OK<VdLUM4Al=Z3K`WNWXP^*G`=J-hf{1Xi*lf@quMI{
fM)g(I_6#@GSr>-w=HJD@z`)??>gTe~DWM4fd>&!E

literal 0
HcmV?d00001

diff --git a/source/main.cpp b/source/main.cpp
index 39b4cf1..1a7e290 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -34,7 +34,7 @@ int main(int argc, const char * argv[]) {
     try {
         //? Window
         megu::Window window;
-        window.open("Window", WINDOW_WIDTH, WINDOW_HEIGHT);
+        window.open("Isometric Window", 360, 360);
         megu::error::opengl_error::check();
 
         std::cout << "Window Inited" << std::endl;
@@ -42,22 +42,21 @@ int main(int argc, const char * argv[]) {
         //? Group
         megu::ImageGroup group;
         megu::ImageGroup group_2;
-        megu::ImageGroup group_3;
-
+       
         std::cout << "Group Inited" << std::endl;
 
         //? Image 1
         std::vector<int> map = {
-            2, 2, 1, 1, 1, 1, 1, 2, 0, 0,
-            0, 0, 2, 1, 1, 1, 1, 2, 0, 0,
-            0, 0, 0, 2, 1, 1, 2, 0, 0, 0,
-            0, 0, 0, 2, 1, 1, 2, 0, 0, 0,
-            0, 0, 0, 2, 1, 1, 2, 0, 0, 0,
-            0, 0, 0, 2, 1, 1, 2, 0, 0, 0,
-            0, 0, 2, 1, 1, 1, 1, 2, 0, 0,
-            0, 0, 2, 1, 1, 1, 1, 2, 0, 0,
-            0, 0, 0, 2, 1, 1, 2, 0, 0, 0,
-            0, 0, 0, 2, 2, 2, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 3, 3, 0, 0, 0, 0,
+            0, 0, 0, 3, 2, 2, 3, 0, 0, 0,
+            0, 0, 3, 2, 1, 1, 2, 3, 0, 0,
+            0, 3, 2, 2, 1, 1, 2, 2, 3, 0,
+            0, 3, 2, 1, 1, 1, 1, 2, 3, 0,
+            0, 1, 1, 0, 0, 0, 0, 1, 1, 0,
+            0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         };
 
         size_t x = 0;
@@ -66,10 +65,13 @@ int main(int argc, const char * argv[]) {
         std::vector<std::unique_ptr<megu::Image>> images;
 
         megu::Texture texture_1;
-        texture_1.store(megu::TextureBuffer("assets/textures/Cube_Blue.png"));
+        texture_1.store(megu::TextureBuffer("assets/textures/Cube_GLab_1.png"));
 
         megu::Texture texture_2;
-        texture_2.store(megu::TextureBuffer("assets/textures/Cube_Red.png"));
+        texture_2.store(megu::TextureBuffer("assets/textures/Cube_GLab_2.png"));
+
+        megu::Texture texture_3;
+        texture_3.store(megu::TextureBuffer("assets/textures/Cube_GLab_3.png"));
 
         for(auto id : map) {
             if(x == 10) {
@@ -79,10 +81,23 @@ int main(int argc, const char * argv[]) {
 
 
             if(id != 0) {
-                images.push_back(std::make_unique<megu::Image>(id == 1 ? texture_1 : texture_2));
+                switch (id) {
+                    case 1:
+                        images.push_back(std::make_unique<megu::Image>(texture_1));
+                        break;
+
+                    case 2:
+                        images.push_back(std::make_unique<megu::Image>(texture_2));
+                        break;
+
+                    case 3:
+                        images.push_back(std::make_unique<megu::Image>(texture_3));
+                        break;
+                }
+                
                 glm::vec2 pos = to_screen_coordinate({x, y}, 32.f, 32.f, 1.f);
 
-                images.back()->setPosition({pos.x + window.width()/2, pos.y + window.height()/2});
+                images.back()->setPosition({pos.x + window.width()/2 - 16.f, pos.y + window.height()/4});
             }
             
             ++x;
@@ -93,7 +108,7 @@ int main(int argc, const char * argv[]) {
             i.get()->setSize({32.f, 32.f});
         }
 
-        std::cout << "Image Inited 1" << std::endl;
+        std::cout << "Images 1 Inited" << std::endl;
 
         //? Image 2
         std::vector<int> map_2 = {
@@ -101,7 +116,7 @@ int main(int argc, const char * argv[]) {
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+            0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
             0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -114,22 +129,18 @@ int main(int argc, const char * argv[]) {
 
         std::vector<std::unique_ptr<megu::Image>> images_2;
 
-        megu::Texture texture_3;
-        texture_3.store(megu::TextureBuffer("assets/textures/Cube_Yellow.png"));
+        megu::Texture texture_4;
+        texture_4.store(megu::TextureBuffer("assets/textures/Cube_White.png"));
 
         for(auto id : map_2) {
             if(x_2 == 10) {
                 x_2 = 0;
                 ++y_2;
             }
-
-
-            if(id == 0) {
-                images_2.push_back(std::make_unique<megu::Image>(texture_3));
-                glm::vec2 pos = to_screen_coordinate({x_2, y_2}, 32.f, 32.f);
-
-                images_2.back()->setPosition({pos.x + window.width()/2, pos.y + window.height()/2});
-            }
+                
+            images_2.push_back(std::make_unique<megu::Image>(texture_4));
+            glm::vec2 pos = to_screen_coordinate({x_2, y_2}, 32.f, 32.f, 0.f);
+            images_2.back()->setPosition({pos.x + window.width()/2 - 16.f, pos.y + window.height()/4});
             
             ++x_2;
         }
@@ -139,53 +150,7 @@ int main(int argc, const char * argv[]) {
             i.get()->setSize({32.f, 32.f});
         }
 
-        std::cout << "Image Inited 3" << std::endl;
-
-        //? Image 2
-        std::vector<int> map_3 = {
-            1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-            0, 1, 0, 0, 0, 0, 0, 0, 1, 0,
-            0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
-            0, 0, 0, 1, 0, 0, 1, 0, 0, 0,
-            0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 
-            0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
-            0, 0, 0, 1, 0, 0, 1, 0, 0, 0,
-            0, 0, 1, 0, 0, 0, 0, 1, 0, 0,
-            0, 1, 0, 0, 0, 0, 0, 0, 1, 0,
-            1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
-        };
-
-        size_t x_3 = 0;
-        size_t y_3 = 0;
-
-        std::vector<std::unique_ptr<megu::Image>> images_3;
-
-        megu::Texture texture_4;
-        texture_4.store(megu::TextureBuffer("assets/textures/Cube_Green.png"));
-
-        for(auto id : map_3) {
-            if(x_3 == 10) {
-                x_3 = 0;
-                ++y_3;
-            }
-
-
-            if(id != 0) {
-                images_3.push_back(std::make_unique<megu::Image>(texture_4));
-                glm::vec2 pos = to_screen_coordinate({x_3, y_3}, 32.f, 32.f, 2.f);
-
-                images_3.back()->setPosition({pos.x + window.width()/2, pos.y + window.height()/2});
-            }
-            
-            ++x_3;
-        }
-
-        for(auto & i : images_3) {
-            group_3.add(*i);
-            i.get()->setSize({32.f, 32.f});
-        }
-
-        std::cout << "Image Inited 2" << std::endl;
+        std::cout << "Images 2 Inited" << std::endl;
 
         //? ImGui
         ImGui::CreateContext();
@@ -194,14 +159,11 @@ int main(int argc, const char * argv[]) {
 
         //? Engines
         megu::GraphicEngine engine(window);
-        megu::Renderer basic_renderer(640*2, 360*2);
+        megu::Renderer basic_renderer(360, 360);
 
         engine.push(0, basic_renderer);
-        engine.push(1, basic_renderer);
-        engine.push(2, basic_renderer);
 
-        engine.push(1, 1, group_3);
-        engine.push(1, 0, group);
+        engine.push(0, 1, group);
         engine.push(0, 0, group_2);
 
         //? Render Loop
@@ -216,7 +178,7 @@ int main(int argc, const char * argv[]) {
             frameCount++;
 
             if(currentTime - previousTime >= 1.0) {
-                window.setTitle(std::to_string(frameCount));
+                //window.setTitle(std::to_string(frameCount));
 
                 frameCount = 0;
                 previousTime = currentTime;
-- 
GitLab