change Window to RenderWindow
This commit is contained in:
parent
95bab5a823
commit
f3770d1c89
@ -73,7 +73,7 @@ bool Client::create_window(bool fullscreen, int width, int height)
|
|||||||
: sf::Style::Resize | sf::Style::Close;
|
: sf::Style::Resize | sf::Style::Close;
|
||||||
sf::ContextSettings cs = sf::ContextSettings(0, 0, 0,
|
sf::ContextSettings cs = sf::ContextSettings(0, 0, 0,
|
||||||
OPENGL_CONTEXT_MAJOR, OPENGL_CONTEXT_MINOR);
|
OPENGL_CONTEXT_MAJOR, OPENGL_CONTEXT_MINOR);
|
||||||
m_window = new sf::Window(mode, "Treacherous Terrain", style, cs);
|
m_window = new sf::RenderWindow(mode, "Treacherous Terrain", style, cs);
|
||||||
m_window->setMouseCursorVisible(false);
|
m_window->setMouseCursorVisible(false);
|
||||||
grab_mouse(true);
|
grab_mouse(true);
|
||||||
if (!initgl())
|
if (!initgl())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "Client.h"
|
#include "Client.h"
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
|
#include <SFGUI/SFGUI.hpp>
|
||||||
|
|
||||||
/* TODO: this should be moved to common somewhere */
|
/* TODO: this should be moved to common somewhere */
|
||||||
#define MAX_SHOT_DISTANCE 250.0
|
#define MAX_SHOT_DISTANCE 250.0
|
||||||
@ -93,6 +94,37 @@ void Client::run(bool fullscreen, int width, int height, std::string pname)
|
|||||||
m_clock.restart();
|
m_clock.restart();
|
||||||
recenter_cursor();
|
recenter_cursor();
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
sfg::SFGUI sfgui;
|
||||||
|
sfg::Label::Ptr label = sfg::Label::Create("Label Test");
|
||||||
|
sfg::Window::Ptr window(sfg::Window::Create());
|
||||||
|
window->SetTitle("SFGUI window");
|
||||||
|
window->Add(label);
|
||||||
|
sfg::Desktop desktop;
|
||||||
|
desktop.Add(window);
|
||||||
|
|
||||||
|
sf::Event event;
|
||||||
|
|
||||||
|
while (m_window->isOpen())
|
||||||
|
{
|
||||||
|
while (m_window->pollEvent(event))
|
||||||
|
{
|
||||||
|
desktop.HandleEvent(event);
|
||||||
|
|
||||||
|
if (event.type == sf::Event::Closed)
|
||||||
|
{
|
||||||
|
m_window->close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
desktop.Update(m_clock.restart().asSeconds());
|
||||||
|
m_window->clear();
|
||||||
|
sfgui.Display(*m_window);
|
||||||
|
m_window->display();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#if 0
|
||||||
double last_time = 0.0;
|
double last_time = 0.0;
|
||||||
while (m_window->isOpen())
|
while (m_window->isOpen())
|
||||||
{
|
{
|
||||||
@ -168,6 +200,7 @@ void Client::run(bool fullscreen, int width, int height, std::string pname)
|
|||||||
// temporary for now. otherwise this thread consumed way too processing
|
// temporary for now. otherwise this thread consumed way too processing
|
||||||
sf::sleep(sf::seconds(0.005)); // 5 milli-seconds
|
sf::sleep(sf::seconds(0.005)); // 5 milli-seconds
|
||||||
}
|
}
|
||||||
|
//#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::recenter_cursor()
|
void Client::recenter_cursor()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <SFML/Window.hpp>
|
#include <SFML/Window.hpp>
|
||||||
#include <SFML/Graphics/Texture.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
#include "refptr.h"
|
#include "refptr.h"
|
||||||
#include "Map.h"
|
#include "Map.h"
|
||||||
#include "Shot.h"
|
#include "Shot.h"
|
||||||
@ -46,7 +46,7 @@ class Client
|
|||||||
bool m_mouse_grabbed;
|
bool m_mouse_grabbed;
|
||||||
double m_player_dir_x;
|
double m_player_dir_x;
|
||||||
double m_player_dir_y;
|
double m_player_dir_y;
|
||||||
refptr<sf::Window> m_window;
|
refptr<sf::RenderWindow> m_window;
|
||||||
sf::Clock m_clock;
|
sf::Clock m_clock;
|
||||||
Map m_map;
|
Map m_map;
|
||||||
sf::Uint8 m_current_player;
|
sf::Uint8 m_current_player;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user