Skip to content

Commit

Permalink
[ren] api header for quad renderer needs to include vector
Browse files Browse the repository at this point in the history
  • Loading branch information
harrand committed Oct 31, 2024
1 parent 8ecf61b commit 844c45d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
1 change: 1 addition & 0 deletions include/tz/ren/quad.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef TOPAZ_REN_QUAD_HPP
#define TOPAZ_REN_QUAD_HPP
#include "tz/core/handle.hpp"
#include "tz/core/vector.hpp"
#include "tz/gpu/graph.hpp"

namespace tz::ren
Expand Down
33 changes: 2 additions & 31 deletions test/tz/ren_quad_test.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@

#include "tz/topaz.hpp"
#include "tz/ren/quad.hpp"
#include "tz/os/window.hpp"
#include "tz/os/input.hpp"
#include "tz/gpu/hardware.hpp"

int main()
{
tz::initialise();
tz::os::open_window({});
tz::os::open_window({.flags = tz::os::window_flags::invisible});

tz::gpu::hardware gpu = tz::gpu::find_best_hardware();
tz_must(tz::gpu::use_hardware(gpu));
Expand All @@ -19,37 +17,10 @@ int main()

tz_must(tz::ren::quad_renderer_create_quad(ren, {.position = {-0.5f, -0.5f}, .scale = {0.15f, 0.15f}, .colour = {0.5f, 0.1f, 0.85f}}));

while(tz::os::window_is_open())
for(std::size_t i = 0; i < 64; i++)
{
tz::os::window_update();
tz::gpu::execute(tz::ren::quad_renderer_graph(ren));
tz::v2f pos = tz::ren::get_quad_position(ren, quad1);
tz::v2f scale = tz::ren::get_quad_scale(ren, quad1);
if(tz::os::is_key_pressed(tz::os::key::a))
{
tz::ren::set_quad_position(ren, quad1, pos += {-0.002f, 0.0f});
}
if(tz::os::is_key_pressed(tz::os::key::d))
{
tz::ren::set_quad_position(ren, quad1, pos += {0.002f, 0.0f});
}
if(tz::os::is_key_pressed(tz::os::key::w))
{
tz::ren::set_quad_position(ren, quad1, pos += {0.0f, 0.002f});
}
if(tz::os::is_key_pressed(tz::os::key::s))
{
tz::ren::set_quad_position(ren, quad1, pos += {0.0f, -0.002f});
}

if(tz::os::is_key_pressed(tz::os::key::i))
{
tz::ren::set_quad_scale(ren, quad1, scale * 1.001f);
}
if(tz::os::is_key_pressed(tz::os::key::k))
{
tz::ren::set_quad_scale(ren, quad1, scale * 0.999f);
}
}

tz_must(tz::ren::destroy_quad_renderer(ren));
Expand Down

0 comments on commit 844c45d

Please sign in to comment.