work on app class and start work on iron
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <amethyst/app.hpp>
|
||||
#include <amethyst/assets.hpp>
|
||||
#include <amethyst/c3d.hpp>
|
||||
#include <amethyst/ctru.hpp>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <amethyst/asset.hpp>
|
||||
#include <amethyst/types.hpp>
|
||||
|
||||
namespace amy {
|
||||
class app {
|
||||
@@ -8,8 +9,12 @@ class app {
|
||||
app() {}
|
||||
~app() {}
|
||||
|
||||
virtual void main() {}
|
||||
void run();
|
||||
private:
|
||||
|
||||
double delta() const { return m_delta; }
|
||||
|
||||
private:
|
||||
ull m_last;
|
||||
double m_delta;
|
||||
};
|
||||
} // namespace amy
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <amethyst/types.hpp>
|
||||
|
||||
namespace amy {
|
||||
namespace ctru {
|
||||
enum services {
|
||||
@@ -10,5 +12,6 @@ enum services {
|
||||
def = romfs | gfx_def
|
||||
};
|
||||
void init(unsigned int srv = def);
|
||||
ull getTime();
|
||||
} // namespace ctru
|
||||
} // namespace amy
|
||||
@@ -3,12 +3,11 @@
|
||||
#include <string>
|
||||
|
||||
namespace amy {
|
||||
class gtrace {
|
||||
public:
|
||||
gtrace() = default;
|
||||
~gtrace() = default;
|
||||
class gtrace {
|
||||
public:
|
||||
gtrace() = default;
|
||||
~gtrace() = default;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
}
|
||||
private:
|
||||
};
|
||||
} // namespace amy
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <amethyst/linearAlloc.hpp>
|
||||
#include <amethyst/maths/mat.hpp>
|
||||
#include <amethyst/maths/vec.hpp>
|
||||
#include <amethyst/texture.hpp>
|
||||
#include <amethyst/types.hpp>
|
||||
|
||||
namespace amy {
|
||||
class iron {
|
||||
@@ -23,12 +25,56 @@ class iron {
|
||||
amy::fvec2 uv;
|
||||
u32 color = 0;
|
||||
};
|
||||
class command {
|
||||
command() = default;
|
||||
using ref = up<command>;
|
||||
command& add(const u16& idx) {
|
||||
indexBuf.push_back(vertexBuf.size() + idx);
|
||||
return *this;
|
||||
}
|
||||
command& add(const vertex& vtx) {
|
||||
vertexBuf.push_back(std::move(vtx));
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<vertex> vertexBuf;
|
||||
std::vector<u16> indexBuf;
|
||||
ivec4 scissorRect;
|
||||
bool scissorOn = false;
|
||||
int layer;
|
||||
int index;
|
||||
texture* tex;
|
||||
};
|
||||
class drawlist {
|
||||
public:
|
||||
drawlist() { drawSolid(); }
|
||||
~drawlist() { m_data.clear(); }
|
||||
|
||||
// required due to memory management
|
||||
drawlist(const drawlist&) = delete;
|
||||
drawlist& operator=(const drawlist&) = delete;
|
||||
drawlist(drawlist&&) noexcept = default;
|
||||
drawlist& operator=(drawlist&&) noexcept = default;
|
||||
|
||||
void merge(drawlist* list);
|
||||
command::ref newCommand();
|
||||
void push(commad* cmd);
|
||||
void clear();
|
||||
|
||||
void drawSolid();
|
||||
void drawTex(texture* tex) { m_tex = tex; }
|
||||
|
||||
private:
|
||||
std::vector<command::ref> m_data;
|
||||
texture* m_tex;
|
||||
};
|
||||
iron() = default;
|
||||
~iron() = default;
|
||||
|
||||
static void init();
|
||||
static void newFrame();
|
||||
static void drawOn(c3d::screen* screen);
|
||||
static void draw(const std::vector<command>& data);
|
||||
|
||||
private:
|
||||
static void setupShader();
|
||||
|
||||
@@ -13,7 +13,11 @@ using ui = unsigned int;
|
||||
using ull = unsigned long long;
|
||||
using str = std::string;
|
||||
using cstr = const std::string;
|
||||
template <typename T> using vec = std::vector<T>;
|
||||
using ksr = const std::string&;
|
||||
template <typename T>
|
||||
using vec = std::vector<T>;
|
||||
template <typename T>
|
||||
using cvec = const std::vector<T>;
|
||||
template <typename T>
|
||||
using up = std::unique_ptr<T>;
|
||||
} // namespace amy
|
||||
Reference in New Issue
Block a user