Ejemplo n.º 1
0
#!/usr/bin/env python3

import window
import ctypes

window.init()

win = window.new("weird client", 640, 480)

monster = window.loadImage("client/data/sprites/monster1/monster1-1.bmp")

monster.scale(10, 10)

while not window.closed:
  win.drawImage(monster, 100, 100)
  win.update()
  window.handleNextEvent()

Ejemplo n.º 2
0
config.conf['usb_reset_hack'] = args.usbhack
config.load(args.config)
# NOTE: web has to be inported before Tkinter is initialized
# otherwise the window will fail open on Windows.
# The config has to be loaded/finalized before importing we
# otherwise some initialization will use the wrong values.
import web

try:
    import Tkinter
except ImportError:
    args.cli = True

if not args.cli:
    import window
    root = window.init()

print "DriveboardApp v" + config.conf['version']

# start server in thread
web.start(browser=(not args.nobrowser), debug=args.debug)

# main thread loop
while 1:
    try:
        if not args.cli:
            try:
                root.update()
            except Tkinter.TclError:
                break
        time.sleep(0.1)
Ejemplo n.º 3
0
def main():
    init()
    window.init(lp, launchpad, PATH, PROG_PATH, USER_PATH, VERSION, PLATFORM)
    if EXIT_ON_WINDOW_CLOSE:
        shutdown()
Ejemplo n.º 4
0
import window
import pinect

#dev is the handle we'll use with the pinect functions. None on error
dev=pinect.new()

if not dev:
        print("no device found")
        quit()

#init returns a cffi array of chars representing the window pixels
pixels=window.init("Click for depth measurement",320,240)
if not pixels:
        print("can't create window")
        quit()
c=0
while True:
        frame=pinect.capture(dev)
        c = c+1;
        for i in xrange(0,320*240):
                
                # We'll convert depth to a more pleasant form
                # A lookup table is an obvious optimisation
                d=frame[i]
                if d > 8191:
                        pixels[i]=(255 << 24)
                else:
                        v=0
                        if d < 2048: v = v | ((255-d/8)<<16)
                        if d < 4096: v = v | ((255-d/16) << 8)
                        if d > 2048: v = v | ((d-2048)/24)
Ejemplo n.º 5
0
def main():
    init()
    window.init(lp, launchpad)
    if EXIT_ON_WINDOW_CLOSE:
        shutdown()
Ejemplo n.º 6
0
def main():
    options = init()
    window.init(lp, launchpad, options)
    if not "debug" in options:
        shutdown()
Ejemplo n.º 7
0
def main():
    init()
    window.init(lp)
    if EXIT_ON_WINDOW_CLOSE:
        shutdown()
Ejemplo n.º 8
0
		if debug:
			print("window is moving")
			print(cursor.left)
			# print({"current": position.current.left, "old": position.old.left})

		if cursor.left <= int(hitsize):
			mouse.release()
			snap.left()

		if cursor.left >= int(screen.width) - int(hitsize):
			mouse.release()
			snap.right()

		if cursor.top <= int(23) + int(hitsize):
			mouse.release()
			snap.top()

		if cursor.top >= int(screen.height) - int(hitsize):
			mouse.release()
			snap.bottom()

	# Save old position of top app window
	position.old = position.current

# Grab Desktop and Initial Top Window Bounds
screen = desktop.position()
position = window.init()

# Start Main Loop
main()
Ejemplo n.º 9
0
    global shutdown, paused
    for event in pygame.event.get():  #runs when an event occurs
        if event.type == QUIT:  #quit called
            shutdown = True  #end loop
        elif event.type == MOUSEBUTTONDOWN:  #mouse clicked
            changeLifeOnClick()
        elif event.type == KEYDOWN:  #key has been pressed
            if pygame.key.get_pressed()[pygame.K_SPACE]:
                paused = not paused
            elif pygame.key.get_pressed()[pygame.K_ESCAPE]:
                shutdown = True


if __name__ == "__main__":
    pygame.init()
    window.init()
    clock = pygame.time.Clock()

    #main game loop
    while (not shutdown):
        # init the boards
        res = window.getResolution()
        boardw = int(res[0] / GRIDSIZE)
        boardh = int(res[1] / GRIDSIZE)
        Board = [[0 for x in range(boardh)] for y in range(boardw)]
        Board2 = [[0 for x in range(boardh)] for y in range(boardw)]
        # draw the board for the first time
        draw()

        updated = True
        waitCount = 0
Ejemplo n.º 10
0
argparser.add_argument('-n', '--nobrowser', dest='nobrowser', action='store_true',
                       default=False, help='do not launch interface in browser')
argparser.add_argument('-c', '--cli', dest='cli', action='store_true',
                       default=False, help='run without server GUI window')
argparser.add_argument('-u', '--usbhack', dest='usbhack', action='store_true',
                       default=False, help='use usb reset hack (advanced)')
args = argparser.parse_args()

try:
    import Tkinter
except ImportError:
    args.cli = True

if not args.cli:
    import window
    root = window.init()

print "DriveboardApp v" + conf['version']
conf['usb_reset_hack'] = args.usbhack

# start server in thread
web.start(browser=(not args.nobrowser), debug=args.debug)

# main thread loop
while 1:
    try:
        if not args.cli:
            try:
                root.update()
            except Tkinter.TclError:
                break