diff GUI/UI/UISaveLoad.cpp @ 2573:0c67be4ec900

DrawTextureIndexed renamed to DrawTextureTransparentColorKey Changing more class Texture to class Image.
author a.parshin
date Sat, 05 Mar 2016 16:25:53 +0200
parents d87bfbd3bb3b
children dd36326a9994
line wrap: on
line diff
--- a/GUI/UI/UISaveLoad.cpp	Sat Mar 05 01:51:54 2016 +0200
+++ b/GUI/UI/UISaveLoad.cpp	Sat Mar 05 16:25:53 2016 +0200
@@ -5,6 +5,7 @@
 #include <io.h>
 
 #include "Engine/Engine.h"
+#include "Engine/AssetsManager.h"
 #include "Engine/MapInfo.h"
 #include "Engine/Graphics/Render.h"
 #include "Engine/LOD.h"
@@ -21,6 +22,14 @@
 void UI_DrawSaveLoad(bool save);
 
 
+Image *img_save_up = nullptr;
+Image *img_load_up = nullptr;
+Image *img_loadsave = nullptr;
+Image *img_loadsave_saveu = nullptr;
+Image *img_loadsave_loadu = nullptr;
+Image *img_loadsave_x_u = nullptr;
+
+
 GUIWindow_Save::GUIWindow_Save() :
     GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
 {
@@ -34,25 +43,26 @@
         pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
     memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
     memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails));
-    uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
-    uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
-    uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
-    uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE);
-    uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE);
-    uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE);
-    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
+    img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF);
+    img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF);
+    img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF);
+    img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF);
+    img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF);
+    img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF);
+
+    pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
 
     //if (screen == SCREEN_SAVEGAME)
     {
-        pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU));
-        pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
-        pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up));
+        pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu);
+        pRenderer->DrawTextureAlphaNew(351/640.0f, 302/480.0f, img_loadsave_x_u);
+        pRenderer->DrawTextureAlphaNew(18/640.0f, 141/480.0f, img_save_up);
     }
     /*else
     {
-    pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU));
-    pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
-    pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up));
+    pRenderer->DrawTextureTransparentColorKey(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU));
+    pRenderer->DrawTextureTransparentColorKey(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
+    pRenderer->DrawTextureTransparentColorKey(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up));
     }*/
 
     //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...)
@@ -138,26 +148,27 @@
 
     memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots));
     memset(pSavegameThumbnails.data(), 0, 45 * sizeof(Image *));
-    uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
-    uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
-    uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
-    uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE);
-    uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE);
-    uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE);
+    img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF);
+    img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF);
+    img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF);
+    img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF);
+    img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF);
+    img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF);
+
     if (ingame)
     {
-        pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
+        pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
         if (current_screen_type == SCREEN_SAVEGAME)
         {
-            pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU));
-            pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up));
+            pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu);
+            pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_save_up);
         }
         else
         {
-            pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU));
-            pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up));
+            pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu);
+            pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_load_up);
         }
-        pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
+        pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u);
     }
     else
         pRenderer->DrawTextureNew(0, 0, main_menu_background);
@@ -277,18 +288,18 @@
   pRenderer->BeginScene();
   if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu )
   {
-    pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave));
+    pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
     if (save)
     {
-      pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU));
-      pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up));
+      pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_saveu);
+      pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_save_up);
     }
     else
     {
-      pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU));
-      pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up));
+      pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu);
+      pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_load_up);
     }
-    pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
+    pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u);
   }
   if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
   {