Esempio n. 1
0
def init_all( ):
#{
	build_shanghai.init( )
	table_fill_shanghai.init( )
	lines_sum_shanghai.init( )
	utility.init( )
	game_shanghai.init( )
Esempio n. 2
0
def init():
    """
        Initialize pygame, utility, and the game (slot machine). The game is installed by grabbing
        config values from the configuration file. All buttons images are loaded into the Resource class
        and the event handler functions are set.
    """
    pygame.init()    
    utility.init()    

    # Load Settings via Configuration File 
    utility.set_config_file('config/config.cfg')
    
    width = int(utility.get_config_value('width', 640))
    height = int(utility.get_config_value('height', 480))
    depth = int(utility.get_config_value('depth', 0))
    mode = int(utility.get_config_value('mode', 0))
    title = utility.get_config_value('title', '')
    fps = float(utility.get_config_value('fps', 30.0))
    
    screen = pygame.display.set_mode([width, height], mode, depth)
    pygame.display.set_caption(title)

    Resource.normalReel = pygame.image.load('imgs/reel_normal.png')
    Resource.blurReel = pygame.image.load('imgs/reel_blur.png')
    Resource.slotMachine = pygame.image.load('imgs/slot_machine.png')
    
    Resource.redButton = pygame.image.load('imgs/red_button.png')
    Resource.blueButton = pygame.image.load('imgs/blue_button.png')
    Resource.greenButton = pygame.image.load('imgs/green_button.png')
    Resource.purpleButton = pygame.image.load('imgs/purple_button.png')
    Resource.blackButton = pygame.image.load('imgs/black_button.png')
    
    # Initialize the Slot Machine
    slotmachine = SlotMachine(Resource.slotMachine)
    quitButton = Button(630, 50, 60, 60, 'Quit', Resource.redButton)
    quitButton.setOnHoverListener(ExEventHandler.quit_button_hover_listener)
    quitButton.setOnPressListener(ExEventHandler.quit_button_press_listener)
    quitButton.setOnReleaseListener(ExEventHandler.quit_button_release_listener)
    slotmachine.addComponent(quitButton)
    
    resetButton = Button(731, 52, 60, 60, 'Reset', Resource.redButton)
    resetButton.setOnHoverListener(ExEventHandler.reset_button_hover_listener)
    resetButton.setOnPressListener(ExEventHandler.reset_button_press_listener)
    resetButton.setOnReleaseListener(ExEventHandler.reset_button_release_listener)
    slotmachine.addComponent(resetButton)
       
    spinButton = Button(420, 495, 60, 60, 'Spin', Resource.greenButton)
    spinButton.setOnHoverListener(ExEventHandler.spin_button_hover_listener)
    spinButton.setOnPressListener(ExEventHandler.spin_button_press_listener)
    spinButton.setOnReleaseListener(ExEventHandler.spin_button_release_listener)
    slotmachine.addComponent(spinButton)

    betButton = Button(320, 495, 60, 60, 'Bet', Resource.blueButton)
    betButton.setOnHoverListener(ExEventHandler.bet_button_hover_listener)
    betButton.setOnPressListener(ExEventHandler.bet_button_press_listener)
    betButton.setOnReleaseListener(ExEventHandler.bet_button_release_listener)
    slotmachine.addComponent(betButton)
    
    return slotmachine, screen, fps
Esempio n. 3
0
def main():
    video = util.init("VIRB0392.MP4", start_frame=0, default_fps=None)

    while not util.video_end(video):
        frame = util.get_next_frame(
            video)  # shape = (H, W, 3), colorspace = BGR

        roi_list, cont_list = detect.detect_paintings(frame)
        rectified, roi_list, cont_list = rect.rectify_paintings(
            roi_list, cont_list, frame)
        room, retrieved = retr.retrieve_paintings(rectified)
        people_boxes = people.detect_people(frame, roi_list)

        util.show_results(frame, roi_list, cont_list, rectified, retrieved,
                          room, people_boxes)

        if cv2.waitKey(1) > 0:  # exit
            break
        # cv2.waitKey()  # one frame at a time

    util.close_all(video)
 Revision History: 0.1.0
 
    -> Added Missile Counter (Collectable Item)
    -> Added bouncer missile item on screen every now and then
    -> Added missile counter check in update
    -> Added life counter check in update
    
"""

""" Import and Initialize """
import pygame, utility, sys, random, resource
from resource import *


pygame.init()
utility.init()
resource.init()

""" Read configuration file """
utility.set_config_file(CONFIG_DIRECTORY)
    
width = int(utility.get_config_value('width', 800))
height = int(utility.get_config_value('height', 600))
title = utility.get_config_value('title', 'War Thunder by Justin Hellsten')
depth = int(utility.get_config_value('depth', 32))
mode = int(utility.get_config_value('mode', 0))

if not pygame.display.get_init():
    print 'Could not initialize display screen'
    sys.exit()
Esempio n. 5
0
def init():
    """
        Initialize pygame, utility, and the game (slot machine). The game is installed by grabbing
        config values from the configuration file. All buttons images are loaded into the Resource class
        and the event handler functions are set.
    """
    pygame.init()
    utility.init()

    # Load Settings via Configuration File
    utility.set_config_file('config/config.cfg')

    width = int(utility.get_config_value('width', 640))
    height = int(utility.get_config_value('height', 480))
    depth = int(utility.get_config_value('depth', 0))
    mode = int(utility.get_config_value('mode', 0))
    title = utility.get_config_value('title', '')
    fps = float(utility.get_config_value('fps', 30.0))

    screen = pygame.display.set_mode([width, height], mode, depth)
    pygame.display.set_caption(title)

    Resource.normalReel = pygame.image.load('imgs/reel_normal.png')
    Resource.blurReel = pygame.image.load('imgs/reel_blur.png')
    Resource.slotMachine = pygame.image.load('imgs/slot_machine.png')

    Resource.redButton = pygame.image.load('imgs/red_button.png')
    Resource.blueButton = pygame.image.load('imgs/blue_button.png')
    Resource.greenButton = pygame.image.load('imgs/green_button.png')
    Resource.purpleButton = pygame.image.load('imgs/purple_button.png')
    Resource.blackButton = pygame.image.load('imgs/black_button.png')

    # Initialize the Slot Machine
    slotmachine = SlotMachine(Resource.slotMachine)
    quitButton = Button(630, 50, 60, 60, 'Quit', Resource.redButton)
    quitButton.setOnHoverListener(ExEventHandler.quit_button_hover_listener)
    quitButton.setOnPressListener(ExEventHandler.quit_button_press_listener)
    quitButton.setOnReleaseListener(
        ExEventHandler.quit_button_release_listener)
    slotmachine.addComponent(quitButton)

    resetButton = Button(731, 52, 60, 60, 'Reset', Resource.redButton)
    resetButton.setOnHoverListener(ExEventHandler.reset_button_hover_listener)
    resetButton.setOnPressListener(ExEventHandler.reset_button_press_listener)
    resetButton.setOnReleaseListener(
        ExEventHandler.reset_button_release_listener)
    slotmachine.addComponent(resetButton)

    spinButton = Button(420, 495, 60, 60, 'Spin', Resource.greenButton)
    spinButton.setOnHoverListener(ExEventHandler.spin_button_hover_listener)
    spinButton.setOnPressListener(ExEventHandler.spin_button_press_listener)
    spinButton.setOnReleaseListener(
        ExEventHandler.spin_button_release_listener)
    slotmachine.addComponent(spinButton)

    betButton = Button(320, 495, 60, 60, 'Bet', Resource.blueButton)
    betButton.setOnHoverListener(ExEventHandler.bet_button_hover_listener)
    betButton.setOnPressListener(ExEventHandler.bet_button_press_listener)
    betButton.setOnReleaseListener(ExEventHandler.bet_button_release_listener)
    slotmachine.addComponent(betButton)

    return slotmachine, screen, fps
Esempio n. 6
0
# BUGS:
# 1. Holding UP and LEFT prevents shooting
# 2. Holding DOWN and RIGHT prevents shooting (Same as #1)
# 3. Destroying a plane removes its bullets as well.

import pygame
from pygame.locals import *
from warzone import WarZone
import utility

#_______________________________________________________________________________
if __name__ == '__main__':
    pygame.init()
    screen = pygame.display.set_mode((640, 480))
    utility.init()
    warzone = WarZone(screen, level=1, lives=3)
    warzone.new_game()