File: pysycredits.py

package info (click to toggle)
pysycache 3.1-3
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 50,004 kB
  • ctags: 472
  • sloc: python: 5,146; lisp: 1,152; sh: 102; makefile: 51; ansic: 4
file content (179 lines) | stat: -rw-r--r-- 5,579 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!/usr/bin/env python

# -*- coding: utf8 -*- 

#***********************************************************************
# pysycache : a program for learn to use the mouse
# Copyright (C) 2005-2007 Vincent DEROO (vincent.pysycache@free.fr) 
# 
# This program is free software; you can redistribute it and/or 
# modify it under the terms of the GNU General Public License 
# as published by the Free Software Foundation; either version 2 
# of the License, or (at your option) any later version. 
# 
# This program is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. 
# 
# You should have received a copy of the GNU General Public License 
# along with this program; if not, write to the Free Software 
# Foundation, Inc. : 
# 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA
#***********************************************************************



#*******************************************************************************
# Importation des modules
#*******************************************************************************
import sys
import getopt, string
import random
import time
import locale


import random
import os.path
import pygame
from pygame.locals import *
#from pysyclasses import *


import datas
from pysyclasses import *
import const
import pysyihm

#from pysyclasses import MouseOfActivity
#from pysyclasses import BestScores
#from pysyclasses import BtnOfMenu




#*******************************************************************************
# Event detection                                                              #
#*******************************************************************************
def DetectEvent():
	""" Traitement des evenements """
	for event in pygame.event.get():
		if event.type == QUIT:
			return 0
		elif event.type == KEYUP:
			if event.key == K_ESCAPE:
				return 0
		elif event.type == pygame.MOUSEMOTION:
			#*************** evenement deplacement de la souris ***************
			event0 = event.pos[0] 
			event1 = event.pos[1] 
			screen = pygame.display.get_surface()

			#redessin de la souris a sa position actuelle
			const.GMaSourisCurrentPositionX = event0 
			const.GMaSourisCurrentPositionY = event1 
			for o in const.GLstSouris.sprites():
				o.move(const.Gbackground_image)

			const.GLstSouris.draw(screen)

			pygame.display.update()

			return 1
		elif event.type == MOUSEBUTTONUP:
			#---------------------- on relache la souris -----------------------
			ok = 0
			event0 = event.pos[0] 
			event1 = event.pos[1] 

			screen = pygame.display.get_surface()  

			#------------------------ boutons de menus -------------------------
			for btn in TabBtnScores :
				if ( event0 >= btn.left ) & ( event0 <= btn.left + btn.largeur ) & ( event1 >= btn.top  ) & ( event1 <= btn.top + btn.hauteur ) :
					if ( btn.id == 4) :
						#Quitter
						return 0

					break

			#rafraichissement
			const.GLstSouris.draw(screen)
			pygame.display.update()


	return 1





#*******************************************************************************
# Main of the program                                                          #
# parameters    typfull = 0 : in window                                        #
#                       = 1 : fullscreen                                       #
#*******************************************************************************
def ShowWindow(withname, numgame, durationgame, tabscore):
	global TabBtnScores 			#tableau des boutons de l'application
	TabBtnScores = []
	TabBtnScores[:]= []
	global Background_Restore


	screen = pygame.display.get_surface()

	datas.ShowTransitionOfTheme(const.GDureeTransition, "fond-credits.png", 1)

	#----------------------- transition vers le menu ---------------------------
	const.Gbackground_image, background_rect = datas.Load_image("images", "fond-credits.png")
	Background_Restore, background_rect = datas.Load_image("images", "fond-credits.png")

	#------------------ affichage des credits ------------------------
	datas.ShowCreditsOfPySyCache(0)


	datas.ShowTransitionOfTheme(const.GDureeTransition, "fond-credits.png", 1)

#	#----------------------- transition vers le menu -----------------------
#	screen.blit(const.Gbackground_image, (0, 0))
##	const.Gbackground_image, background_rect = datas.Load_image("images", "fond-scores.png")
#
#	#----------------------------- liste des boutons ---------------------------
#	const.GBtnMenu = 999
#	TabBtnScores[:]=[]
#	TabBtnScores.append(BtnOfMenu("fond-scores.png", 4, 'btn-quitter-gd.png', 'btn-quitter.png', 710 - 20, 545) )	#quitter
#
#	for btn in TabBtnScores:
#		if (btn.visible == 1) : 
#			btn.LoadNormalPicture(Background_Restore)
#		else:
#			btn.ClearBackground(Background_Restore)
#
#	screen.blit(const.Gbackground_image, (0, 0))
#
#
#	#------------------- changer la souris en main -------------------------
#	const.GLstSouris.empty()
#	const.GLstSouris.add(MouseOfActivity(400, 300, "souris.png") )
#	for o in const.GLstSouris.sprites():
#		o.move(const.Gbackground_image)
#	const.GLstSouris.draw(screen)
#	pygame.display.update()
#	pygame.event.clear()
#
#	const.GTypeSouris = const.EVENT_JEU0





#	#---------------------- entree dans la boucle principale -------------------
#	running = 1
#	while running:
#		datas.Temporisation()
#
#		#----------------- recherche des evt -----------------------------------
#		running = DetectEvent()
#
#		datas.ShowFPS()