Skip to content

Commit

Permalink
test 3
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAndreiM committed Jan 2, 2025
1 parent 14d031f commit 5b63076
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion player/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func getTextDimensions(font *ttf.Font, text string) (int32, int32) {
}

func main() {
if err := sdl.Init(sdl.INIT_EVERYTHING); err != nil {
if err := sdl.Init(sdl.INIT_VIDEO | sdl.INIT_GAMECONTROLLER | sdl.INIT_HAPTIC | sdl.INIT_JOYSTICK | sdl.INIT_AUDIO); err != nil {
fmt.Println("Error initializing SDL:", err)
os.Exit(1)
}
Expand Down Expand Up @@ -320,6 +320,17 @@ func main() {
}
defer renderer.Destroy()

mapping1 := "030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,platform:Linux,"
mapping2 := "0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),platform:Linux,a:b0,b:b1,x:b2,y:b3,start:b7,back:b6,guide:b8,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,lefttrigger:a5,righttrigger:a4,leftstick:b9,rightstick:b10,leftx:a0,lefty:a1,rightx:a2,righty:a3,"

if sdl.GameControllerAddMapping(mapping1) == -1 {
fmt.Println("Failed to add controller mapping: %s\n", sdl.GetError())
}

if sdl.GameControllerAddMapping(mapping2) == -1 {
fmt.Println("Failed to add controller mapping: %s\n", sdl.GetError())
}

if sdl.NumJoysticks() > 0 {
if controller := sdl.GameControllerOpen(0); controller != nil {
defer controller.Close()
Expand Down
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ pre {

.text-content {
flex-grow: 1;
font-weight: 900;
}

.remove-button {
Expand Down

0 comments on commit 5b63076

Please sign in to comment.