Main repository of MikuMikuStudio
リビジョン | 42f9b6aee5d7ccc57402ed35b746ca145ca9105d (tree) |
---|---|
日時 | 2013-12-28 14:10:51 |
作者 | kobayasi <kobayasi@pscn...> |
コミッター | kobayasi |
Update niftygui 1.3.3
@@ -1,8 +1,9 @@ | ||
1 | -Last Updated 6/30/2011 | |
1 | +Last Updated 22/6/2013 | |
2 | 2 | |
3 | 3 | Component Version |
4 | 4 | --------------------------------------------------------------------- |
5 | -nifty nifty-1.3 | |
6 | -nifty-default-controls nifty-default-controls-1.3 | |
7 | -nifty-style-black nifty-style-black-1.3 | |
8 | -nifty-examples nifty-examples-1.3 | |
\ No newline at end of file | ||
5 | +nifty 1.3.3 (2013-06-20 23:54:54) | |
6 | +nifty-default-controls 1.3.3 (2013-06-20 23:54:54) | |
7 | +nifty-style-black 1.3.3 (2013-06-20 23:54:54) | |
8 | +nifty-examples 1.3.3 (2013-06-20 23:54:54) | |
9 | +jglfont-core 1.3 |
@@ -47,6 +47,7 @@ import de.lessvoid.nifty.Nifty; | ||
47 | 47 | import de.lessvoid.nifty.NiftyInputConsumer; |
48 | 48 | import de.lessvoid.nifty.input.keyboard.KeyboardInputEvent; |
49 | 49 | import de.lessvoid.nifty.spi.input.InputSystem; |
50 | +import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader; | |
50 | 51 | import java.util.ArrayList; |
51 | 52 | |
52 | 53 | public class InputSystemJme implements InputSystem, RawInputListener { |
@@ -70,6 +71,9 @@ public class InputSystemJme implements InputSystem, RawInputListener { | ||
70 | 71 | this.inputManager = inputManager; |
71 | 72 | } |
72 | 73 | |
74 | + public void setResourceLoader(NiftyResourceLoader niftyResourceLoader) { | |
75 | + } | |
76 | + | |
73 | 77 | public void setNifty(Nifty nifty) { |
74 | 78 | this.nifty = nifty; |
75 | 79 | } |
@@ -45,8 +45,8 @@ import com.jme3.renderer.ViewPort; | ||
45 | 45 | import com.jme3.renderer.queue.RenderQueue; |
46 | 46 | import com.jme3.texture.FrameBuffer; |
47 | 47 | import de.lessvoid.nifty.Nifty; |
48 | +import de.lessvoid.nifty.spi.time.impl.FastTimeProvider; | |
48 | 49 | import de.lessvoid.nifty.tools.TimeProvider; |
49 | -import de.lessvoid.nifty.tools.resourceloader.ResourceLoader; | |
50 | 50 | import de.lessvoid.nifty.tools.resourceloader.ResourceLocation; |
51 | 51 | import java.io.InputStream; |
52 | 52 | import java.net.URL; |
@@ -97,18 +97,18 @@ public class NiftyJmeDisplay implements SceneProcessor { | ||
97 | 97 | w = vp.getCamera().getWidth(); |
98 | 98 | h = vp.getCamera().getHeight(); |
99 | 99 | |
100 | - resourceLocation = new ResourceLocationJme(); | |
101 | - ResourceLoader.removeAllResourceLocations(); | |
102 | - ResourceLoader.addResourceLocation(resourceLocation); | |
103 | - | |
104 | 100 | soundDev = new SoundDeviceJme(assetManager, audioRenderer); |
105 | 101 | renderDev = new RenderDeviceJme(this); |
106 | 102 | inputSys = new InputSystemJme(inputManager); |
107 | 103 | if (inputManager != null) |
108 | 104 | inputManager.addRawInputListener(inputSys); |
109 | 105 | |
110 | - nifty = new Nifty(renderDev, soundDev, inputSys, new TimeProvider()); | |
106 | + nifty = new Nifty(renderDev, soundDev, inputSys, new FastTimeProvider()); | |
111 | 107 | inputSys.setNifty(nifty); |
108 | + | |
109 | + resourceLocation = new ResourceLocationJme(); | |
110 | + nifty.getResourceLoader().removeAllResourceLocations(); | |
111 | + nifty.getResourceLoader().addResourceLocation(resourceLocation); | |
112 | 112 | } |
113 | 113 | |
114 | 114 | public void initialize(RenderManager rm, ViewPort vp) { |
@@ -51,6 +51,7 @@ import de.lessvoid.nifty.elements.render.TextRenderer.RenderFontNull; | ||
51 | 51 | import de.lessvoid.nifty.render.BlendMode; |
52 | 52 | import de.lessvoid.nifty.spi.render.*; |
53 | 53 | import de.lessvoid.nifty.tools.Color; |
54 | +import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader; | |
54 | 55 | import java.nio.ByteBuffer; |
55 | 56 | import java.nio.FloatBuffer; |
56 | 57 | import java.util.HashMap; |
@@ -93,6 +94,9 @@ public class RenderDeviceJme implements RenderDevice { | ||
93 | 94 | niftyMat.getAdditionalRenderState().setDepthTest(false); |
94 | 95 | } |
95 | 96 | |
97 | + public void setResourceLoader(NiftyResourceLoader niftyResourceLoader) { | |
98 | + } | |
99 | + | |
96 | 100 | public void setRenderManager(RenderManager rm){ |
97 | 101 | this.rm = rm; |
98 | 102 | this.r = rm.getRenderer(); |
@@ -187,7 +191,7 @@ public class RenderDeviceJme implements RenderDevice { | ||
187 | 191 | quadColor.updateData(buf); |
188 | 192 | } |
189 | 193 | |
190 | - public void renderFont(RenderFont font, String str, int x, int y, Color color, float size){ | |
194 | + public void renderFont(RenderFont font, String str, int x, int y, Color color, float sizeX, float sizeY) { | |
191 | 195 | if (str.length() == 0) |
192 | 196 | return; |
193 | 197 |
@@ -214,12 +218,12 @@ public class RenderDeviceJme implements RenderDevice { | ||
214 | 218 | float width = text.getLineWidth(); |
215 | 219 | float height = text.getLineHeight(); |
216 | 220 | |
217 | - float x0 = x + 0.5f * width * (1f - size); | |
218 | - float y0 = y + 0.5f * height * (1f - size); | |
221 | + float x0 = x + 0.5f * width * (1f - sizeX); | |
222 | + float y0 = y + 0.5f * height * (1f - sizeY); | |
219 | 223 | |
220 | 224 | tempMat.loadIdentity(); |
221 | 225 | tempMat.setTranslation(x0, getHeight() - y0, 0); |
222 | - tempMat.setScale(size, size, 0); | |
226 | + tempMat.setScale(sizeX, sizeY, 0); | |
223 | 227 | |
224 | 228 | rm.setWorldMatrix(tempMat); |
225 | 229 | text.render(rm); |
@@ -97,6 +97,14 @@ public class RenderFontJme implements RenderFont { | ||
97 | 97 | return result; |
98 | 98 | } |
99 | 99 | |
100 | + public int getWidth(final String str, final float size) { | |
101 | + // Note: This is supposed to return the width of the String when scaled | |
102 | + // with the size factor. Since I don't know how to do that with | |
103 | + // the font rendering in jme this will only work correctly with | |
104 | + // a size value of 1.f and will return inaccurate values otherwise. | |
105 | + return getWidth(str); | |
106 | + } | |
107 | + | |
100 | 108 | /** |
101 | 109 | * Return the width of the given character including kerning information. |
102 | 110 | * @param currentCharacter current character |
@@ -38,6 +38,7 @@ import com.jme3.audio.AudioRenderer; | ||
38 | 38 | import de.lessvoid.nifty.sound.SoundSystem; |
39 | 39 | import de.lessvoid.nifty.spi.sound.SoundDevice; |
40 | 40 | import de.lessvoid.nifty.spi.sound.SoundHandle; |
41 | +import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader; | |
41 | 42 | |
42 | 43 | public class SoundDeviceJme implements SoundDevice { |
43 | 44 |
@@ -49,6 +50,9 @@ public class SoundDeviceJme implements SoundDevice { | ||
49 | 50 | this.ar = ar; |
50 | 51 | } |
51 | 52 | |
53 | + public void setResourceLoader(NiftyResourceLoader niftyResourceLoader) { | |
54 | + } | |
55 | + | |
52 | 56 | public SoundHandle loadSound(SoundSystem soundSystem, String filename) { |
53 | 57 | AudioNode an = new AudioNode(assetManager, filename, false); |
54 | 58 | an.setPositional(false); |