Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdl: gamecontroller, joystick: Add new bindings for SDL 2.0.6 and 2.0.4 #313

Merged
merged 5 commits into from
Feb 10, 2018

Conversation

malashin
Copy link
Collaborator

@malashin malashin commented Feb 6, 2018

No description provided.

JOYSTICK_TYPE_GUITAR = C.SDL_JOYSTICK_TYPE_GUITAR
JOYSTICK_TYPE_DRUM_KIT = C.SDL_JOYSTICK_TYPE_DRUM_KIT
JOYSTICK_TYPE_ARCADE_PAD = C.SDL_JOYSTICK_TYPE_ARCADE_PAD
JOYSTICK_TYPE_THROTTLE = C.SDL_JOYSTICK_TYPE_THROTTLE

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_DANCE_PAD = C.SDL_JOYSTICK_TYPE_DANCE_PAD
JOYSTICK_TYPE_GUITAR = C.SDL_JOYSTICK_TYPE_GUITAR
JOYSTICK_TYPE_DRUM_KIT = C.SDL_JOYSTICK_TYPE_DRUM_KIT
JOYSTICK_TYPE_ARCADE_PAD = C.SDL_JOYSTICK_TYPE_ARCADE_PAD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_FLIGHT_STICK = C.SDL_JOYSTICK_TYPE_FLIGHT_STICK
JOYSTICK_TYPE_DANCE_PAD = C.SDL_JOYSTICK_TYPE_DANCE_PAD
JOYSTICK_TYPE_GUITAR = C.SDL_JOYSTICK_TYPE_GUITAR
JOYSTICK_TYPE_DRUM_KIT = C.SDL_JOYSTICK_TYPE_DRUM_KIT

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_ARCADE_STICK = C.SDL_JOYSTICK_TYPE_ARCADE_STICK
JOYSTICK_TYPE_FLIGHT_STICK = C.SDL_JOYSTICK_TYPE_FLIGHT_STICK
JOYSTICK_TYPE_DANCE_PAD = C.SDL_JOYSTICK_TYPE_DANCE_PAD
JOYSTICK_TYPE_GUITAR = C.SDL_JOYSTICK_TYPE_GUITAR

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_WHEEL = C.SDL_JOYSTICK_TYPE_WHEEL
JOYSTICK_TYPE_ARCADE_STICK = C.SDL_JOYSTICK_TYPE_ARCADE_STICK
JOYSTICK_TYPE_FLIGHT_STICK = C.SDL_JOYSTICK_TYPE_FLIGHT_STICK
JOYSTICK_TYPE_DANCE_PAD = C.SDL_JOYSTICK_TYPE_DANCE_PAD

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_GAMECONTROLLER = C.SDL_JOYSTICK_TYPE_GAMECONTROLLER
JOYSTICK_TYPE_WHEEL = C.SDL_JOYSTICK_TYPE_WHEEL
JOYSTICK_TYPE_ARCADE_STICK = C.SDL_JOYSTICK_TYPE_ARCADE_STICK
JOYSTICK_TYPE_FLIGHT_STICK = C.SDL_JOYSTICK_TYPE_FLIGHT_STICK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_TYPE_UNKNOWN = C.SDL_JOYSTICK_TYPE_UNKNOWN
JOYSTICK_TYPE_GAMECONTROLLER = C.SDL_JOYSTICK_TYPE_GAMECONTROLLER
JOYSTICK_TYPE_WHEEL = C.SDL_JOYSTICK_TYPE_WHEEL
JOYSTICK_TYPE_ARCADE_STICK = C.SDL_JOYSTICK_TYPE_ARCADE_STICK

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

const (
JOYSTICK_TYPE_UNKNOWN = C.SDL_JOYSTICK_TYPE_UNKNOWN
JOYSTICK_TYPE_GAMECONTROLLER = C.SDL_JOYSTICK_TYPE_GAMECONTROLLER
JOYSTICK_TYPE_WHEEL = C.SDL_JOYSTICK_TYPE_WHEEL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// Types of a joystick.
const (
JOYSTICK_TYPE_UNKNOWN = C.SDL_JOYSTICK_TYPE_UNKNOWN
JOYSTICK_TYPE_GAMECONTROLLER = C.SDL_JOYSTICK_TYPE_GAMECONTROLLER

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

@@ -18,6 +113,20 @@ const (
HAT_LEFTDOWN = C.SDL_HAT_LEFTDOWN
)

// Types of a joystick.
const (
JOYSTICK_TYPE_UNKNOWN = C.SDL_JOYSTICK_TYPE_UNKNOWN

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

@veeableful
Copy link
Contributor

@malashin, you can also take a look at my li/sdl2.0.6 branch and see if you can take parts of it into your branch. I was thinking of eventually splitting them to separate commits and merge them to master. But since you're also implementing SDL 2.0.6, perhaps it can save your time.

@malashin
Copy link
Collaborator Author

malashin commented Feb 7, 2018

@veeableful, I renamed all getter methods from Joystick.GetVendor() to Joystick.Vendor(), But not sure about the other functions.

Should GameControllerGetAxisFromString() be GameControllerAxisFromString()?
What about GetCurrentVideoDriver()?

According to https://golang.org/doc/effective_go.html#Getters, they all should be renamed. We lose similarity to original C function names, but it is kinda lost already in many other places.

@veeableful
Copy link
Contributor

@malashin Yeah definitely. You can rename them. I can't claim to know what's best for Go developers so go ahead!

JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL
JOYSTICK_POWER_WIRED = C.SDL_JOYSTICK_POWER_WIRED
JOYSTICK_POWER_MAX = C.SDL_JOYSTICK_POWER_MAX

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL
JOYSTICK_POWER_WIRED = C.SDL_JOYSTICK_POWER_WIRED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// (https://wiki.libsdl.org/SDL_JoystickPowerLevel)
const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// An enumeration of battery levels of a joystick.
// (https://wiki.libsdl.org/SDL_JoystickPowerLevel)
const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL
JOYSTICK_POWER_WIRED = C.SDL_JOYSTICK_POWER_WIRED
JOYSTICK_POWER_MAX = C.SDL_JOYSTICK_POWER_MAX

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL
JOYSTICK_POWER_WIRED = C.SDL_JOYSTICK_POWER_WIRED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM
JOYSTICK_POWER_FULL = C.SDL_JOYSTICK_POWER_FULL

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW
JOYSTICK_POWER_MEDIUM = C.SDL_JOYSTICK_POWER_MEDIUM

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY
JOYSTICK_POWER_LOW = C.SDL_JOYSTICK_POWER_LOW

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// (https://wiki.libsdl.org/SDL_JoystickPowerLevel)
const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN
JOYSTICK_POWER_EMPTY = C.SDL_JOYSTICK_POWER_EMPTY

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

// An enumeration of battery levels of a joystick.
// (https://wiki.libsdl.org/SDL_JoystickPowerLevel)
const (
JOYSTICK_POWER_UNKNOWN = C.SDL_JOYSTICK_POWER_UNKNOWN

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use ALL_CAPS in Go names; use CamelCase

@malashin malashin changed the title sdl: gamecontroller, joystick: Add new bindings for SDL 2.0.6 sdl: gamecontroller, joystick: Add new bindings for SDL 2.0.6 and 2.0.4 Feb 8, 2018
@malashin malashin merged commit 930022a into veandco:master Feb 10, 2018
neputevshina pushed a commit to neputevshina/go-sdl2 that referenced this pull request Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants