PageRenderTime 22ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tutorial/vision/opengl/example6.e

http://github.com/tybor/Liberty
Specman e | 73 lines | 54 code | 19 blank | 0 comment | 1 complexity | 1dd649fa90d2d58c3f2b84608b099f04 MD5 | raw file
 1class EXAMPLE6
 2
 3inherit
 4	GRAPHIC
 5
 6insert
 7	ARGUMENTS
 8
 9creation
10	make
11
12feature{ANY}
13
14	world: INTERACTIVE_WORLD
15
16	win: TOPLEVEL_WINDOW
17
18	angle: REAL
19	
20	make is
21		local
22			universal_world_loader: UNIVERSAL_WORLD_LOADER[LOADABLE_GL_OBJECT]
23			universal_object_loader: UNIVERSAL_OBJECT_LOADER[LOADABLE_GL_OBJECT]
24			universal_texture_loader: UNIVERSAL_TEXTURE_LOADER
25
26			xml_world_loader: XML_WORLD_LOADER[LOADABLE_GL_OBJECT]
27			xml_object_loader: XML_OBJECT_LOADER[LOADABLE_GL_OBJECT]
28			bmp_texture_loader: BMP_TEXTURE_LOADER
29		do
30			if argument_count < 1 then
31				io.put_string("[
32					Usage: ./a.out <file name>
33
34					Example: ./a.out world.xml
35					         ./a.out world2.xml
36
37					]")
38			else
39				create win.default_create
40				win.set_title("Example 6")
41				win.set_background_color(white_color)
42				win.map
43
44				create universal_world_loader.make
45				create universal_object_loader.make
46				create universal_texture_loader.make
47			
48				universal_world_loader.add_lookup_directory("data/world")
49				universal_object_loader.add_lookup_directory("data/object")
50				universal_texture_loader.add_lookup_directory("data/texture")
51
52				create xml_world_loader.make
53				create xml_object_loader.make
54				create bmp_texture_loader.make
55			
56				universal_world_loader.add_loader("xml", xml_world_loader)
57				universal_object_loader.add_loader("xml", xml_object_loader)
58				universal_texture_loader.add_loader("bmp", bmp_texture_loader)
59
60				create world.make_interactive(win, agent finish_program)
61				universal_world_loader.load_world(world, argument(1), universal_object_loader, universal_texture_loader)
62
63				win.when_close_requested(agent finish_program)
64
65				vision.start
66			end
67		end
68
69	finish_program is
70		do
71			vision.loop_stack.break
72		end
73end