本文整理汇总了Python中core.Core.setQuit方法的典型用法代码示例。如果您正苦于以下问题:Python Core.setQuit方法的具体用法?Python Core.setQuit怎么用?Python Core.setQuit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.Core
的用法示例。
在下文中一共展示了Core.setQuit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from core import Core [as 别名]
# 或者: from core.Core import setQuit [as 别名]
class Engine:
#-------------------------------------------------------------------------------------------------------
def __init__( self ):
self.core = Core( 60, 1024, 768, "Ninja" )
self.intro = Intro()
self.menu_background = Texture( "menu/background.png" )
self.menu_title = Menu_title()
self.menu_play_button = Menu_play_button()
self.menu_git_button = Menu_link_button( "menu/git.png", "https://github.com/Adriqun" )
self.menu_google_button = Menu_link_button( "menu/google.png", "https://en.wikipedia.org/wiki/Ninja" )
self.menu_facebook_button = Menu_link_button( "menu/facebook.png", "nothing", True )
self.menu_twitter_button = Menu_link_button( "menu/twitter.png", "nothing", True )
self.menu_music_button = Menu_music_button( "menu/music.png" )
self.menu_chunk_button = Menu_music_button( "menu/chunk.png", 1 )
self.menu_exit_log = Menu_exit_log()
self.menu_author_log = Menu_author_log()
self.menu_game_log = Menu_link_button( "menu/game.png", "nothing", True )
self.menu_settings_log = Menu_link_button( "menu/settings.png", "nothing", True )
self.menu_score_log = Menu_score_log()
self.menu_music = Menu_music( "menu/Rayman Legends OST - Moving Ground.mp3" )
self.wall = Wall()
self.hero = Hero()
self.menu_log = Menu_log()
self.map = Map()
#-------------------------------------------------------------------------------------------------------
def load( self ):
self.core.setState( -1 )
self.intro.load( self.core.getWidth(), self.core.getHeight() )
self.menu_title.load( self.core.getWidth() )
self.menu_play_button.load( self.core.getWidth(), self.core.getHeight() )
self.menu_git_button.load( self.core.getWidth(), 10 )
self.menu_google_button.load( self.core.getWidth(), self.menu_git_button.getBot() )
self.menu_facebook_button.load( self.core.getWidth(), self.menu_google_button.getBot() )
self.menu_twitter_button.load( self.core.getWidth(), self.menu_facebook_button.getBot() )
self.menu_music_button.load( 10 )
self.menu_chunk_button.load( self.menu_music_button.getBot() )
self.menu_exit_log.load( self.core.getWidth(), self.core.getHeight() )
self.menu_author_log.load( self.menu_play_button.getLeft()+5, self.core.getWidth(), self.menu_title.getBot() +150, self.menu_play_button.getBot() )
self.menu_game_log.load( self.menu_author_log.getRight(), self.menu_play_button.getBot() +10, True )
self.menu_settings_log.load( self.menu_game_log.getRight(), self.menu_play_button.getBot() +10, True )
self.menu_score_log.load( self.menu_settings_log.getRight(), self.core.getWidth(), self.menu_title.getBot() +150, self.menu_play_button.getBot() )
self.wall.load()
self.hero.load( self.core.getWidth(), self.core.getHeight() )
self.menu_log.load( self.core.getWidth(), self.core.getHeight() )
self.map.load()
#-------------------------------------------------------------------------------------------------------
def handle( self ):
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.core.setQuit()
#-------------------------------------------------------------------------------------------------------
if self.core.getState() == 0:
if self.menu_play_button.getState() == 0:
self.menu_exit_log.handle( event )
#HANDLE IF AUTHOR BUTTON == OFF AND SCORE BUTTON == OFF
if self.menu_author_log.getState() == 0 and self.menu_score_log.getState() == 0:
self.menu_play_button.handle( event )
self.menu_git_button.handle( event )
self.menu_google_button.handle( event )
self.menu_music_button.handle( event )
self.menu_chunk_button.handle( event )
if self.menu_score_log.getState() == 0:
self.menu_author_log.handle( event )
if self.menu_author_log.getState() == 0:
self.menu_score_log.handle( event )
#-------------------------------------------------------------------------------------------------------
if self.core.getState() == 1:
self.menu_log.handle( event )
#HANDLE IF MENU_LOG == OFF
if self.menu_log.getState() == 0:
self.hero.handle( event )
#-------------------------------------------------------------------------------------------------------
def states( self ):
#-------------------------------------------------------------------------------------------------------STATE -1
if self.core.getState() == -1:
#.........这里部分代码省略.........