summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-01-19 02:16:00 +0100
committerkdx <kikoodx@paranoici.org>2023-01-19 02:25:15 +0100
commitfc3fc2ba5eca1f898a8339920adc5aedf0a97e73 (patch)
treee22db822368c7ad676ad83db14be0b1662ff2d59
parentc2d967df8d4242778bb14d7f8cda718324b2b846 (diff)
download005-fc3fc2ba5eca1f898a8339920adc5aedf0a97e73.tar.gz
hand goes zooooooooooooooooooom
-rw-r--r--Cursor.cpp25
-rw-r--r--Cursor.hpp2
-rw-r--r--main.cpp1
3 files changed, 27 insertions, 1 deletions
diff --git a/Cursor.cpp b/Cursor.cpp
index b5a1412..79d712a 100644
--- a/Cursor.cpp
+++ b/Cursor.cpp
@@ -1,8 +1,10 @@
#include "Cursor.hpp"
#include "lzr.h"
#include <stdlib.h>
+#include <math.h>
-Cursor::Cursor() : x(0), y(0), down(false), erase(false)
+Cursor::Cursor() : _angle(0.0), _xscale(1.0), _yscale(1.0),
+ x(0), y(0), down(false), erase(false)
{
}
@@ -11,6 +13,24 @@ void Cursor::update()
LZR_MousePosition(&x, &y);
down = LZR_BUTTON(MOUSE_L);
erase = LZR_BUTTON(MOUSE_R);
+ if (erase) {
+ _angle -= 1.0 / 16;
+ _xscale = sin(LZR_GetTick());
+ _yscale = cos(LZR_GetTick());
+ while (_angle < -2.0)
+ _angle += 1.0;
+ } else if (down) {
+ _angle += 1.0 / 16;
+ _xscale = sin(LZR_GetTick());
+ _yscale = cos(LZR_GetTick());
+ while (_angle > 2.0)
+ _angle -= 1.0;
+ } else {
+ double target_angle = 0.0;
+ _angle += target_angle - _angle * 0.1;
+ _xscale = 1.0 - _xscale * 0.1;
+ _yscale = 1.0 - _yscale * 0.1;
+ }
}
void Cursor::draw()
@@ -18,6 +38,9 @@ void Cursor::draw()
LZR_ImageDrawSettings stg = {
0, 0, -1, -1, 1.0, 1.0, 0.0, true, false, false
};
+ stg.angle = _angle;
+ stg.scale_x = _xscale;
+ stg.scale_y = _yscale;
set_color();
LZR_DrawImageEx(down || erase ? LZR_IMAGE("res/cursor_down.bmp")
: LZR_IMAGE("res/cursor_up.bmp"),
diff --git a/Cursor.hpp b/Cursor.hpp
index 10e60a7..1ac2d0e 100644
--- a/Cursor.hpp
+++ b/Cursor.hpp
@@ -1,6 +1,8 @@
#pragma once
class Cursor {
+private:
+ double _angle, _xscale, _yscale;
public:
int x, y;
bool down, erase;
diff --git a/main.cpp b/main.cpp
index f3902ad..1e7c074 100644
--- a/main.cpp
+++ b/main.cpp
@@ -13,6 +13,7 @@ int main(int argc, char **argv)
LZR_Quit();
return 1;
}
+ LZR_ToggleFullscreen();
char snd_path[] = "res/sample_x.wav";
char *snd_x = strchr(snd_path, 'x');
for (int i = 0; i < 2; i++) {