working on the frame controller, this might get messy
This commit is contained in:
@@ -26,7 +26,7 @@ public:
|
||||
|
||||
int update(double delta_time);
|
||||
|
||||
void look_at_center();
|
||||
void look_at(sf::Vector3f position);
|
||||
|
||||
sf::Vector2f* get_direction_pointer();
|
||||
sf::Vector3f* get_position_pointer();
|
||||
|
||||
@@ -57,6 +57,12 @@ namespace vr {
|
||||
NetworkJoystickMoved,
|
||||
NetworkJoystickConnected,
|
||||
NetworkJoystickDisconnected,
|
||||
Tick120Seconds,
|
||||
Tick60Seconds,
|
||||
Tick30Seconds,
|
||||
Tick20Seconds,
|
||||
Tick10Seconds,
|
||||
Tick5Seconds,
|
||||
Count
|
||||
};
|
||||
|
||||
@@ -72,8 +78,6 @@ namespace vr {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Closed : public Event {
|
||||
public:
|
||||
Closed() : Event(vr::Event::EventType::Closed) {};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "Pub_Sub.h"
|
||||
|
||||
|
||||
class FrameWatcher {
|
||||
class FrameWatcher : public VrEventPublisher{
|
||||
|
||||
|
||||
|
||||
@@ -23,4 +24,4 @@ private:
|
||||
double current_time = 0.0;
|
||||
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -21,9 +21,7 @@ public:
|
||||
void consume_vr_events();
|
||||
|
||||
void handle_held_keys();
|
||||
void dispatch_events();
|
||||
|
||||
|
||||
virtual void render_gui() override;
|
||||
virtual void update_gui() override;
|
||||
|
||||
@@ -42,6 +40,10 @@ private:
|
||||
static const std::vector<std::string> key_strings;
|
||||
|
||||
std::list<std::unique_ptr<vr::Event>> event_queue;
|
||||
|
||||
protected:
|
||||
virtual void generate_events() override;
|
||||
|
||||
};
|
||||
|
||||
class WindowHandler : public VrEventSubscriber {
|
||||
|
||||
@@ -23,13 +23,9 @@ public:
|
||||
void stop_recieving_from_clients();
|
||||
|
||||
void generate_events();
|
||||
void dispatch_events();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
std::list<std::unique_ptr<vr::Event>> event_queue;
|
||||
|
||||
std::vector<sf::TcpSocket*> client_sockets;
|
||||
sf::SocketSelector socket_selector;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <iostream>
|
||||
#include "Event.hpp"
|
||||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
|
||||
class VrEventPublisher;
|
||||
@@ -22,12 +23,19 @@ class VrEventPublisher {
|
||||
public:
|
||||
|
||||
virtual ~VrEventPublisher() {};
|
||||
virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type);
|
||||
virtual void subscribe(VrEventSubscriber *subscriber, std::vector<vr::Event::EventType> type);
|
||||
virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c);
|
||||
virtual void notify_subscribers(std::unique_ptr<vr::Event> event);
|
||||
virtual void subscribe(VrEventSubscriber *subscriber, vr::Event::EventType type) final;
|
||||
virtual void subscribe(VrEventSubscriber *subscriber, std::vector<vr::Event::EventType> type) final;
|
||||
virtual void unsubscribe(VrEventSubscriber *s, vr::Event::EventType c) final;
|
||||
|
||||
private:
|
||||
|
||||
std::map<vr::Event::EventType, std::vector<VrEventSubscriber*>> subscribers;
|
||||
|
||||
protected:
|
||||
virtual void notify_subscribers(std::unique_ptr<vr::Event> event) final;
|
||||
virtual void dispatch_events() final;
|
||||
virtual void generate_events() = 0;
|
||||
std::list<std::unique_ptr<vr::Event>> event_queue;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user