Permalink
Browse files

forgot to add files

  • Loading branch information...
1 parent 538bc32 commit 5a4765f0dfa5a3a59584cf5e9276aa6cb79a0981 @jwoertink committed Oct 25, 2011
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nifty xmlns="http://nifty-gui.sourceforge.net/nifty.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty.xsd http://nifty-gui.sourceforge.net/nifty.xsd">
+ <useControls filename="nifty-default-controls.xml" />
+ <useStyles filename="nifty-default-styles.xml" />
+ <screen id="start">
+ <!-- required -->
+ <layer id="background" childLayout="center">
+ <image filename="assets/Interface/start-background.png"></image>
+ </layer>
+ <layer id="foreground" backgroundColor="#0000" childLayout="vertical">
+ <panel id="panel_top" height="25%" width="75%" align="center" childLayout="center">
+ <text text="My Cool Game" font="Interface/Fonts/Default.fnt" width="100%" height="100%" />
+ </panel>
+ <panel id="panel_mid" height="50%" width="75%" align="center" childLayout="center">
+ <text text="Here goes some text describing the game and the rules and stuff. Incidentally, the text is quite long and needs to wrap at the end of lines. ..."
+ font="Interface/Fonts/Default.fnt" width="100%" height="100%" wrap="true" />
+ </panel>
+ <panel id="panel_bottom" height="25%" width="75%" align="center" childLayout="horizontal" backgroundColor="#00f8">
+ <panel id="panel_bottom_left" height="50%" width="50%" valign="center" childLayout="center">
+ <control name="button" label="Start" id="StartButton" align="center" valign="center">
+ </control>
+ </panel>
+ <panel id="panel_bottom_right" height="50%" width="50%" valign="center" childLayout="center">
+ <control name="button" label="Quit" id="QuitButton" align="center" valign="center">
+ </control>
+ </panel>
+ </panel>
+ </layer>
+ </screen>
+ <screen id="hud">
+ <!-- optional -->
+ <layer id="background" childLayout="center">
+ <!-- image filename="Interface/tutorial/step2/hud-frame.pmg"></image -->
+ </layer>
+ <layer id="foreground" backgroundColor="#0000" childLayout="vertical">
+ <panel id="panel_bottom_left" height="75%" width="20%" valign="center" childLayout="center">
+ <!-- image filename="Interface/tutorial/step2/face1.png" valign="center" align="center" height="50%" width="30%"></image -->
+ </panel>
+ <panel id="panel_right" width="20%" height="100%" childLayout="vertical" backgroundColor="#00f8" >
+ <panel id="panel_top_right" height="100%" width="15%" childLayout="center">
+ <control name="label" color="#000" text="123" width="100%" height="100%" />
+ </panel>
+ <panel id="panel_top_right1" width="100%" height="15%" childLayout="center" backgroundColor="#00f8">
+ </panel>
+ <panel id="panel_top_right2" width="100%" height="15%" childLayout="center" backgroundColor="#44f8">
+ </panel>
+ <panel id="panel_bot_right" width="100%" height="70%" valign="center" backgroundColor="#88f8">
+ </panel>
+ </panel>
+ </layer>
+ </screen>
+</nifty>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,41 @@
+java_import "com.jme3.app.Application"
+java_import "com.jme3.app.SimpleApplication"
+java_import "com.jme3.app.state.AbstractAppState"
+java_import "com.jme3.app.state.AppStateManager"
+java_import "de.lessvoid.nifty.Nifty"
+java_import "de.lessvoid.nifty.screen.Screen"
+java_import "de.lessvoid.nifty.screen.ScreenController"
+
+class StartScreenController < AbstractAppState
+ include ScreenController
+
+ attr_accessor :nifty, :screen, :app
+
+ def initialize(data = "")
+
+ end
+
+ def bind(nifty, screen)
+ self.nifty = nifty
+ self.screen = screen
+ end
+
+ def on_start_screen
+
+ end
+
+ def on_end_screen
+
+ end
+
+ # How do I do this?!
+ def app_initialize(state_manager, app)
+ super.initialize(state_manager, app)
+ self.app = app
+ end
+
+ def update(tpf)
+ # jme update loop
+ end
+
+end
@@ -0,0 +1,70 @@
+=begin
+ Sample using Nifty the "JRuby" way.
+=end
+
+java_import "com.jme3.app.SimpleApplication"
+java_import "com.jme3.niftygui.NiftyJmeDisplay"
+java_import "de.lessvoid.nifty.Nifty"
+java_import "de.lessvoid.nifty.builder.ScreenBuilder"
+java_import "de.lessvoid.nifty.builder.LayerBuilder"
+java_import "de.lessvoid.nifty.builder.PanelBuilder"
+java_import "de.lessvoid.nifty.controls.button.builder.ButtonBuilder"
+java_import "de.lessvoid.nifty.screen.DefaultScreenController"
+
+
+class Sample13a < SimpleApplication
+ field_accessor :flyCam
+
+ def simpleInitApp()
+ niftyDisplay = NiftyJmeDisplay.new(assetManager, inputManager, audioRenderer, guiViewPort)
+ nifty = niftyDisplay.getNifty
+ guiViewPort.addProcessor(niftyDisplay)
+ flyCam.setDragToRotate(true)
+
+ nifty.loadStyleFile("nifty-default-styles.xml")
+ nifty.loadControlFile("nifty-default-controls.xml")
+
+ screen_builder = MyScreenBuilder.new("Hello Nifty Screen")
+ screen_builder.controller(DefaultScreenController.new)
+ screen_builder.layer(MyLayerBuilder.new("Layer_ID"))
+
+ nifty.addScreen("Screen_ID", screen_builder.build(nifty))
+ nifty.gotoScreen("Screen_ID")
+ end
+end
+
+class MyScreenBuilder < ScreenBuilder
+
+end
+
+class MyLayerBuilder < LayerBuilder
+
+ def initialize(id)
+ super
+ childLayoutVertical
+ panel(MyPanelBuilder.new("Panel_ID"))
+ end
+
+end
+
+class MyPanelBuilder < PanelBuilder
+
+ def initialize(id)
+ super
+ childLayoutCenter
+ control(MyButtonBuilder.new("Button_ID", "Hello Nifty"))
+ end
+
+end
+
+class MyButtonBuilder < ButtonBuilder
+
+ def initialize(id, text)
+ super
+ alignCenter
+ valignCenter
+ height("5%")
+ width("15%")
+ end
+
+end

0 comments on commit 5a4765f

Please sign in to comment.