Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
19
include/Spectre/System/File.h
Normal file
19
include/Spectre/System/File.h
Normal 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 */
|
||||
7
include/Spectre/System/Log.h
Normal file
7
include/Spectre/System/Log.h
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
#ifndef SYSTEM_LOG_H
|
||||
#define SYSTEM_LOG_H
|
||||
|
||||
void log(const char *fmt, ...);
|
||||
|
||||
#endif /* SYSTEM_LOG_H */
|
||||
15
include/Spectre/System/MessageHandler.h
Normal file
15
include/Spectre/System/MessageHandler.h
Normal 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 */
|
||||
21
include/Spectre/System/MessageQueue.h
Normal file
21
include/Spectre/System/MessageQueue.h
Normal 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 */
|
||||
12
include/Spectre/System/System.h
Normal file
12
include/Spectre/System/System.h
Normal 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 */
|
||||
38
include/Spectre/System/SystemEvent.h
Normal file
38
include/Spectre/System/SystemEvent.h
Normal 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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue