Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-01-16 10:02:45 -05:00
9 changed files with 30 additions and 26 deletions

View File

@@ -38,17 +38,17 @@ CPMAddPackage(
CPMAddPackage(
NAME ReWindow
URL https://git.redacted.cc/Redacted/ReWindow/archive/Prerelease-30.zip
URL https://git.redacted.cc/Redacted/ReWindow/archive/Prerelease-31.zip
)
CPMAddPackage(
NAME JGL
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-42.zip
URL https://git.redacted.cc/josh/JGL/archive/Prerelease-46.zip
)
CPMAddPackage(
NAME JUI
URL https://git.redacted.cc/josh/ReJUI/archive/Prerelease-5.5.zip
URL https://git.redacted.cc/josh/ReJUI/archive/Prerelease-5.6.zip
)
CPMAddPackage(

View File

@@ -7,25 +7,23 @@ namespace CaveGame::Core {
void Explosion::Draw() {
if (HasDetonated()) {
if (anim_timer < 1.25f) {
JGL::J2D::Begin();
//JGL::J2D::Begin();
auto* tex = Client::AssetService::Get()->explosion_sprite;
if (anim_timer > 4.f / 5.f) {
//JGL::J2D::DrawPartialSprite(tex, position);
} else if (anim_timer > 3.f / 5.f) {
} else if (anim_timer > 2.f / 5.f) {
} else if (anim_timer > 1.f / 5.f) {
if (anim_timer > (4.f / 5.f)) {
JGL::J2D::DrawPartialSprite(tex, position, SP_EXPLOSION4.minPoint, SP_EXPLOSION4.maxPoint, rotation, {0,0});
} else if (anim_timer > (3.f / 5.f)) {
JGL::J2D::DrawPartialSprite(tex, position, SP_EXPLOSION3.minPoint, SP_EXPLOSION3.maxPoint, rotation, {16, 16});
} else if (anim_timer > (2.f / 5.f)) {
JGL::J2D::DrawPartialSprite(tex, position, SP_EXPLOSION2.minPoint, SP_EXPLOSION2.maxPoint, rotation, {16, 16});
} else if (anim_timer > (1.f / 5.f)) {
JGL::J2D::DrawPartialSprite(tex, position, SP_EXPLOSION1.minPoint, SP_EXPLOSION1.maxPoint, rotation, {16, 16});
} else {
JGL::J2D::DrawPartialSprite(tex, position, SP_EXPLOSION0.minPoint, SP_EXPLOSION0.maxPoint, rotation, {16, 16});
}
JGL::J2D::End();
//JGL::J2D::End();
}
}
}

View File

@@ -40,7 +40,7 @@ void CaveGame::Client::Splash::ComputeMatrixTextureCache()
for (int i = 0; i < column_textures.size(); i++)
{
Vector2 column_size = {glyph_measurement.x, glyph_measurement.y * 100};
Vector2i column_size = {(int) glyph_measurement.x, (int) glyph_measurement.y * 100};
auto* column = new JGL::RenderTarget(column_size, {0, 0, 0, 0}, false);
JGL::J2D::Begin(column, true);

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -2,6 +2,7 @@
#include "ClientApp/CaveGameWindow.hpp"
#include <bits/random.h>
#include <Core/Explosion.hpp>
#include <Core/Loggers.hpp>
#include <Core/Player.hpp>
#include <rewindow/inputservice.hpp>
@@ -337,7 +338,9 @@ namespace CaveGame::ClientApp
if (ev.key == Keys::P) {
auto coords = game_ctx->world->camera.ScreenToWorld(InputService::GetMousePosition());
auto* plr = new Core::Player(coords);
auto* plr = new Core::Explosion(coords, 1.f, 1.f);
//auto* plr2 = new Core::Player(coords);
//game_ctx->world->AddEntity(plr2);
game_ctx->world->AddEntity(plr);
}
}

View File

@@ -66,7 +66,7 @@ namespace CaveGame::Core
[[nodiscard]] const TileID* ptr() const { return &tiles[0][0];}
[[nodiscard]] std::vector<TileID> DataContiguous() const;
[[nodiscard]] std::array<TileID, ChunkSize * ChunkSize> DataContiguous() const;
void SetData(char* buffer);

View File

@@ -14,7 +14,9 @@ namespace CaveGame::Core
const AABB2D SP_EXPLOSION2 {{64, 0}, {32, 32}};
const AABB2D SP_EXPLOSION3 {{96, 0}, {32, 32}};
const AABB2D SP_EXPLOSION4 {{128, 0}, {32, 32}};
Explosion(const Vector2& position, float force, float radius, float fuse = 0.f, bool damage_tiles = true);
Explosion(const Vector2& position, float force, float radius, float fuse = 0.f, bool damage_tiles = true) : Entity(position) {
rotation = 0; //Math::Radians( std::rand() % 360);
}
void Detonate() {
detonated = true;
health = 0;
@@ -25,9 +27,10 @@ namespace CaveGame::Core
void Update(float elapsed) override;
protected:
float fuse;
float fuse = 0.f;
float radius;
float force;
float rotation = 0;
bool detonated = false;
float anim_timer = 0.f;
private:

View File

@@ -72,10 +72,10 @@ namespace CaveGame::Core
return GetChunkCell()*Core::Chunk::ChunkSize;
}
std::vector<TileID> Chunk::DataContiguous() const {
std::vector<TileID> data(ChunkSize * ChunkSize);
memcpy(data.data(), tiles, ChunkSize * ChunkSize * sizeof(TileID));
return data;
std::array<TileID, Chunk::ChunkSize * Chunk::ChunkSize> Chunk::DataContiguous() const {
std::array<TileID, ChunkSize * ChunkSize> result{};
memcpy(result.data(), tiles, ChunkSize * ChunkSize * sizeof(TileID));
return result;
}
void Chunk::SetData(char* buffer) {

View File

@@ -10,7 +10,7 @@ namespace CaveGame::Core {
if (fuse > 0.f)
fuse -= elapsed;
if (fuse < 0.f && !HasDetonated())
if (fuse <= 0.f && !HasDetonated())
Detonate();