OldSchoolHack

Registrieren / Anmelden Deutsch

Drawing::Graphics EndScene Draw

icon Thema: [Question] Drawing::Graphics EndScene Draw

Anmeldungsdatum: Jul 2013

Beiträge: 5

TEXT Code:
  1. void Initialize()
  2. {
  3. std::unique_ptr<Drawing::Direct3D9Renderer> renderer( new Drawing::Direct3D9Renderer( g_pDevice ) );
  4. Application::Initialize( std::move( renderer ) );
  5. auto &app = Application::Instance();
  6. Drawing::FontPtr font = Drawing::FontManager::LoadFont( "Tahoma" , 8.0f , true );
  7. app.SetDefaultFont( font );
  8. auto form = std::make_shared<form1>();
  9. app.Run( form );
  10. app.Enable();
  11. app.RegisterHotkey( Hotkey( Key::Insert , []
  12. {
  13. Application::Instance().Toggle();
  14. } ) );
  15. }
  16.  
  17. HRESULT WINAPI Hook_EndScene( IDirect3DDevice9* pDevice )
  18. {
  19. static bool InitalizeGUI = false;
  20. static Drawing::Graphics* Draw = nullptr;
  21.  
  22. if ( !InitalizeGUI )
  23. {
  24. Initialize();
  25. Draw = new Drawing::Graphics( *Application::Instance().GetRenderer().CreateGeometryBuffer() );
  26. messageHookHandle = SetWindowsHookExW( WH_GETMESSAGE , KeyboardHook , 0 , GetCurrentThreadId() );
  27. InitalizeGUI = true;
  28. }
  29.  
  30. if ( InitalizeGUI && Draw )
  31. {
  32. auto &app = Application::Instance();
  33. auto &renderer = app.GetRenderer();
  34. renderer.BeginRendering();
  35. app.Render();
  36.  
  37. //Draw->DrawRectangle( Drawing::Color::Blue() , 150 , 10 , 100 , 100 );
  38. //Draw->FillRectangle( Drawing::Color::Green() , 10 , 10 , 100 , 100 );
  39.  
  40. renderer.EndRendering();
  41. }
  42.  
  43. return EndScene_o( pDevice );
  44. }
  45.  


Draw->DrawRectangle and etc crash why ?