Permalink
Browse files

upgrading jme3. using newer jruby. app boots with start screen. still…

… needs transition to start the game
  • Loading branch information...
1 parent 9da4264 commit 7ccdbad613f54a45ae24e69f36f55f69d4b9df12 @jwoertink committed Feb 21, 2012
View
2 .rvmrc
@@ -1 +1 @@
-rvm use jruby-1.6.4@waves
+rvm use jruby-1.6.6@waves
@@ -43,9 +43,10 @@ public void update(float tpf) {
}
public void startGame(String nextScreen) {
- System.out.println("\n\n startGame called\n\n");
nifty.gotoScreen(nextScreen); // switch to another screen
// start the game and do some more stuff...
+ // app.setupgame(); // Need to run this method, but it doesn't exist here.
+ System.out.println("\n\n setting up game\n\n");
}
public void quitGame() {
View
@@ -1,15 +1,15 @@
-require 'rubygems'
-require 'java'
-require 'jruby/core_ext'
+# require 'rubygems'
+# require 'java'
+# require 'jruby/core_ext'
require 'bundler'
Bundler.require
-GAME_ROOT_PATH = File.expand_path(File.dirname(__FILE__))
-$CLASSPATH << File.join(GAME_ROOT_PATH, "java", "classes")
+# GAME_ROOT_PATH = File.expand_path(File.dirname(__FILE__))
+# $CLASSPATH << File.join(GAME_ROOT_PATH, "java", "classes")
+#
+# $: << File.join(GAME_ROOT_PATH)
-$: << File.join(GAME_ROOT_PATH)
-
-require File.join(GAME_ROOT_PATH, '..', '..', 'vendor', 'jme3_2011-11-13.jar')
+#require File.join(GAME_ROOT_PATH, '..', '..', 'vendor', 'jme3_2012-12-20.jar')
java_import "com.jme3.app.SimpleApplication"
java_import "com.jme3.system.AppSettings"
@@ -46,15 +46,15 @@
java_import "com.jme3.texture.Texture"
java_import "com.jme3.material.RenderState"
java_import "com.jme3.niftygui.NiftyJmeDisplay"
-java_import "de.lessvoid.nifty.Nifty"
-java_import "de.lessvoid.nifty.screen.Screen"
-java_import "de.lessvoid.nifty.screen.ScreenController"
+# java_import "de.lessvoid.nifty.Nifty"
+# java_import "de.lessvoid.nifty.screen.Screen"
+# java_import "de.lessvoid.nifty.screen.ScreenController"
java_import "java.util.logging.Level"
java_import "java.util.logging.Logger"
-java_import "java.awt.DisplayMode"
-java_import "java.awt.GraphicsDevice"
-java_import "java.awt.GraphicsEnvironment"
+# java_import "java.awt.DisplayMode"
+# java_import "java.awt.GraphicsDevice"
+# java_import "java.awt.GraphicsEnvironment"
java_import "StartScreenController"
# java_import "HudScreenController"
View
@@ -31,56 +31,19 @@ def initialize
def simpleInitApp
self.timer = NanoTimer.new
- if @game_state.zero?
- display_start_screen
- else
- self.bullet_app_state = BulletAppState.new
- state_manager.attach(bullet_app_state)
-
- capsule_shape = CapsuleCollisionShape.new(1.5, 15.0, 1)
- self.player = CharacterControl.new(capsule_shape, 0.05)
- player.jump_speed = 20
- player.fall_speed = 30
- player.gravity = 30
- player.physics_location = Vector3f.new(-185, 15, -95)
- # This isn't being used yet.
- player_model = asset_manager.load_model(File.join("Models", "Oto", "Oto.mesh.xml"))
- player_model.local_scale = 0.5
- player_model.local_translation = Vector3f.new(-185, 15, -95)
- player_model.add_control(player)
- bullet_app_state.physics_space.add(player_model)
-
-
- sphere = Sphere.new(30, 30, 0.2)
- self.mark = Geometry.new("BOOM!", sphere)
- mark_mat = Material.new(asset_manager, File.join("Common", "MatDefs", "Misc", "Unshaded.j3md"))
- mark_mat.set_color("Color", ColorRGBA::Red)
- mark.material = mark_mat
-
- setup_text!
- setup_camera!
- setup_floor!
- setup_sky!
- setup_keys!
- setup_light!
- setup_audio!
-
- generate_maze #(static_maze)
-
- self.playing = true
- self.playtime = Time.now
- end
+ display_start_screen
end
def display_start_screen
nifty_display = NiftyJmeDisplay.new(asset_manager, input_manager, audio_renderer, gui_view_port)
nifty = nifty_display.nifty
- nifty.from_xml(File.join('lib', 'maze_craze', 'views', 'screen.xml'), 'start', self)
+ controller = StartScreenController.new(self)
+ nifty.from_xml(File.join('lib', 'maze_craze', 'views', 'screen.xml'), 'start', controller)
gui_view_port.add_processor(nifty_display)
- # fly_cam.enabled = false
- # fly_cam.drag_to_rotate = true
+ flyCam.enabled = false
+ flyCam.drag_to_rotate = true
input_manager.cursor_visible = true
- #controller = StartScreenController.new(self)
+
# device = GraphicsEnvironment.local_graphics_environment.default_screen_device
# modes = device.display_modes
# modes.each do |mode|
@@ -89,6 +52,45 @@ def display_start_screen
# self.stop
end
+ def setupgame
+ @game_state = 1
+ self.bullet_app_state = BulletAppState.new
+ state_manager.attach(bullet_app_state)
+
+ capsule_shape = CapsuleCollisionShape.new(1.5, 15.0, 1)
+ self.player = CharacterControl.new(capsule_shape, 0.05)
+ player.jump_speed = 20
+ player.fall_speed = 30
+ player.gravity = 30
+ player.physics_location = Vector3f.new(-185, 15, -95)
+ # This isn't being used yet.
+ player_model = asset_manager.load_model(File.join("Models", "Oto", "Oto.mesh.xml"))
+ player_model.local_scale = 0.5
+ player_model.local_translation = Vector3f.new(-185, 15, -95)
+ player_model.add_control(player)
+ bullet_app_state.physics_space.add(player_model)
+
+
+ sphere = Sphere.new(30, 30, 0.2)
+ self.mark = Geometry.new("BOOM!", sphere)
+ mark_mat = Material.new(asset_manager, File.join("Common", "MatDefs", "Misc", "Unshaded.j3md"))
+ mark_mat.set_color("Color", ColorRGBA::Red)
+ mark.material = mark_mat
+
+ setup_text!
+ setup_camera!
+ setup_floor!
+ setup_sky!
+ setup_keys!
+ setup_light!
+ setup_audio!
+
+ generate_maze #(static_maze)
+
+ self.playing = true
+ self.playtime = Time.now
+ end
+
def static_maze
maze =
<<-MAZE
@@ -140,6 +142,7 @@ def generate_maze(maze = nil)
def setup_camera!
+ flyCam.enabled = true
flyCam.move_speed = 100
cam.look_at_direction(Vector3f.new(10, 0, 0).normalize_local, Vector3f::UNIT_Y)
end
View
@@ -6,7 +6,7 @@
$: << File.join(PROJECT_ROOT, "lib")
-require File.join("..", 'vendor', 'jme3_2011-11-13.jar')
+require File.join(PROJECT_ROOT, 'vendor', 'jme3_2012-12-20.jar')
module Waves
VERSION = "0.0.1"
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 7ccdbad

Please sign in to comment.