Join Date: Jul 2013
Posts: 5
|
TEXT Code: void Initialize() { std::unique_ptr<Drawing::Direct3D9Renderer> renderer( new Drawing::Direct3D9Renderer( g_pDevice ) ); Application::Initialize( std::move( renderer ) ); auto &app = Application::Instance(); Drawing::FontPtr font = Drawing::FontManager::LoadFont( "Tahoma" , 8.0f , true ); app.SetDefaultFont( font ); auto form = std::make_shared<form1>(); app.Run( form ); app.Enable(); app.RegisterHotkey( Hotkey( Key::Insert , [] { Application::Instance().Toggle(); } ) ); } HRESULT WINAPI Hook_EndScene( IDirect3DDevice9* pDevice ) { static bool InitalizeGUI = false; static Drawing::Graphics* Draw = nullptr; if ( !InitalizeGUI ) { Initialize(); Draw = new Drawing::Graphics( *Application::Instance().GetRenderer().CreateGeometryBuffer() ); messageHookHandle = SetWindowsHookExW( WH_GETMESSAGE , KeyboardHook , 0 , GetCurrentThreadId() ); InitalizeGUI = true; } if ( InitalizeGUI && Draw ) { auto &app = Application::Instance(); auto &renderer = app.GetRenderer(); renderer.BeginRendering(); app.Render(); //Draw->DrawRectangle( Drawing::Color::Blue() , 150 , 10 , 100 , 100 ); //Draw->FillRectangle( Drawing::Color::Green() , 10 , 10 , 100 , 100 ); renderer.EndRendering(); } return EndScene_o( pDevice ); }
Draw->DrawRectangle and etc crash why ?
|