renderelement2d texture loading
This commit is contained in:
parent
103a35ee40
commit
6eb23b88bd
3 changed files with 19 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
module;
|
module;
|
||||||
#include "../lib/stb_truetype.h"
|
#include "../lib/stb_truetype.h"
|
||||||
export module Crafter.Graphics:RenderingElement2D;
|
export module Crafter.Graphics:RenderingElement2D;
|
||||||
|
import Crafter.Asset;
|
||||||
import std;
|
import std;
|
||||||
import :Transform2D;
|
import :Transform2D;
|
||||||
import :Font;
|
import :Font;
|
||||||
|
|
@ -129,6 +130,12 @@ export namespace Crafter {
|
||||||
}
|
}
|
||||||
RenderingElement2D(Anchor2D anchor, OpaqueType opaque, std::uint32_t bufferWidth, std::uint32_t bufferHeight, std::uint32_t rotation) requires(Owning && Rotating) : RenderingElement2DBase(anchor, opaque), ScalingBase<Scaling, Owning>(bufferWidth, bufferHeight) , RotatingBase<Rotating>(rotation) {
|
RenderingElement2D(Anchor2D anchor, OpaqueType opaque, std::uint32_t bufferWidth, std::uint32_t bufferHeight, std::uint32_t rotation) requires(Owning && Rotating) : RenderingElement2DBase(anchor, opaque), ScalingBase<Scaling, Owning>(bufferWidth, bufferHeight) , RotatingBase<Rotating>(rotation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
RenderingElement2D(Anchor2D anchor, TextureAsset<Vector<std::uint8_t, 4>> texture) requires(!Owning && Scaling) : RenderingElement2DBase(anchor, texture.opaque), ScalingBase<Scaling, Owning>(texture.sizeX, texture.sizeY, texture.pixels) {
|
||||||
|
|
||||||
|
}
|
||||||
|
RenderingElement2D(Anchor2D anchor, TextureAsset<Vector<std::uint8_t, 4>> texture, std::uint32_t rotation) requires(!Owning && Scaling && Rotating) : RenderingElement2DBase(anchor, texture.opaque), ScalingBase<Scaling, Owning>(texture.sizeX, texture.sizeY, texture.pixels), RotatingBase<Rotating>(rotation) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingElement2D(RenderingElement2D&) = delete;
|
RenderingElement2D(RenderingElement2D&) = delete;
|
||||||
|
|
|
||||||
|
|
@ -49,12 +49,6 @@ export namespace Crafter {
|
||||||
std::chrono::duration<double> delta;
|
std::chrono::duration<double> delta;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class OpaqueType {
|
|
||||||
FullyOpaque, // All pixels have A of 255
|
|
||||||
SemiOpaque, // All pixels have A of 0 or 255 (no blending needed)
|
|
||||||
Transparent // Color blending is used
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class CrafterKeys {
|
enum class CrafterKeys {
|
||||||
// Alphabetic keys
|
// Alphabetic keys
|
||||||
A, B, C, D, E, F, G, H, I, J, K, L, M,
|
A, B, C, D, E, F, G, H, I, J, K, L, M,
|
||||||
|
|
|
||||||
12
project.json
12
project.json
|
|
@ -97,6 +97,10 @@
|
||||||
{
|
{
|
||||||
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
||||||
"configuration":"lib"
|
"configuration":"lib"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git",
|
||||||
|
"configuration":"lib"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -110,6 +114,10 @@
|
||||||
{
|
{
|
||||||
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
||||||
"configuration":"lib"
|
"configuration":"lib"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git",
|
||||||
|
"configuration":"lib"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"defines": [{ "name": "CRAFTER_TIMING" }]
|
"defines": [{ "name": "CRAFTER_TIMING" }]
|
||||||
|
|
@ -127,6 +135,10 @@
|
||||||
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git",
|
||||||
"pathh":"/home/jorijn/repos/Crafter/Crafter.Math/project.json",
|
"pathh":"/home/jorijn/repos/Crafter/Crafter.Math/project.json",
|
||||||
"configuration":"lib-debug"
|
"configuration":"lib-debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path":"https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git",
|
||||||
|
"configuration":"lib-debug"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue