matt77hias / MAGE-v0

🧙 MAGE v0
https://matt77hias.github.io/MAGE-v0-Doc
GNU General Public License v3.0
266 stars 20 forks source link

globals and singletons #53

Closed matt77hias closed 6 years ago

matt77hias commented 6 years ago

All globals should be eliminated.

Work plan:

  1. BehaviorScript and Scene
  2. ID3D11Device and ID3D11DeviceContext
  3. Remaining
matt77hias commented 6 years ago
#include "system\system_time.hpp"
const auto fname = L"screenshot-" + GetLocalSystemDateAndTimeAsString() + L".png";

We'll probably need this somewhere :)

matt77hias commented 6 years ago

idd.

    ImGui_ImplWin32_WndProcHandler(window, message, wParam, lParam);

    case WM_ACTIVATEAPP: {
        // Sent when a window belonging to a different application 
        // than the active window is about to be activated. 
        // The message is sent to the application whose window is being 
        // activated and to the application whose window is being 
        // deactivated.

        const auto deactive = static_cast< bool >(!wParam);
        Engine::Get()->OnActiveChange(deactive);

        break;
    }

    case WM_HOTKEY: {
        // Posted when the user presses a hot key registered by the 
        // RegisterHotKey function.

        switch(wParam) {

        case static_cast< WPARAM >(HotKey::PrintScreen) :
        case static_cast< WPARAM >(HotKey::AltPrintScreen): {
            SwapChain::Get()->TakeScreenShot();
            [[fallthrough]];
        }

        default: {
            return DefWindowProc(window, message, wParam, lParam);
        }

        }
    }

    case WM_SYSKEYDOWN: {
        // Sent to the window with the keyboard focus when the user presses 
        // the F10 key (which activates the menu bar) or holds down the ALT 
        // key and then presses another key.

        switch (wParam) {

        case VK_RETURN: {
            Engine::Get()->OnModeSwitch();
            break;
        }

        default: {
            return DefWindowProc(window, message, wParam, lParam);
        }

        }
    }