Skip to content

Instantly share code, notes, and snippets.

View VeggieVampire's full-sized avatar

Nick Farrow VeggieVampire

  • n-i-c-k.com
  • The edge of space
View GitHub Profile
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
@VeggieVampire
VeggieVampire / game.py
Last active June 13, 2018 07:33
just something I have been playing with in python3. Note add your own images and only setup for a gamepad. Also I only tested on a Pi3 (non windows)
import pygame,sys,glob
pygame.init()
#from pygame import *
try:
j = pygame.joystick.Joystick(0) # create a joystick instance
j.init() # init instance
print ("Enabled joystick: {0} with {1} buttons".format( j.get_name(),j.get_numbuttons()))
@VeggieVampire
VeggieVampire / joy.py
Created May 28, 2018 10:48
D-pad example with python3.5 using pygame
import pygame
import sys
pygame.init() # Loads pygame engine
pygame.joystick.init() # main joystick device system
try:
j = pygame.joystick.Joystick(0) # create a joystick instance
j.init() # init instance
print ("Enabled joystick: {0}".format(j.get_name()))