comparison 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
comparison
equal deleted inserted replaced
2572:d87bfbd3bb3b 2573:0c67be4ec900
3 #include <stdlib.h> 3 #include <stdlib.h>
4 #include <crtdbg.h> 4 #include <crtdbg.h>
5 #include <io.h> 5 #include <io.h>
6 6
7 #include "Engine/Engine.h" 7 #include "Engine/Engine.h"
8 #include "Engine/AssetsManager.h"
8 #include "Engine/MapInfo.h" 9 #include "Engine/MapInfo.h"
9 #include "Engine/Graphics/Render.h" 10 #include "Engine/Graphics/Render.h"
10 #include "Engine/LOD.h" 11 #include "Engine/LOD.h"
11 #include "Engine/SaveLoad.h" 12 #include "Engine/SaveLoad.h"
12 #include "Engine/texts.h" 13 #include "Engine/texts.h"
19 #include "Game/MainMenu.h" 20 #include "Game/MainMenu.h"
20 21
21 void UI_DrawSaveLoad(bool save); 22 void UI_DrawSaveLoad(bool save);
22 23
23 24
25 Image *img_save_up = nullptr;
26 Image *img_load_up = nullptr;
27 Image *img_loadsave = nullptr;
28 Image *img_loadsave_saveu = nullptr;
29 Image *img_loadsave_loadu = nullptr;
30 Image *img_loadsave_x_u = nullptr;
31
32
24 GUIWindow_Save::GUIWindow_Save() : 33 GUIWindow_Save::GUIWindow_Save() :
25 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) 34 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
26 { 35 {
27 // ------------------------------------------------ 36 // ------------------------------------------------
28 // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen) 37 // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen)
32 ++pIcons_LOD->uTexturePacksCount; 41 ++pIcons_LOD->uTexturePacksCount;
33 if (!pIcons_LOD->uNumPrevLoadedFiles) 42 if (!pIcons_LOD->uNumPrevLoadedFiles)
34 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; 43 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
35 memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); 44 memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
36 memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); 45 memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails));
37 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); 46 img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF);
38 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); 47 img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF);
39 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); 48 img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF);
40 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); 49 img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF);
41 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); 50 img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF);
42 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); 51 img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF);
43 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); 52
53 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
44 54
45 //if (screen == SCREEN_SAVEGAME) 55 //if (screen == SCREEN_SAVEGAME)
46 { 56 {
47 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); 57 pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu);
48 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); 58 pRenderer->DrawTextureAlphaNew(351/640.0f, 302/480.0f, img_loadsave_x_u);
49 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); 59 pRenderer->DrawTextureAlphaNew(18/640.0f, 141/480.0f, img_save_up);
50 } 60 }
51 /*else 61 /*else
52 { 62 {
53 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); 63 pRenderer->DrawTextureTransparentColorKey(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU));
54 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); 64 pRenderer->DrawTextureTransparentColorKey(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u));
55 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); 65 pRenderer->DrawTextureTransparentColorKey(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up));
56 }*/ 66 }*/
57 67
58 //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) 68 //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...)
59 pRenderer->Present(); 69 pRenderer->Present();
60 pSavegameList->Initialize(1); 70 pSavegameList->Initialize(1);
136 dword_6BE138 = -1; 146 dword_6BE138 = -1;
137 pIcons_LOD->_inlined_sub2(); 147 pIcons_LOD->_inlined_sub2();
138 148
139 memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); 149 memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots));
140 memset(pSavegameThumbnails.data(), 0, 45 * sizeof(Image *)); 150 memset(pSavegameThumbnails.data(), 0, 45 * sizeof(Image *));
141 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); 151 img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF);
142 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); 152 img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF);
143 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); 153 img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF);
144 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); 154 img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF);
145 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); 155 img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF);
146 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); 156 img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF);
157
147 if (ingame) 158 if (ingame)
148 { 159 {
149 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); 160 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
150 if (current_screen_type == SCREEN_SAVEGAME) 161 if (current_screen_type == SCREEN_SAVEGAME)
151 { 162 {
152 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); 163 pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu);
153 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_save_up)); 164 pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_save_up);
154 } 165 }
155 else 166 else
156 { 167 {
157 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); 168 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu);
158 pRenderer->DrawTextureIndexed(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); 169 pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_load_up);
159 } 170 }
160 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); 171 pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u);
161 } 172 }
162 else 173 else
163 pRenderer->DrawTextureNew(0, 0, main_menu_background); 174 pRenderer->DrawTextureNew(0, 0, main_menu_background);
164 175
165 176
275 int current_minutes; 286 int current_minutes;
276 287
277 pRenderer->BeginScene(); 288 pRenderer->BeginScene();
278 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) 289 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu )
279 { 290 {
280 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); 291 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave);
281 if (save) 292 if (save)
282 { 293 {
283 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); 294 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_saveu);
284 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); 295 pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_save_up);
285 } 296 }
286 else 297 else
287 { 298 {
288 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); 299 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu);
289 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); 300 pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_load_up);
290 } 301 }
291 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); 302 pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u);
292 } 303 }
293 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) 304 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
294 { 305 {
295 memset(&save_load_window, 0, 0x54); 306 memset(&save_load_window, 0, 0x54);
296 save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; 307 save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;