| ... | ... |
@@ -22,17 +22,17 @@ |
| 22 | 22 |
|
| 23 | 23 |
( devices ) |
| 24 | 24 |
|
| 25 |
-|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 25 |
+|00 @System &vector $2 &wst $1 &rst $1 &pad $4 &r $2 &g $2 &b $2 &debug $1 &halt $1 |
|
| 26 | 26 |
|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1 |
| 27 |
-|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 28 |
-|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 29 |
-|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 30 |
-|50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 31 |
-|60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 27 |
+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1 |
|
| 28 |
+|30 @Audio0 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 29 |
+|40 @Audio1 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 30 |
+|50 @Audio2 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 31 |
+|60 @Audio3 &vector $2 &position $2 &output $1 &pad $3 &adsr $2 &length $2 &addr $2 &volume $1 &pitch $1 |
|
| 32 | 32 |
|80 @Controller &vector $2 &button $1 &key $1 |
| 33 |
-|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &modx $2 &mody $2 |
|
| 34 |
-|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
| 35 |
-|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |
|
| 33 |
+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2 |
|
| 34 |
+|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |
|
| 35 |
+|b0 @DateTime &year $2 &month $1 &day $1 &hour $1 &minute $1 &second $1 &dotw $1 &doty $2 &isdst $1 |
|
| 36 | 36 |
|
| 37 | 37 |
( variables ) |
| 38 | 38 |
|
| ... | ... |
@@ -13,4 +13,4 @@ WITH REGARD TO THIS SOFTWARE. |
| 13 | 13 |
void mouse_down(Device *d, Uint8 mask); |
| 14 | 14 |
void mouse_up(Device *d, Uint8 mask); |
| 15 | 15 |
void mouse_pos(Device *d, Uint16 x, Uint16 y); |
| 16 |
-void mouse_mod(Device *d, Uint16 x, Uint16 y); |
|
| 16 |
+void mouse_scroll(Device *d, Uint16 x, Uint16 y); |
| ... | ... |
@@ -500,16 +500,16 @@ run(Uxn *u) |
| 500 | 500 |
else if(event.type >= audio0_event && event.type < audio0_event + POLYPHONY) |
| 501 | 501 |
uxn_eval(u, peek16((devaudio0 + (event.type - audio0_event))->dat, 0)); |
| 502 | 502 |
/* Mouse */ |
| 503 |
- else if(event.type == SDL_MOUSEWHEEL) |
|
| 504 |
- mouse_mod(devmouse, event.wheel.x, event.wheel.y); |
|
| 505 |
- else if(event.type == SDL_MOUSEBUTTONUP) |
|
| 506 |
- mouse_up(devmouse, 0x1 << (event.button.button - 1)); |
|
| 507 |
- else if(event.type == SDL_MOUSEBUTTONDOWN) |
|
| 508 |
- mouse_down(devmouse, 0x1 << (event.button.button - 1)); |
|
| 509 | 503 |
else if(event.type == SDL_MOUSEMOTION) |
| 510 | 504 |
mouse_pos(devmouse, |
| 511 | 505 |
clamp(event.motion.x - PAD, 0, ppu.width - 1), |
| 512 | 506 |
clamp(event.motion.y - PAD, 0, ppu.height - 1)); |
| 507 |
+ else if(event.type == SDL_MOUSEBUTTONUP) |
|
| 508 |
+ mouse_up(devmouse, 0x1 << (event.button.button - 1)); |
|
| 509 |
+ else if(event.type == SDL_MOUSEBUTTONDOWN) |
|
| 510 |
+ mouse_down(devmouse, 0x1 << (event.button.button - 1)); |
|
| 511 |
+ else if(event.type == SDL_MOUSEWHEEL) |
|
| 512 |
+ mouse_scroll(devmouse, event.wheel.x, event.wheel.y); |
|
| 513 | 513 |
/* Controller */ |
| 514 | 514 |
else if(event.type == SDL_KEYDOWN || event.type == SDL_TEXTINPUT) {
|
| 515 | 515 |
if(event.type == SDL_TEXTINPUT) |
| ... | ... |
@@ -522,17 +522,16 @@ run(Uxn *u) |
| 522 | 522 |
do_shortcut(u, &event); |
| 523 | 523 |
} else if(event.type == SDL_KEYUP) |
| 524 | 524 |
controller_up(devctrl, get_button(&event)); |
| 525 |
- else if(event.type == SDL_JOYBUTTONDOWN) |
|
| 526 |
- controller_down(devctrl, get_button_joystick(&event)); |
|
| 527 |
- else if(event.type == SDL_JOYBUTTONUP) |
|
| 528 |
- controller_up(devctrl, get_button_joystick(&event)); |
|
| 529 | 525 |
else if(event.type == SDL_JOYAXISMOTION) {
|
| 530 | 526 |
Uint8 vec = get_vector_joystick(&event); |
| 531 | 527 |
if(!vec) |
| 532 | 528 |
controller_up(devctrl, (0x03 << (!event.jaxis.axis * 2)) << 4); |
| 533 | 529 |
else |
| 534 | 530 |
controller_down(devctrl, (0x01 << ((vec + !event.jaxis.axis * 2) - 1)) << 4); |
| 535 |
- } |
|
| 531 |
+ } else if(event.type == SDL_JOYBUTTONDOWN) |
|
| 532 |
+ controller_down(devctrl, get_button_joystick(&event)); |
|
| 533 |
+ else if(event.type == SDL_JOYBUTTONUP) |
|
| 534 |
+ controller_up(devctrl, get_button_joystick(&event)); |
|
| 536 | 535 |
/* Console */ |
| 537 | 536 |
else if(event.type == stdin_event) |
| 538 | 537 |
console_input(u, event.cbutton.button); |