Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1.  
  2. #include <IMGUI/imgui.h>
  3. #include <IMGUI/imgui-SFML.h>
  4.  
  5. #include "Game.h"
  6. #include "Window.h"
  7.  
  8. sf::RenderWindow window;
  9. sf::Clock deltaClock;
  10.  
  11. void setupWindow(_GAME *pGame)
  12. {
  13.     pGame->Window.nWidth = 1360;
  14.     pGame->Window.nHeight = 720;
  15.  
  16.     window.create(sf::VideoMode(pGame->Window.nWidth, pGame->Window.nHeight), "Render Window");
  17.    
  18.     window.setVerticalSyncEnabled(true);
  19.    
  20.     ImGui::SFML::Init(window);
  21.    
  22.     window.setTitle("HL Alpha");
  23.    
  24.     window.resetGLStates(); // only draw imgui, else remove.
  25. }
  26. void updateWindow(_GAME *pGame)
  27. {
  28.    
  29.     while (window.isOpen()) {
  30.         sf::Event event;
  31.        
  32.         while (window.pollEvent(event)) {
  33.             // Process ImGui along with the SFML event
  34.            
  35.             ImGui::SFML::ProcessEvent(event);
  36.            
  37.             if (event.type == sf::Event::Closed) {
  38.                 window.close();
  39.             }
  40.             ImGui::EndFrame();
  41.         }
  42.         //ImGui::NewFrame();
  43.  
  44.         window.clear(sf::Color::Black);
  45.  
  46.         //window.clear(sf::Color::Black);
  47.        
  48.         ImGui::SFML::Render(window);
  49.         window.display();
  50.        
  51.     }
  52.  
  53.     ImGui::SFML::Shutdown();
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement