def main():

	pygame.init()
	globals.pygame = pygame # assign global pygame for other modules to reference
	globals.inputs = Inputs(pygame) # assign global inputs for other modules to reference
	update_display_mode() # now that the global display properties have been set up, update the display
	clock = pygame.time.Clock() # clock to tick / manage delta

	entities = [] # contains every object that will be drawn in the game

	entities.append(Entity()) # our testing entity will be the default entity

	loop = True # for controlling the game loop

	while(loop):
		clock.tick(60) # tick the clock with a target 60 fps
		globals.window.fill((255, 255, 255))

		globals.inputs.update() # refresh inputs

		update(entities) # update all entities
		render(entities) # draw all entities

		if(globals.inputs.isKeyDown("space")): toggle_fullscreen() # space bar toggles fullscreen
		if(globals.inputs.isKeyDown("escape")): loop = False # escape key exits game
		if(globals.inputs.isQuitPressed()): loop = False # red 'x' button exits game

		pygame.display.flip() # flip the display, which finally shows our render

	pygame.quit() # unload pygame modules
Esempio n. 2
0
def main():

    pygame.init()
    globals.pygame = pygame
    update_display_mode()
    clock = pygame.time.Clock()

    entities = []

    entities.append(Tank(100, 100))

    loop = True

    while(loop):
        clock.tick(60)  # 60 FPS
        globals.window.fill((255, 255, 255))  # Fill window white

        globals.events = pygame.event.get()

        for entitiy in entities:
            entitiy.update()

        for entitiy in entities:
            entitiy.draw()

        if isKeyJustPressed(pygame.K_RETURN):
            toggle_fullscreen()

        if isKeyJustPressed(pygame.K_ESCAPE):
            globals.pygame.quit()
            loop = False

        # Flip the buffer
        pygame.display.flip()
Esempio n. 3
0
def main():

    pygame.init()
    globals.pygame = pygame
    update_display_mode()
    clock = pygame.time.Clock()

    entities = []

    entities.append(Tank(100, 100))

    loop = True

    while (loop):
        clock.tick(60)  # 60 FPS
        globals.window.fill((255, 255, 255))  # Fill window white

        globals.events = pygame.event.get()

        for entitiy in entities:
            entitiy.update()

        for entitiy in entities:
            entitiy.draw()

        if isKeyJustPressed(pygame.K_RETURN):
            toggle_fullscreen()

        if isKeyJustPressed(pygame.K_ESCAPE):
            globals.pygame.quit()
            loop = False

        # Flip the buffer
        pygame.display.flip()
Esempio n. 4
0
def main():

    pygame.init()
    update_display_mode()
    clock = pygame.time.Clock()

    entities = []
    for i in range(1000):
        entities.append(
            Ball(globals.width / 2, globals.height / 2,
                 numpy.random.normal(-10, 10), numpy.random.normal(-10, 10),
                 (random.randint(0, 255), random.randint(
                     0, 255), random.randint(0, 255))))

    running = True

    globals.window.fill((255, 255, 255))

    while (running):

        # Set FPS limit
        clock.tick(globals.fps)

        # Fill window white
        globals.window.fill((255, 255, 255))

        globals.events = pygame.event.get()

        for entitiy in entities:
            entitiy.update()

        for entitiy in entities:
            entitiy.draw()

        if isKeyJustPressed(pygame.K_RETURN):
            toggle_fullscreen()

        if isKeyJustPressed(pygame.K_ESCAPE):
            globals.pygame.quit()
            loop = False

        # Flip the buffer
        pygame.display.flip()
def main():

    pygame.init()
    globals.pygame = pygame  # assign global pygame for other modules to reference
    globals.inputs = Inputs(
        pygame)  # assign global inputs for other modules to reference
    update_display_mode(
    )  # now that the global display properties have been set up, update the display
    clock = pygame.time.Clock()  # clock to tick / manage delta

    entities = []  # contains every object that will be drawn in the game

    entities.append(Entity())  # our testing entity will be the default entity

    loop = True  # for controlling the game loop

    while (loop):
        clock.tick(60)  # tick the clock with a target 60 fps
        globals.window.fill((255, 255, 255))

        globals.inputs.update()  # refresh inputs

        update(entities)  # update all entities
        render(entities)  # draw all entities

        if (globals.inputs.isKeyDown("space")):
            toggle_fullscreen()  # space bar toggles fullscreen
        if (globals.inputs.isKeyDown("escape")):
            loop = False  # escape key exits game
        if (globals.inputs.isQuitPressed()):
            loop = False  # red 'x' button exits game

        pygame.display.flip(
        )  # flip the display, which finally shows our render

    pygame.quit()  # unload pygame modules