Skip to content

Commit

Permalink
Remove unused keyboard funcs
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
  • Loading branch information
jwinarske committed May 14, 2024
1 parent d978933 commit 36fc8f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
18 changes: 0 additions & 18 deletions examples/vk-shadertoy/shader_toy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ ShaderToy::init(int width, int height, struct wl_display *wl_display, struct wl_
return 0;
}

void ShaderToy::update_key_map(int w, int h, bool val) {
keyboard_map_[w][h] = val;
keyboard_texture_[(h * 256 + w) * 4] = val ? 0xff : 0x00;
}

void ShaderToy::update_keypress() {
if (keyboard_need_update_)
keyboard_draw_ = true;
else
keyboard_draw_ = false;
if (keyboard_need_update_) {
for (uint8_t i = 0; i < 0xff; i++) {
update_key_map(i, 1, false);
}
}
keyboard_need_update_ = false;
}

bool ShaderToy::update_iKeyboard_texture(struct vk_physical_device *phy_dev, struct vk_device *dev,
struct vk_render_essentials *essentials,
struct render_data *render_data) {
Expand Down
16 changes: 6 additions & 10 deletions examples/vk-shadertoy/shader_toy.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class ShaderToy : public VulkanUtils, public VulkanRender {

struct app_os_window *get_app_os_window() { return &os_window_; }

void quit() { os_window_.app_data.quit = true; };

void toggle_pause() { os_window_.app_data.pause = !os_window_.app_data.pause; }

void toggle_draw_debug() { os_window_.app_data.drawdebug = !os_window_.app_data.drawdebug; }
Expand All @@ -35,26 +33,24 @@ class ShaderToy : public VulkanUtils, public VulkanRender {

private:

uint32_t resize_size_[2]{}; // = {1280, 720}; // in Wayland surface should set own size
uint32_t resize_size_[2]{};

bool main_image_srgb_ = false; // srgb surface fix

// keyboard is texture that send from this data
bool keyboard_map_[0xff][3]{}; //[ASCII code][0: current state of key, 1: Keypress, 2: toggle for key]
uint8_t keyboard_texture_[256 * 3 * 4]{}; // texture
bool keyboard_need_update_{};
bool keyboard_draw_{};
bool screenshot_once_{};

// update to 2021 Shadertoy iMouse.w change https://www.shadertoy.com/view/llySRh (comments)
bool last_iMousel_clicked_[2] = {};

// do not edit, it just to see where keyboard texture used
#define iKeyboard 1
// do not edit, it just to see where keyboard texture used
static constexpr uint32_t iKeyboard = UINT32_C(1);

// to build-in compressed shaders into bin(exe) file
// used OFFSCREEN_BUFFERS size, names of .hex files should be set manually(and edit yariv_shaders[]), this example using 4 buffers same as on shadertoy
//#define YARIV_SHADER
// to build-in compressed shaders into bin(exe) file
// used OFFSCREEN_BUFFERS size, names of .hex files should be set manually(and edit yariv_shaders[]), this example using 4 buffers same as on shadertoy
//#define YARIV_SHADER

struct shaders_push_constants {
float iMouse[4];
Expand Down

0 comments on commit 36fc8f8

Please sign in to comment.