Skip to content

Commit

Permalink
Fixed ui tests (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
VladasZ authored Nov 12, 2024
2 parents 595ab6d + 057d916 commit 647ea7b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion deps/gen/src/maze/maker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct Maker {

impl Maker {
fn new(size: Size<usize>) -> Self {
assert!(!size.no_area());
assert!(!size.has_no_area());
Self {
size,
current_pos: Point::default(),
Expand Down
2 changes: 1 addition & 1 deletion deps/gm/src/flat/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<T: Copy> Size<T> {
}

impl<T: IsZero> Size<T> {
pub fn no_area(&self) -> bool {
pub fn has_no_area(&self) -> bool {
self.width.is_zero() || self.height.is_zero()
}
}
Expand Down
4 changes: 4 additions & 0 deletions deps/wgpu-wrapper/src/render/sprite_drawer/box_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ impl BoxPipeline {
camera_pos: Point,
resolution: Size,
) {
if self.boxes.is_empty() {
return;
}

render_pass.set_pipeline(&self.pipeline);

self.view.update(SpriteRenderView {
Expand Down
4 changes: 4 additions & 0 deletions deps/wgpu-wrapper/src/render/vec_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ impl<T> VecBuffer<T> {
self.data.push(val);
}

pub fn is_empty(&self) -> bool {
self.data.is_empty()
}

pub fn len(&self) -> u32 {
self.len
}
Expand Down
4 changes: 4 additions & 0 deletions test-engine/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ impl wgpu_wrapper::App for App {
fn render<'a>(&'a mut self, pass: &mut RenderPass<'a>) {
let window_size = UIManager::resolution();

if window_size.has_no_area() {
return;
}

pass.set_viewport(0.0, 0.0, window_size.width, window_size.height, 0.0, 1.0);

LevelDrawer::draw(pass);
Expand Down
3 changes: 0 additions & 3 deletions test-engine/src/scene/camera_uniform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
use scene::Camera;

#[repr(C)]
// This is so we can store this in a buffer
#[derive(Debug, Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
struct CameraUniform {
// We can't use cgmath with bytemuck directly, so we'll have
// to convert the Matrix4 into a 4x4 f32 array
view_proj: [[f32; 4]; 4],
}

Expand Down

0 comments on commit 647ea7b

Please sign in to comment.