Skip to content

Commit

Permalink
Rename constants
Browse files Browse the repository at this point in the history
  • Loading branch information
sergystepanov committed Mar 9, 2024
1 parent 6496327 commit e54bed2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions pkg/worker/caged/libretro/nanoarch/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
//#include <stdint.h>
import "C"

const KeyPressed = C.int16_t(1)
const KeyReleased = C.int16_t(0)
const (
Released C.int16_t = iota
Pressed
)

// InputState stores full controller state.
// It consists of:
Expand Down Expand Up @@ -119,9 +121,9 @@ func (ks *KeyboardState) Pressed(key uint) C.int16_t {
_, ok := ks.keys[key]
ks.mu.Unlock()
if ok {
return KeyPressed
return Pressed
}
return KeyReleased
return Released
}

// ShiftPos sets mouse relative position state.
Expand Down
8 changes: 4 additions & 4 deletions pkg/worker/caged/libretro/nanoarch/nanoarch.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,17 @@ func coreInputState(port C.unsigned, device C.unsigned, index C.unsigned, id C.u
return y
case C.RETRO_DEVICE_ID_MOUSE_LEFT:
if l, _, _ := Nan0.mouse.Buttons(); l {
return KeyPressed
return Pressed
}
case C.RETRO_DEVICE_ID_MOUSE_RIGHT:
if _, r, _ := Nan0.mouse.Buttons(); r {
return KeyPressed
return Pressed
}
case C.RETRO_DEVICE_ID_MOUSE_WHEELUP:
case C.RETRO_DEVICE_ID_MOUSE_WHEELDOWN:
case C.RETRO_DEVICE_ID_MOUSE_MIDDLE:
if _, _, m := Nan0.mouse.Buttons(); m {
return KeyPressed
return Pressed
}
case C.RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELUP:
case C.RETRO_DEVICE_ID_MOUSE_HORIZ_WHEELDOWN:
Expand All @@ -672,7 +672,7 @@ func coreInputState(port C.unsigned, device C.unsigned, index C.unsigned, id C.u
}
}

return KeyReleased
return Released
}

//export coreAudioSample
Expand Down

0 comments on commit e54bed2

Please sign in to comment.