Panagiotis Christopoulos Charitos 14 lat temu
rodzic
commit
67f3e5a1b9

Plik diff jest za duży
+ 0 - 1
build/debug/Makefile


+ 43 - 0
src/Events/Event.cpp

@@ -0,0 +1,43 @@
+#include "Event.h"
+#include "Assert.h"
+
+
+namespace Event {
+
+
+//======================================================================================================================
+// Constructor                                                                                                         =
+//======================================================================================================================
+Event::Event(EventType type_, uint startTime_, int duration_):
+	type(type_),
+	startTime(startTime_),
+	duration(duration_)
+{}
+
+
+//======================================================================================================================
+// operator=                                                                                                           =
+//======================================================================================================================
+Event& Event::operator=(const Event& b)
+{
+	type = b.type;
+	startTime = b.startTime;
+	duration = b.duration;
+	return *this;
+}
+
+
+//======================================================================================================================
+// update                                                                                                              =
+//======================================================================================================================
+void Event::update(uint timeUpdate)
+{
+	ASSERT(!isFinished());
+
+	updateSp(timeUpdate);
+
+	duration -= timeUpdate;
+}
+
+
+} // end namespace

+ 55 - 0
src/Events/Event.h

@@ -0,0 +1,55 @@
+#ifndef EVENT_H
+#define EVENT_H
+
+#include "StdTypes.h"
+#include "Accessors.h"
+
+
+namespace Event {
+
+
+/// The event type enum
+enum EventType
+{
+	SCENE_COLOR,
+	EVENT_TYPES_NUM
+};
+
+
+/// Abstract class for all events
+class Event
+{
+	public:
+		/// Constructor
+		Event(EventType type, uint startTime, int duration);
+
+		/// Copy constructor
+		Event(const Event& b) {*this = b;}
+
+		/// @name Accessors
+		/// @{
+		GETTER_R(uint, startTime, getStartTime)
+		GETTER_R(int, duration, getDuration)
+		GETTER_R(EventType, type, getEventType)
+		bool isFinished() const {return duration < 0;}
+		/// @}
+
+		/// Copy
+		Event& operator=(const Event& b);
+
+		/// @param[in] timeUpdate The time between this update and the previous
+		void update(uint timeUpdate);
+		virtual void updateSp(uint timeUpdate) = 0;
+
+	private:
+		EventType type; ///< Self explanatory
+		uint startTime; ///< The time the event will start. Eg 23:00
+		/// The duration of the event. < 0 means finished, 0 means no limit and > 0 is the actual duration
+		int duration;
+};
+
+
+} // end namespace
+
+
+#endif

+ 19 - 0
src/Events/EventManager.h

@@ -0,0 +1,19 @@
+#ifndef EVENT_MANAGER_H
+#define EVENT_MANAGER_H
+
+
+namespace Event {
+
+
+/// @todo
+class Manager
+{
+	public:
+	private:
+};
+
+
+} // end namespace
+
+
+#endif

+ 38 - 0
src/Events/EventSceneColor.cpp

@@ -0,0 +1,38 @@
+#include "EventSceneColor.h"
+#include "Scene.h"
+#include "Globals.h"
+
+
+namespace Event {
+
+
+//======================================================================================================================
+// Constructor                                                                                                         =
+//======================================================================================================================
+SceneColor::SceneColor(uint startTime, int duration, const Vec3& finalColor_):
+	Event(SCENE_COLOR, startTime, duration),
+	finalColor(finalColor_)
+{}
+
+
+
+//======================================================================================================================
+// operator=                                                                                                           =
+//======================================================================================================================
+SceneColor& SceneColor::operator=(const SceneColor& b)
+{
+	Event::operator=(b);
+	finalColor = b.finalColor;
+}
+
+
+//======================================================================================================================
+// updateSp                                                                                                            =
+//======================================================================================================================
+void SceneColor::updateSp(uint timeUpdate)
+{
+	SceneColor();
+}
+
+
+} // end namespace

+ 34 - 0
src/Events/EventSceneColor.h

@@ -0,0 +1,34 @@
+#ifndef EVENT_SCENE_COLOR_H
+#define EVENT_SCENE_COLOR_H
+
+#include "Event.h"
+#include "Math.h"
+
+
+namespace Event {
+
+
+/// Change the scene color
+class SceneColor: public Event
+{
+	public:
+		/// Constructor
+		SceneColor(uint startTime, int duration, const Vec3& finalColor);
+
+		/// Copy constructor
+		SceneColor(const SceneColor& b) {*this = b;}
+
+		/// Copy
+		SceneColor& operator=(const SceneColor& b);
+
+		/// Implements Event::updateSp
+		void updateSp(uint timeUpdate);
+
+	private:
+		Vec3 finalColor;
+};
+
+
+} // end namespace
+
+#endif

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików