ruby-ogre 0.0.2-x86-linux → 0.0.3-x86-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +80 -5
- data/Rakefile +26 -19
- data/bindings/ogre/interface/Rakefile +22 -0
- data/bindings/ogre/interface/ogre.i +3 -1
- data/bindings/ogre/interface/ogre_wrap.cpp +99671 -17485
- data/bindings/ogre/interface/ogre_wrap.o +0 -0
- data/bindings/ogrebites/interface/Rakefile +22 -0
- data/bindings/ogrebites/interface/ogrebites.i +1 -1
- data/bindings/ogrebites/interface/ogrebites_wrap.cpp +728 -728
- data/bindings/ogrebites/interface/ogrebites_wrap.h +2 -2
- data/bindings/ogrebites/interface/ogrebites_wrap.o +0 -0
- data/bindings/ois/interface/Rakefile +22 -0
- data/bindings/ois/interface/ois.i +1 -1
- data/bindings/ois/interface/ois_wrap.cpp +553 -553
- data/bindings/ois/interface/ois_wrap.h +2 -2
- data/bindings/ois/interface/ois_wrap.o +0 -0
- data/bindings/procedural/interface/Rakefile +22 -0
- data/bindings/procedural/interface/procedural.i +1 -1
- data/bindings/procedural/interface/procedural_wrap.cpp +1247 -1247
- data/bindings/procedural/interface/procedural_wrap.o +0 -0
- data/lib/{Ogre.so → ogre.so} +0 -0
- data/lib/ogre_config.rb +37 -0
- data/lib/ogrebites.so +0 -0
- data/lib/{OIS.so → ois.so} +0 -0
- data/lib/{Procedural.so → procedural.so} +0 -0
- data/lib/{Version.rb → version.rb} +1 -1
- data/sample/charactor/camera_mover.rb +184 -0
- data/sample/{Charactor → charactor}/plugins.cfg +0 -0
- data/sample/{Charactor → charactor}/resources.cfg +0 -0
- data/sample/{Charactor → charactor}/sinbad +1 -1
- data/sample/charactor/sinbad.rb +246 -0
- data/sample/{Charactor → charactor}/sinbad.win +1 -1
- data/sample/{Charactor/SinbadCharacter.rb → charactor/sinbad_character.rb} +125 -125
- data/sample/charactor/ui_listener.rb +65 -0
- metadata +22 -21
- data/bindings/ogre/interface/Makefile +0 -19
- data/bindings/ogrebites/interface/Makefile +0 -19
- data/bindings/ois/interface/Makefile +0 -19
- data/bindings/procedural/interface/Makefile +0 -19
- data/lib/OgreBites.so +0 -0
- data/lib/OgreConfig.rb +0 -37
- data/sample/Charactor/CameraMover.rb +0 -184
- data/sample/Charactor/Sinbad.rb +0 -246
- data/sample/Charactor/UiListener.rb +0 -65
Binary file
|
data/lib/{Ogre.so → ogre.so}
RENAMED
Binary file
|
data/lib/ogre_config.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
class OgreConfig
|
2
|
+
def self.get_top_dir
|
3
|
+
File.dirname(File.dirname(File.expand_path(__FILE__)))
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.get_ld_library_path
|
7
|
+
"#{get_top_dir()}/deps/lib"
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.get_deps_lib_path
|
11
|
+
"#{get_top_dir()}/deps/lib"
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_deps_inc_path
|
15
|
+
"#{get_top_dir()}/deps/include"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get_inc_flags
|
19
|
+
"-I#{get_top_dir()}/deps/include/OGRE/ " +
|
20
|
+
"-I#{get_top_dir()}/deps/include/OGRE/GLX/ " +
|
21
|
+
"-I#{get_top_dir()}/deps/include/OGRE/Paging/ " +
|
22
|
+
"-I#{get_top_dir()}/deps/include/OGRE/RTShaderSystem/ " +
|
23
|
+
"-I#{get_top_dir()}/deps/include/OGRE/Terrain "
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.get_lib_path
|
27
|
+
File.dirname(File.expand_path(__FILE__))
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.get_plugin_folder
|
31
|
+
"#{get_top_dir()}/deps/lib/OGRE"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.get_resource_folder
|
35
|
+
"#{get_top_dir()}/deps/share/OGRE/media/"
|
36
|
+
end
|
37
|
+
end
|
data/lib/ogrebites.so
ADDED
Binary file
|
data/lib/{OIS.so → ois.so}
RENAMED
Binary file
|
Binary file
|
@@ -0,0 +1,184 @@
|
|
1
|
+
class CameraMover
|
2
|
+
CS_FREELOOK = 0
|
3
|
+
CS_ORBIT = 1
|
4
|
+
CS_MANUAL = 2
|
5
|
+
CS_TPS = 3
|
6
|
+
|
7
|
+
CAM_HEIGHT = 5.0
|
8
|
+
|
9
|
+
attr_accessor :height
|
10
|
+
attr_accessor :cameraPivot
|
11
|
+
attr_accessor :camera
|
12
|
+
|
13
|
+
def initialize(cam)
|
14
|
+
@camera = cam
|
15
|
+
@camera.set_position(0, 0, 0)
|
16
|
+
@camera.set_near_clip_distance(0.1)
|
17
|
+
|
18
|
+
@style = CS_FREELOOK
|
19
|
+
|
20
|
+
# CS_FREELOOK, CS_ORBIT, CS_MANUAL
|
21
|
+
@sdkCameraMan = Ogrebites::SdkCameraMan.new(@camera)
|
22
|
+
@evtFrame = Ogre::FrameEvent.new
|
23
|
+
|
24
|
+
# CS_TPS
|
25
|
+
@height = CAM_HEIGHT
|
26
|
+
@cameraPivot = cam.get_scene_manager().get_root_scene_node().create_child_scene_node()
|
27
|
+
@cameraGoal = @cameraPivot.create_child_scene_node(Ogre::Vector3.new(0, 0, 5))
|
28
|
+
|
29
|
+
@cameraPivot.set_fixed_yaw_axis(true)
|
30
|
+
@cameraGoal.set_fixed_yaw_axis(true)
|
31
|
+
|
32
|
+
@pivotPitch = 0
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def set_style(style)
|
37
|
+
@style = style
|
38
|
+
case @style
|
39
|
+
when CS_FREELOOK
|
40
|
+
@sdkCameraMan.set_style(Ogrebites::CS_FREELOOK)
|
41
|
+
when CS_ORBIT
|
42
|
+
@sdkCameraMan.set_style(Ogrebites::CS_ORBIT)
|
43
|
+
else # CS_MANUAL, CS_TPS
|
44
|
+
@sdkCameraMan.set_style(Ogrebites::CS_MANUAL)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def set_target(target)
|
49
|
+
@target = target
|
50
|
+
if @style == CS_TPS
|
51
|
+
@camera.set_auto_tracking(false)
|
52
|
+
@camera.move_relative(Ogre::Vector3.new(0, 0, 0))
|
53
|
+
update_camera(1.0)
|
54
|
+
else
|
55
|
+
@sdkCameraMan.set_target(target)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def set_position(pos)
|
60
|
+
@camera.set_position(pos) if @style == CS_FREELOOK
|
61
|
+
end
|
62
|
+
|
63
|
+
def look_at(pos)
|
64
|
+
@camera.look_at(pos) if @style == CS_FREELOOK
|
65
|
+
end
|
66
|
+
|
67
|
+
def set_yaw_pitch_dist(yaw, pitch, dist)
|
68
|
+
@sdkCameraMan.set_yaw_pitch_dist(yaw, pitch, dist) if @style == CS_ORBIT
|
69
|
+
end
|
70
|
+
|
71
|
+
def move_forward(bl)
|
72
|
+
evt = Ois::KeyEvent.new(nil, Ois::KC_W, 0)
|
73
|
+
if bl
|
74
|
+
@sdkCameraMan.inject_key_down(evt)
|
75
|
+
else
|
76
|
+
@sdkCameraMan.inject_key_up(evt)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def move_backward(bl)
|
81
|
+
evt = Ois::KeyEvent.new(nil, Ois::KC_S, 0)
|
82
|
+
if bl
|
83
|
+
@sdkCameraMan.inject_key_down(evt)
|
84
|
+
else
|
85
|
+
@sdkCameraMan.inject_key_up(evt)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def move_left(bl)
|
90
|
+
evt = Ois::KeyEvent.new(nil, Ois::KC_A, 0)
|
91
|
+
if bl
|
92
|
+
@sdkCameraMan.inject_key_down(evt)
|
93
|
+
else
|
94
|
+
@sdkCameraMan.inject_key_up(evt)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def move_right(bl)
|
99
|
+
evt = Ois::KeyEvent.new(nil, Ois::KC_D, 0)
|
100
|
+
if bl
|
101
|
+
@sdkCameraMan.inject_key_down(evt)
|
102
|
+
else
|
103
|
+
@sdkCameraMan.inject_key_up(evt)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def update(delta)
|
109
|
+
if (@style == CS_TPS)
|
110
|
+
update_camera(delta)
|
111
|
+
else
|
112
|
+
@evtFrame.timeSinceLastFrame = delta
|
113
|
+
@sdkCameraMan.frame_rendering_queued(@evtFrame)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
#
|
118
|
+
# This method moves this camera position to the goal position smoothly.
|
119
|
+
# In general, should be called in the frameRenderingQueued handler.
|
120
|
+
#
|
121
|
+
def update_camera(deltaTime)
|
122
|
+
# place the camera pivot roughly at the character's shoulder
|
123
|
+
@cameraPivot.set_position(@target.get_position() + Ogre::Vector3.UNIT_Y * @height)
|
124
|
+
# move the camera smoothly to the goal
|
125
|
+
goalOffset = @cameraGoal._get_derived_position() - @camera.get_position()
|
126
|
+
@camera.move(goalOffset * deltaTime * 9.0)
|
127
|
+
# always look at the pivot
|
128
|
+
@camera.look_at(@cameraPivot._get_derived_position())
|
129
|
+
end
|
130
|
+
|
131
|
+
def mouse_moved(evt)
|
132
|
+
if @style == CS_TPS
|
133
|
+
update_camera_goal(-0.05 * evt.state.X.rel,
|
134
|
+
-0.05 * evt.state.Y.rel,
|
135
|
+
-0.0005 * evt.state.Z.rel)
|
136
|
+
else
|
137
|
+
@sdkCameraMan.inject_mouse_move(evt)
|
138
|
+
end
|
139
|
+
return true
|
140
|
+
end
|
141
|
+
|
142
|
+
#
|
143
|
+
# This method updates the goal position, which this camera should be placed finally.
|
144
|
+
# In general, should be called when the mouse is moved.
|
145
|
+
# *deltaYaw*::_float_, degree value.
|
146
|
+
# *deltaPitch*::_float_, degree value.
|
147
|
+
# *deltaZoom*::_float_, zoom
|
148
|
+
#
|
149
|
+
def update_camera_goal(deltaYaw, deltaPitch, deltaZoom)
|
150
|
+
@cameraPivot.yaw(Ogre::Radian.new(Ogre::Degree.new(deltaYaw)), Ogre::Node::TS_WORLD);
|
151
|
+
@cameraPivot.pitch(Ogre::Radian.new(Ogre::Degree.new(deltaPitch)), Ogre::Node::TS_LOCAL)
|
152
|
+
=begin
|
153
|
+
# bound the pitch
|
154
|
+
if (!(@pivotPitch + deltaPitch > 25 && deltaPitch > 0) &&
|
155
|
+
!(@pivotPitch + deltaPitch < -60 && deltaPitch < 0))
|
156
|
+
|
157
|
+
@cameraPivot.pitch(Ogre::Degree.new(deltaPitch).valueRadians, Ogre::Node::TS_LOCAL)
|
158
|
+
@pivotPitch += deltaPitch;
|
159
|
+
end
|
160
|
+
=end
|
161
|
+
dist = @cameraGoal._get_derived_position().distance(@cameraPivot._get_derived_position())
|
162
|
+
distChange = deltaZoom * dist;
|
163
|
+
|
164
|
+
# puts "dist: #{dist}:#{distChange}"
|
165
|
+
|
166
|
+
# bound the zoom
|
167
|
+
if (!(dist + distChange < 8 && distChange < 0) &&
|
168
|
+
!(dist + distChange > 25 && distChange > 0))
|
169
|
+
|
170
|
+
@cameraGoal.translate(Ogre::Vector3.new(0, 0, distChange), Ogre::Node::TS_LOCAL)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def mouse_pressed(mouseEvent, mouseButtonID)
|
175
|
+
@sdkCameraMan.inject_mouse_down(mouseEvent, mouseButtonID) if @style == CS_ORBIT
|
176
|
+
return true
|
177
|
+
end
|
178
|
+
|
179
|
+
def mouse_released(mouseEvent, mouseButtonID)
|
180
|
+
@sdkCameraMan.inject_mouse_up(mouseEvent, mouseButtonID) if @style == CS_ORBIT
|
181
|
+
return true
|
182
|
+
end
|
183
|
+
|
184
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1,246 @@
|
|
1
|
+
|
2
|
+
$LOAD_PATH.push(File.dirname(File.expand_path(__FILE__)) + "/../../lib")
|
3
|
+
|
4
|
+
require "ogre"
|
5
|
+
require "ois"
|
6
|
+
require "ogrebites"
|
7
|
+
require "ogre_config"
|
8
|
+
require_relative "ui_listener"
|
9
|
+
require_relative "camera_mover"
|
10
|
+
require_relative "sinbad_character"
|
11
|
+
|
12
|
+
class Sinbad < Ogre::FrameListener
|
13
|
+
def initialize()
|
14
|
+
super # initialize Ogre::FrameListener.
|
15
|
+
@root = nil
|
16
|
+
@window = nil
|
17
|
+
@camera = nil
|
18
|
+
@sceneMgr = nil
|
19
|
+
@inputManager = nil
|
20
|
+
@mouse = nil
|
21
|
+
@keyboard = nil
|
22
|
+
@trayMgr = nil
|
23
|
+
|
24
|
+
@quit = false
|
25
|
+
|
26
|
+
@Info = {}
|
27
|
+
@Info["Help"] =
|
28
|
+
"Use the WASD keys to move Sinbad, and the space bar to jump. \n" +
|
29
|
+
" Use mouse to look around and mouse wheel to zoom.\n" +
|
30
|
+
" Press Q to take out or put back Sinbad's swords. With the swords equipped, " +
|
31
|
+
"you can left click to slice vertically or right click to slice horizontally.\n" +
|
32
|
+
" When the swords are not equipped, press E to start/stop a silly dance routine."
|
33
|
+
|
34
|
+
$filePath = File.dirname(File.expand_path(__FILE__))
|
35
|
+
end
|
36
|
+
|
37
|
+
def run
|
38
|
+
init_root()
|
39
|
+
init_resources()
|
40
|
+
init_managers()
|
41
|
+
init_listeners()
|
42
|
+
init_camera()
|
43
|
+
|
44
|
+
# load "General" group resources into ResourceGroupManager.
|
45
|
+
@trayMgr.show_loading_bar(1, 0)
|
46
|
+
Ogre::ResourceGroupManager::get_singleton().initialise_resource_group("General")
|
47
|
+
@trayMgr.hide_loading_bar()
|
48
|
+
Ogre::TextureManager::get_singleton().set_default_num_mipmaps(5)
|
49
|
+
|
50
|
+
@trayMgr.show_frame_stats(Ogrebites::TL_BOTTOMLEFT)
|
51
|
+
@trayMgr.show_logo(Ogrebites::TL_BOTTOMRIGHT)
|
52
|
+
@trayMgr.hide_cursor()
|
53
|
+
|
54
|
+
setup_content()
|
55
|
+
|
56
|
+
@root.start_rendering()
|
57
|
+
end
|
58
|
+
|
59
|
+
def init_root()
|
60
|
+
@root = Ogre::Root.new("")
|
61
|
+
load_plugins()
|
62
|
+
|
63
|
+
return false unless @root.show_config_dialog()
|
64
|
+
@window = @root.initialise(true, "Sinbad")
|
65
|
+
@root.add_frame_listener(self)
|
66
|
+
end
|
67
|
+
|
68
|
+
def load_plugins()
|
69
|
+
cfg = Ogre::ConfigFile.new
|
70
|
+
cfg.load("#{$filePath}/plugins.cfg")
|
71
|
+
|
72
|
+
pluginDir = cfg.get_setting("PluginFolder")
|
73
|
+
pluginDir += "/" if (pluginDir.length > 0) && (pluginDir[-1] != '/')
|
74
|
+
|
75
|
+
cfg.each_settings {|secName, keyName, valueName|
|
76
|
+
fullPath = pluginDir + valueName
|
77
|
+
fullPath.sub!("<SystemPluginFolder>", OgreConfig::get_plugin_folder)
|
78
|
+
@root.load_plugin(fullPath) if (keyName == "Plugin")
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def init_resources()
|
83
|
+
# Load resource paths from config file
|
84
|
+
cfg = Ogre::ConfigFile.new
|
85
|
+
cfg.load("#{$filePath}/resources.cfg")
|
86
|
+
|
87
|
+
resourceDir = cfg.get_setting("ResourceFolder")
|
88
|
+
resourceDir += "/" if (resourceDir.length > 0) && (resourceDir[-1] != '/')
|
89
|
+
|
90
|
+
cfg.each_settings {|secName, keyName, valueName|
|
91
|
+
next if (keyName == "ResourceFolder")
|
92
|
+
|
93
|
+
fullPath = resourceDir + valueName
|
94
|
+
fullPath.sub!("<SystemResourceFolder>", OgreConfig::get_resource_folder)
|
95
|
+
Ogre::ResourceGroupManager::get_singleton().add_resource_location(fullPath,
|
96
|
+
keyName,
|
97
|
+
secName)
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
def init_managers()
|
102
|
+
# initialize InputManager
|
103
|
+
windowHnd = Ogre::Intp.new
|
104
|
+
@window.get_custom_attribute("WINDOW", windowHnd)
|
105
|
+
windowHndStr = sprintf("%d", windowHnd.value())
|
106
|
+
pl = Ois::ParamList.new
|
107
|
+
pl["WINDOW"] = windowHndStr
|
108
|
+
@inputManager = Ois::InputManager::create_input_system(pl)
|
109
|
+
@keyboard = @inputManager.create_input_object(Ois::OISKeyboard, true).to_keyboard()
|
110
|
+
@mouse = @inputManager.create_input_object(Ois::OISMouse, true).to_mouse()
|
111
|
+
|
112
|
+
# initialize trayManager
|
113
|
+
Ogre::ResourceGroupManager::get_singleton().initialise_resource_group("Essential")
|
114
|
+
@trayMgr = Ogrebites::SdkTrayManager.new("Base", @window, @mouse);
|
115
|
+
ms = @mouse.get_mouse_state()
|
116
|
+
ms.width = @window.get_width()
|
117
|
+
ms.height = @window.get_height()
|
118
|
+
|
119
|
+
# initialize sceneMgr
|
120
|
+
@sceneMgr = @root.create_scene_manager(Ogre::ST_GENERIC)
|
121
|
+
@sceneMgr.set_shadow_technique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE)
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
def init_listeners()
|
126
|
+
@keyListener = KeyListener.new(self)
|
127
|
+
@keyboard.set_event_callback(@keyListener)
|
128
|
+
|
129
|
+
@mouseListener = MouseListener.new(self)
|
130
|
+
@mouse.set_event_callback(@mouseListener)
|
131
|
+
|
132
|
+
@trayListener = TrayListener.new(self)
|
133
|
+
@trayMgr.set_listener(@trayListener)
|
134
|
+
end
|
135
|
+
|
136
|
+
def init_camera()
|
137
|
+
# initialize camera
|
138
|
+
@camera = @sceneMgr.create_camera("FixCamera")
|
139
|
+
|
140
|
+
# Create one viewport, entire window
|
141
|
+
@vp = @window.add_viewport(@camera);
|
142
|
+
@vp.set_background_colour(Ogre::ColourValue.new(0, 0, 0))
|
143
|
+
# Alter the camera aspect ratio to match the viewport
|
144
|
+
@camera.set_aspect_ratio(Float(@vp.get_actual_width()) / Float(@vp.get_actual_height()))
|
145
|
+
end
|
146
|
+
|
147
|
+
def setup_content()
|
148
|
+
# set background and some fog
|
149
|
+
@vp.set_background_colour(Ogre::ColourValue.new(1.0, 1.0, 0.8))
|
150
|
+
@sceneMgr.set_fog(Ogre::FOG_LINEAR, Ogre::ColourValue.new(1.0, 1.0, 0.8), 0, 15, 100)
|
151
|
+
|
152
|
+
# set shadow properties
|
153
|
+
@sceneMgr.set_shadow_technique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE)
|
154
|
+
@sceneMgr.set_shadow_colour(Ogre::ColourValue.new(0.5, 0.5, 0.5))
|
155
|
+
@sceneMgr.set_shadow_texture_size(1024)
|
156
|
+
@sceneMgr.set_shadow_texture_count(1)
|
157
|
+
|
158
|
+
# use a small amount of ambient lighting
|
159
|
+
@sceneMgr.set_ambient_light(Ogre::ColourValue.new(0.3, 0.3, 0.3))
|
160
|
+
|
161
|
+
# add a bright light above the scene
|
162
|
+
@light = @sceneMgr.create_light()
|
163
|
+
@light.set_type(Ogre::Light::LT_POINT)
|
164
|
+
@light.set_position(-10, 40, 20)
|
165
|
+
@light.set_specular_colour(Ogre::ColourValue.White)
|
166
|
+
|
167
|
+
# create a floor mesh resource
|
168
|
+
Ogre::MeshManager::get_singleton().create_plane("floor",
|
169
|
+
Ogre::ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
|
170
|
+
Ogre::Plane.new(Ogre::Vector3.UNIT_Y, 0),
|
171
|
+
100, 100, 10, 10, true, 1, 10, 10,
|
172
|
+
Ogre::Vector3.UNIT_Z)
|
173
|
+
|
174
|
+
# create a floor entity, give it a material, and place it at the origin
|
175
|
+
@floor = @sceneMgr.create_entity("Floor", "floor")
|
176
|
+
@floor.set_material_name("Examples/Rockwall")
|
177
|
+
@floor.set_cast_shadows(false)
|
178
|
+
@sceneMgr.get_root_scene_node().attach_object(@floor)
|
179
|
+
|
180
|
+
@cameraMover = CameraMover.new(@camera)
|
181
|
+
@cameraMover.set_position(Ogre::Vector3.new(10, 10, 10))
|
182
|
+
@cameraMover.look_at(Ogre::Vector3.new(0, 0, 0))
|
183
|
+
|
184
|
+
@char = SinbadCharacter.new(@sceneMgr, @cameraMover)
|
185
|
+
|
186
|
+
items = []
|
187
|
+
items.push("Help")
|
188
|
+
@help = @trayMgr.create_params_panel(Ogrebites::TL_TOPLEFT, "HelpMessage", 100, items)
|
189
|
+
@help.set_param_value(Ogre::UTFString.new("Help"), Ogre::UTFString.new("H / F1"))
|
190
|
+
end
|
191
|
+
|
192
|
+
def frame_rendering_queued(evt)
|
193
|
+
@keyboard.capture()
|
194
|
+
@mouse.capture()
|
195
|
+
@trayMgr.frame_rendering_queued(evt)
|
196
|
+
|
197
|
+
@char.add_time(evt.timeSinceLastFrame)
|
198
|
+
@cameraMover.update(evt.timeSinceLastFrame)
|
199
|
+
|
200
|
+
return !@quit
|
201
|
+
end
|
202
|
+
|
203
|
+
def key_pressed(keyEvent)
|
204
|
+
@char.inject_key_down(keyEvent)
|
205
|
+
|
206
|
+
case keyEvent.key
|
207
|
+
when Ois::KC_ESCAPE
|
208
|
+
@quit =true
|
209
|
+
when Ois::KC_H, Ois::KC_F1
|
210
|
+
if (!@trayMgr.is_dialog_visible() && @Info["Help"] != "")
|
211
|
+
@trayMgr.show_ok_dialog(Ogre::UTFString.new("Help"), Ogre::UTFString.new(@Info["Help"]))
|
212
|
+
else
|
213
|
+
@trayMgr.close_dialog()
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
return true
|
218
|
+
end
|
219
|
+
|
220
|
+
def key_released(keyEvent)
|
221
|
+
@char.inject_key_up(keyEvent)
|
222
|
+
return true
|
223
|
+
end
|
224
|
+
|
225
|
+
def mouse_moved(mouseEvent)
|
226
|
+
return true if @trayMgr.inject_mouse_move(mouseEvent)
|
227
|
+
@cameraMover.mouse_moved(mouseEvent)
|
228
|
+
return true
|
229
|
+
end
|
230
|
+
|
231
|
+
def mouse_pressed(mouseEvent, mouseButtonID)
|
232
|
+
return true if @trayMgr.inject_mouse_down(mouseEvent, mouseButtonID)
|
233
|
+
@cameraMover.mouse_pressed(mouseEvent, mouseButtonID)
|
234
|
+
@char.inject_mouse_down(mouseEvent, mouseButtonID)
|
235
|
+
return true
|
236
|
+
end
|
237
|
+
|
238
|
+
def mouse_released(mouseEvent, mouseButtonID)
|
239
|
+
return true if @trayMgr.inject_mouse_up(mouseEvent, mouseButtonID)
|
240
|
+
@cameraMover.mouse_released(mouseEvent, mouseButtonID)
|
241
|
+
return true
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
sinbad = Sinbad.new
|
246
|
+
sinbad.run
|