wip
This commit is contained in:
parent
15e2abbada
commit
03b8658666
18 changed files with 257 additions and 57 deletions
17
engine/include/fishbone/base.h
Normal file
17
engine/include/fishbone/base.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef __FISHBONE_BASE_H__
|
||||
#define __FISHBONE_BASE_H__
|
||||
|
||||
#include <fishbone/pre.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Base;
|
||||
};
|
||||
|
||||
#include <fishbone/log.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Base : public fishbone::Logger {
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
@ -11,19 +11,20 @@ namespace fishbone {
|
|||
#include <fishbone/window.h>
|
||||
#include <fishbone/mixer.h>
|
||||
#include <fishbone/draw.h>
|
||||
#include <fishbone/base.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Client {
|
||||
class Client : public fishbone::Base {
|
||||
public:
|
||||
Client(std::unordered_map<std::string, std::vector<std::string>> param);
|
||||
~Client();
|
||||
|
||||
bool step();
|
||||
|
||||
|
||||
fishbone::Window* window;
|
||||
fishbone::SoundDriver* sounddrv;
|
||||
fishbone::Mixer* mixer;
|
||||
fishbone::Renderer* renderer;
|
||||
fishbone::Mixer* mixer;
|
||||
fishbone::Renderer* renderer;
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
|
|
|
|||
|
|
@ -7,26 +7,34 @@ namespace fishbone {
|
|||
class Texture;
|
||||
class Mesh;
|
||||
class Renderer;
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
/* no includes */
|
||||
#include <fishbone/window.h>
|
||||
#include <fishbone/meshldr.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Texture {
|
||||
struct Impl;
|
||||
Impl* impl;
|
||||
|
||||
public:
|
||||
public:
|
||||
Texture(fishbone::Renderer* renderer, unsigned char* rgba, int width, int height);
|
||||
~Texture();
|
||||
};
|
||||
|
||||
class Mesh {
|
||||
void init(fishbone::Renderer* renderer, std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals);
|
||||
|
||||
struct Impl;
|
||||
Impl* impl;
|
||||
|
||||
public:
|
||||
Mesh(fishbone::Renderer* renderer, std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals, std::vector<int> elements);
|
||||
public:
|
||||
Mesh(fishbone::Renderer* renderer, std::vector<struct fishbone::Vector3> vertices, std::vector<struct fishbone::Vector2> texcoords, std::vector<struct fishbone::Vector3> normals) {
|
||||
this->init(renderer, vertices, texcoords, normals);
|
||||
}
|
||||
Mesh(fishbone::Renderer* renderer, fishbone::MeshData* data) {
|
||||
this->init(renderer, data->vertices, data->texcoords, data->normals);
|
||||
}
|
||||
~Mesh();
|
||||
|
||||
void draw();
|
||||
|
|
@ -36,10 +44,10 @@ namespace fishbone {
|
|||
struct Impl;
|
||||
Impl* impl;
|
||||
|
||||
public:
|
||||
Renderer();
|
||||
public:
|
||||
Renderer(fishbone::Window* window);
|
||||
~Renderer();
|
||||
};
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,5 +10,8 @@
|
|||
#include <fishbone/resource.h>
|
||||
#include <fishbone/draw.h>
|
||||
#include <fishbone/time.h>
|
||||
#include <fishbone/base.h>
|
||||
#include <fishbone/meshldr.h>
|
||||
#include <fishbone/log.h>
|
||||
|
||||
#endif
|
||||
|
|
|
|||
35
engine/include/fishbone/log.h
Normal file
35
engine/include/fishbone/log.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#ifndef __FISHBONE_LOG_H__
|
||||
#define __FISHBONE_LOG_H__
|
||||
|
||||
#include <fishbone/pre.h>
|
||||
|
||||
namespace fishbone {
|
||||
class Logger;
|
||||
};
|
||||
|
||||
/* no includes */
|
||||
|
||||
namespace fishbone {
|
||||
class Logger {
|
||||
enum LoggerLevel {
|
||||
Log = 0,
|
||||
Info,
|
||||
Warn,
|
||||
Error
|
||||
};
|
||||
|
||||
void init(std::string path);
|
||||
|
||||
std::ofstream ofs;
|
||||
|
||||
public:
|
||||
Logger();
|
||||
Logger(std::string path);
|
||||
~Logger();
|
||||
|
||||
void log(std::string arg);
|
||||
void log(int level, std::string arg);
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
23
engine/include/fishbone/meshldr.h
Normal file
23
engine/include/fishbone/meshldr.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#ifndef __FISHBONE_MESHLDR_H__
|
||||
#define __FISHBONE_MESHLDR_H__
|
||||
|
||||
#include <fishbone/pre.h>
|
||||
|
||||
namespace fishbone {
|
||||
class MeshData;
|
||||
};
|
||||
|
||||
#include <fishbone/file.h>
|
||||
|
||||
namespace fishbone {
|
||||
class MeshData {
|
||||
public:
|
||||
MeshData(fishbone::File* file);
|
||||
|
||||
std::vector<struct fishbone::Vector3> vertices;
|
||||
std::vector<struct fishbone::Vector2> texcoords;
|
||||
std::vector<struct fishbone::Vector3> normals;
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
@ -12,10 +12,10 @@ namespace fishbone {
|
|||
namespace fishbone {
|
||||
class Resource {
|
||||
public:
|
||||
fishbone::File* open(std::string path);
|
||||
|
||||
Resource(std::string path);
|
||||
~Resource();
|
||||
|
||||
fishbone::File* open(std::string path);
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
|
|
|
|||
|
|
@ -55,12 +55,16 @@ namespace fishbone {
|
|||
|
||||
class SoundLoader {
|
||||
public:
|
||||
SoundLoader(){};
|
||||
~SoundLoader(){};
|
||||
SoundLoader() {};
|
||||
~SoundLoader() {};
|
||||
|
||||
virtual Sound* open(Mixer* mixer, void* buffer, size_t size){return nullptr;};
|
||||
virtual int read(Sound* sound, short* buffer, size_t frames){return 0;};
|
||||
virtual void seek(Sound* sound, size_t pos){};
|
||||
virtual Sound* open(Mixer* mixer, void* buffer, size_t size) {
|
||||
return nullptr;
|
||||
};
|
||||
virtual int read(Sound* sound, short* buffer, size_t frames) {
|
||||
return 0;
|
||||
};
|
||||
virtual void seek(Sound* sound, size_t pos) {};
|
||||
};
|
||||
|
||||
class Sound {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace fishbone {
|
|||
using AccurateClock = std::chrono::time_point<std::chrono::high_resolution_clock, std::chrono::high_resolution_clock::duration>;
|
||||
|
||||
fishbone::AccurateClock accurateTime();
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
/* no includes */
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,6 @@ namespace fishbone {
|
|||
float y;
|
||||
float z;
|
||||
};
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace fishbone {
|
|||
~Window();
|
||||
|
||||
void poll();
|
||||
void swapBuffer();
|
||||
};
|
||||
}; // namespace fishbone
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue