Example #1
0
def main():
	global cube, angle
	angle = 0
	cube = render.create_geometry(geometry.create_cone(subdiv_x=4))
	musique()
	intro()
	gourou, gourou_index_list = selection()
	index_gourou = generation(gourou, gourou_index_list)
	audio.get_mixer().Stop(sound)
	if 'Sylvain Durif' in lesGourou [index_gourou]:
		final()
	else:
		ouvre_page_gourou(index_gourou)
Example #2
0
def final():
	render.clear()

	# initialize graphic and audio systems

	movie = gs.WebMMovie()
	movie.Open("@data/sylvain_durif.webm")

	video_format = movie.GetVideoData().GetFormat()

	# create the frame textures and frame object
	gpu = render.get_renderer()
	y_tex = gpu.NewTexture()
	gpu.CreateTexture(y_tex, video_format.width, video_format.height, gs.GpuTexture.R8, gs.GpuTexture.NoAA,
					  gs.GpuTexture.UsageDefault, False)
	u_tex = gpu.NewTexture()
	gpu.CreateTexture(u_tex, video_format.width // 2, video_format.height // 2, gs.GpuTexture.R8,
						  gs.GpuTexture.NoAA, gs.GpuTexture.UsageDefault, False)
	v_tex = gpu.NewTexture()
	gpu.CreateTexture(v_tex, video_format.width // 2, video_format.height // 2, gs.GpuTexture.R8,
						  gs.GpuTexture.NoAA, gs.GpuTexture.UsageDefault, False)

	frame = gs.VideoFrame()
	video_format.ClearFrame(frame)
	video_timestamp = gs.time(0)  # assume first frame time stamp is 0

	# load the YV12 to RGB shader and setup drawing states
	shader = gpu.LoadShader("@data/yv12.isl")

	gpu.EnableDepthTest(False)  # disable depth testing so that we don't even need to clear the z-buffer

	# start streaming the movie audio data
	channel = audio.get_mixer().StreamData(movie.GetAudioData())

	# play until movie ends
	while not movie.IsEOF():
		render.clear()
		# fit the while output window
		screen_size = gpu.GetCurrentOutputWindow().GetSize()
		gpu.SetViewport(gs.fRect(0, 0, screen_size.x, screen_size.y))
		gpu.Set2DMatrices()  # update the 2d matrix

		# fetch the next video frame once audio gets past video
		audio_timestamp = audio.get_mixer().GetChannelPosition(channel)  # audio timestamp as reported by the mixer

		if audio_timestamp >= video_timestamp:
			movie.GetVideoData().GetFrame(frame)
			video_timestamp = frame.GetTimestamp()
			gpu.BlitTexture(y_tex, frame.GetPlaneData(gs.VideoFrame.Y), video_format.width, video_format.height)
			gpu.BlitTexture(u_tex, frame.GetPlaneData(gs.VideoFrame.U), video_format.width // 2,
							video_format.height // 2)
			gpu.BlitTexture(v_tex, frame.GetPlaneData(gs.VideoFrame.V), video_format.width // 2,
							video_format.height // 2)

			# draw the current video frame to screen
			vtxs = [gs.Vector3(0, 0, 0.5), gs.Vector3(0, screen_size.y, 0.5),
					gs.Vector3(screen_size.x, screen_size.y, 0.5), gs.Vector3(0, 0, 0.5),
					gs.Vector3(screen_size.x, screen_size.y, 0.5), gs.Vector3(screen_size.x, 0, 0.5)]
			uvs = [gs.Vector2(0, 1), gs.Vector2(0, 0), gs.Vector2(1, 0), gs.Vector2(0, 1), gs.Vector2(1, 0),
				   gs.Vector2(1, 1)]
		render_system = render.get_render_system()
		gpu.SetShader(shader)
		gs.SetShaderEngineValues(render_system)
		gpu.SetShaderTexture("y_tex", y_tex)
		gpu.SetShaderTexture("u_tex", u_tex)
		gpu.SetShaderTexture("v_tex", v_tex)
		render_system.DrawTriangleUV(2, vtxs, uvs)
		render.flip()
Example #3
0
def joue_sfx_phase():
	audio.get_mixer().Stream("@data/Input_Guru_01.wav")
Example #4
0
def joue_sfx_selection():
	audio.get_mixer().Stream("@data/Input_Guru_01.wav")
Example #5
0
def musique():
	global sound
	audio.init()
	sound = audio.get_mixer().Stream("@data/Guru_02.wav")
def exit():
	audio.get_mixer().Stop(title_music)
	scene.Clear(scn)
def setup():
	global scn, title_music
	scn = scene.new_scene()
	scn.Load('@assets/3d/level_title.scn', gs.SceneLoadContext(render.get_render_system()))
	title_music = audio.get_mixer().Stream("@assets/sfx/sfx_cellos_loop.ogg")