Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 330 vs 331 for /trunk/Source Code/GUI/GUI.cpp

Diff revisions: vs.
  @@ -22,7 +22,7 @@
22 22 GUI::GUI() : _init(false),
23 23 _rootSheet(nullptr),
24 24 _defaultMsgBox(nullptr),
25 - _console(New GUIConsole()),
25 + _console(MemoryManager_NEW GUIConsole()),
26 26 _textRenderInterval(getMsToUs(10))
27 27 {
28 28 //500ms
  @@ -34,12 +34,9 @@
34 34 {
35 35 PRINT_FN(Locale::get("STOP_GUI"));
36 36 GUIEditor::destroyInstance();
37 - MemoryManager::SAFE_DELETE( _console );
37 + MemoryManager::DELETE( _console );
38 38 RemoveResource(_guiShader);
39 - for (guiMap::value_type& it : _guiStack) {
40 - MemoryManager::SAFE_DELETE( it.second );
41 - }
42 - _guiStack.clear();
39 + MemoryManager::DELETE_HASHMAP(_guiStack);
43 40 _defaultMsgBox = nullptr;
44 41 }
45 42
  @@ -51,7 +48,8 @@
51 48 return;
52 49 }
53 50
54 - vec2<I32> difDimensions((I32)_cachedResolution.width - newResolution.width, (I32)_cachedResolution.height - newResolution.height);
51 + vec2<I32> difDimensions((I32)_cachedResolution.width - newResolution.width,
52 + (I32)_cachedResolution.height - newResolution.height);
55 53
56 54 for (guiMap::value_type& guiStackIterator : _guiStack) {
57 55 guiStackIterator.second->onResize( difDimensions );
  @@ -101,7 +99,8 @@
101 99 #ifdef _DEBUG
102 100 CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::Informative);
103 101 #endif
104 - CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>( CEGUI::System::getSingleton().getResourceProvider() ) ;
102 + CEGUI::DefaultResourceProvider* rp = nullptr;
103 + rp = static_cast<CEGUI::DefaultResourceProvider*>( CEGUI::System::getSingleton().getResourceProvider() ) ;
105 104 CEGUI::String CEGUIInstallSharePath(ParamHandler::getInstance().getParam<std::string>("assetsLocation"));
106 105 CEGUIInstallSharePath += "/GUI/" ;
107 106 rp->setResourceGroupDirectory( "schemes", CEGUIInstallSharePath + "schemes/" ) ;
  @@ -281,7 +280,7 @@
281 280 if (!parent) {
282 281 parent = _rootSheet;
283 282 }
284 - GUIButton* btn = New GUIButton(id, text, _defaultGUIScheme,position,dimensions,color,parent,callback);
283 + GUIButton* btn = MemoryManager_NEW GUIButton(id, text, _defaultGUIScheme, position, dimensions, color, parent, callback);
285 284 guiMap::iterator it = _guiStack.find(id);
286 285 if (it != _guiStack.end()) {
287 286 MemoryManager::SAFE_UPDATE( it->second, btn );
  @@ -292,8 +291,11 @@
292 291 return btn;
293 292 }
294 293
295 - GUIMessageBox* GUI::addMsgBox(const stringImpl& id, const stringImpl& title, const stringImpl& message, const vec2<I32>& offsetFromCentre ) {
296 - GUIMessageBox* box = New GUIMessageBox(id, title, message, offsetFromCentre, _rootSheet);
294 + GUIMessageBox* GUI::addMsgBox(const stringImpl& id,
295 + const stringImpl& title,
296 + const stringImpl& message,
297 + const vec2<I32>& offsetFromCentre ) {
298 + GUIMessageBox* box = MemoryManager_NEW GUIMessageBox(id, title, message, offsetFromCentre, _rootSheet);
297 299 guiMap::iterator it = _guiStack.find(id);
298 300 if (it != _guiStack.end()) {
299 301 MemoryManager::SAFE_UPDATE( it->second, box );
  @@ -304,19 +306,24 @@
304 306 return box;
305 307 }
306 308
307 - GUIText* GUI::addText(const stringImpl& id,const vec2<I32> &position, const stringImpl& font,const vec3<F32> &color, char* format, ...){
309 + GUIText* GUI::addText(const stringImpl& id,
310 + const vec2<I32> &position,
311 + const stringImpl& font,
312 + const vec3<F32> &color,
313 + char* format,
314 + ...) {
308 315 va_list args;
309 316 stringImpl fmt_text;
310 317
311 318 va_start(args, format);
312 319 I32 len = _vscprintf(format, args) + 1;
313 - char *text = New char[len];
320 + char *text = MemoryManager_NEW char[len];
314 321 vsprintf_s(text, len, format, args);
315 322 fmt_text.append(text);
316 - MemoryManager::SAFE_DELETE_ARRAY( text );
323 + MemoryManager::DELETE_ARRAY( text );
317 324 va_end(args);
318 325
319 - GUIText *t = New GUIText(id,fmt_text,position,font,color,_rootSheet);
326 + GUIText *t = MemoryManager_NEW GUIText(id, fmt_text, position, font, color, _rootSheet);
320 327 guiMap::iterator it = _guiStack.find(id);
321 328 if (it != _guiStack.end()) {
322 329 MemoryManager::SAFE_UPDATE( it->second, t );
  @@ -330,7 +337,7 @@
330 337 }
331 338
332 339 GUIFlash* GUI::addFlash(const stringImpl& id, stringImpl movie, const vec2<U32>& position, const vec2<U32>& extent){
333 - GUIFlash *flash = New GUIFlash(_rootSheet);
340 + GUIFlash *flash = MemoryManager_NEW GUIFlash(_rootSheet);
334 341 guiMap::iterator it = _guiStack.find(id);
335 342 if (it != _guiStack.end()) {
336 343 MemoryManager::SAFE_UPDATE( it->second, flash );
  @@ -349,10 +356,10 @@
349 356
350 357 va_start(args, format);
351 358 I32 len = _vscprintf(format, args) + 1;
352 - char * text = New char[len];
359 + char * text = MemoryManager_NEW char[len];
353 360 vsprintf_s(text, len, format, args);
354 361 fmt_text.append(text);
355 - MemoryManager::SAFE_DELETE_ARRAY( text );
362 + MemoryManager::DELETE_ARRAY( text );
356 363 va_end(args);
357 364
358 365 GUIElement* element = _guiStack[id];