mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
some testing
This commit is contained in:
parent
e57be9a0e7
commit
7e2da23398
@ -14,6 +14,7 @@ namespace engine {
|
||||
~CustomBehaviourSystem();
|
||||
|
||||
void OnUpdate(float ts) override;
|
||||
void OnComponentInsert(uint32_t entity) override;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -1135,7 +1135,7 @@ namespace engine {
|
||||
|
||||
void GFXDevice::UpdateDescriptorCombinedImageSampler(const gfx::DescriptorSet *set, uint32_t binding, const gfx::Image* image, const gfx::Sampler* sampler)
|
||||
{
|
||||
assert(pimpl->FRAMECOUNT == 0);
|
||||
//assert(pimpl->FRAMECOUNT == 0);
|
||||
|
||||
VkDescriptorImageInfo imageInfo{};
|
||||
imageInfo.sampler = sampler->sampler;
|
||||
@ -1310,7 +1310,9 @@ namespace engine {
|
||||
gfx::Image* GFXDevice::CreateImage(uint32_t w, uint32_t h, const void* imageData)
|
||||
{
|
||||
assert(imageData != nullptr);
|
||||
assert(pimpl->FRAMECOUNT == 0);
|
||||
if (pimpl->FRAMECOUNT != 0) {
|
||||
//throw std::runtime_error("Framecount must be 0 when creating a texture");
|
||||
}
|
||||
|
||||
gfx::Image* out = new gfx::Image{};
|
||||
|
||||
|
@ -98,6 +98,9 @@ Texture::Texture(RenderData* render_data, const uint8_t* bitmap, int width,
|
||||
LOG_INFO("Loaded texture: BITMAP, width: {} height: {}", width, height);
|
||||
}
|
||||
|
||||
Texture::~Texture() { gfx_->DestroyImage(image_); }
|
||||
Texture::~Texture() {
|
||||
LOG_INFO("Destroying texture...");
|
||||
gfx_->DestroyImage(image_);
|
||||
}
|
||||
|
||||
} // namespace engine::resources
|
||||
|
@ -24,4 +24,9 @@ void CustomBehaviourSystem::OnUpdate(float ts) {
|
||||
}
|
||||
}
|
||||
|
||||
void CustomBehaviourSystem::OnComponentInsert(uint32_t entity)
|
||||
{
|
||||
(void)entity;
|
||||
}
|
||||
|
||||
} // namespace engine
|
@ -130,7 +130,7 @@ void PlayGame(GameSettings settings) {
|
||||
floor_collider->aabb = {{0.0f, 0.0f, 0.0f}, {10000.0f, 1.0f, 10000.0f}};
|
||||
}
|
||||
|
||||
//engine::util::LoadMeshFromFile(
|
||||
// engine::util::LoadMeshFromFile(
|
||||
// my_scene, app.GetResourcePath("models/astronaut/astronaut.dae"));
|
||||
|
||||
/* skybox */
|
||||
@ -169,8 +169,23 @@ void PlayGame(GameSettings settings) {
|
||||
(float)height / (float)width;
|
||||
|
||||
my_scene->AddComponent<engine::CustomComponent>(textbox)->onUpdate =
|
||||
[](float ts) {
|
||||
/* LOG_INFO("Time step: {}", ts); */
|
||||
[&](float ts) {
|
||||
(void)ts;
|
||||
static float time_elapsed;
|
||||
time_elapsed += ts;
|
||||
if (time_elapsed >= 1.0f) {
|
||||
time_elapsed = 0;
|
||||
LOG_INFO("Time step: {}", ts);
|
||||
|
||||
int fpsWidth, fpsHeight;
|
||||
auto fpsBitmap =
|
||||
app.GetResource<engine::resources::Font>("builtin.mono")
|
||||
->GetTextBitmap("fps", 768.0f, fpsWidth, fpsHeight);
|
||||
textbox_renderable->material->texture_ =
|
||||
std::make_unique<engine::resources::Texture>(
|
||||
&app.render_data_, fpsBitmap->data(), fpsWidth, fpsHeight,
|
||||
engine::resources::Texture::Filtering::kBilinear);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user