1
0
Fork 0

Initial commit

This commit is contained in:
Henrik Hautakoski 2015-12-22 17:43:51 +01:00
commit edfc5298e1
252 changed files with 93965 additions and 0 deletions

View file

@ -0,0 +1,19 @@
#ifndef SPECTRE_SYSTEM_FILE_H
#define SPECTRE_SYSTEM_FILE_H
#include <vector>
#include <string>
namespace File
{
std::string getBasename(const std::string& path);
std::string getExtension(const std::string& path);
std::string getPathname(const std::string& path);
std::vector<unsigned char> read(const std::string& path);
};
#endif /* SPECTRE_SYSTEM_FILE_H */

View file

@ -0,0 +1,7 @@
#ifndef SYSTEM_LOG_H
#define SYSTEM_LOG_H
void log(const char *fmt, ...);
#endif /* SYSTEM_LOG_H */

View file

@ -0,0 +1,15 @@
#ifndef SPECTRE_SYSTEM_MESSAGEHANDLER_H
#define SPECTRE_SYSTEM_MESSAGEHANDLER_H
#include "SystemEvent.h"
class Display;
class MessageHandler
{
public :
virtual void onSizeChanged(Display* display, int width, int height);
};
#endif /* SPECTRE_SYSTEM_MESSAGEHANDLER_H */

View file

@ -0,0 +1,21 @@
#ifndef SPECTRE_MESSAGE_QUEUE_H
#define SPECTRE_MESSAGE_QUEUE_H
#include <Spectre/System/SystemEvent.h>
#include <queue>
class MessageQueue
{
public :
void postEvent(SysEvent& event);
bool pollEvent(SysEvent& event);
bool isEmpty() const;
protected :
std::deque<SysEvent> m_queue;
};
#endif /* SPECTRE_MESSAGE_QUEUE_H */

View file

@ -0,0 +1,12 @@
#ifndef SPECTRE_SYSTEM_SYSTEM_H
#define SPECTRE_SYSTEM_SYSTEM_H
namespace System
{
unsigned long getMilliseconds();
void sleep(int milliseconds);
};
#endif /* SPECTRE_SYSTEM_SYSTEM_H */

View file

@ -0,0 +1,38 @@
#ifndef SYSTEM_EVENT_H
#define SYSTEM_EVENT_H
class Display;
struct SysEvent
{
public :
enum Type {
None,
Quit,
Size,
};
Type type;
struct Size
{
Display *display;
int width;
int height;
};
union {
struct Size size;
};
SysEvent(Type type = None);
// Helper methods
static SysEvent sizeEvent(Display *display, int width, int height);
};
#endif /* SYSTEM_EVENT_H */