#define Global #ifdef WIN32 # include #endif #include "File.h" #include "DLLRegister.h" #include "Window.h" #include "Globals.h" #include "Logging.h" #include "Model3DList.h" #include "TextureList.h" #include "Thread.h" #include "Time.h" #ifdef WIN32 # include # pragma comment(lib, "gdiplus.lib") # include "Window.h" # include "Mouse.h" #endif void Framework::initFramework(HINSTANCE__* hInst) { if (istInitialisiert) return; loggingHandler = new Logging::LoggingHandler(); thRegister = new ThreadRegister(); #ifdef WIN32 Gdiplus::GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, 0); msgExit = 0; MausTrack = 1; #endif for (int i = 0; i < 3; ++i) MausStand[i] = 0; TextureList::init(); dlls = new DLLRegister(); _hinst = hInst; istInitialisiert = 1; debugDX = 0; cursorVisible = 1; } void Framework::releaseFramework() { if (!istInitialisiert) return; thRegister->cleanUpClosedThreads(); dlls->release(); TextureList::destroy(); delete thRegister; loggingHandler->release(); istInitialisiert = 0; } bool Framework::istThreadOk(Thread* t) { return thRegister->isThread(t); } // Returns the thread register of the framework Framework::ThreadRegister* Framework::getThreadRegister() { return thRegister; } #ifdef WIN32 Framework::Punkt Framework::getMausPos() { POINT point; GetCursorPos(&point); return {point.x, point.y}; } //! Sets the mouse position on the screen void Framework::setMausPos(const Punkt& pos) { SetCursorPos(pos.x, pos.y); } #endif bool Framework::getMausStand(int taste) { return MausStand[taste]; } bool Framework::getTastenStand(unsigned char taste) { #ifdef WIN32 return GetKeyState(taste) & 0x8000; #else return 0; #endif } // Returns the DLL register containing all currently dynamically loaded DLLs Framework::DLLRegister* Framework::getDLLRegister() { return Framework::dlls; } //! Sets DirectX to debug mode void Framework::setDebugDX(bool debug) { debugDX = debug; } #ifdef WIN32 // returns a reference to the mouse Framework::Mouse& Framework::getMouse() { return Framework::mousePointer; } //! sets the mouse state to visible or invisible void Framework::setShowCursor(bool visible) { CURSORINFO info = {0}; info.cbSize = sizeof(CURSORINFO); GetCursorInfo(&info); if ((info.flags != 0) == (visible == 0)) ShowCursor(visible); cursorVisible = visible; } #endif