Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jbass86/JTJ_Holdem
base: f0ee4f3b31
...
head fork: jbass86/JTJ_Holdem
compare: 63b06f3382
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 514 files changed
  • 0 commit comments
  • 1 contributor
Showing with 181 additions and 35,043 deletions.
  1. +24 −3 basic_poker_utils/.classpath
  2. +1 −0  basic_poker_utils/.gitignore
  3. +6 −0 basic_poker_utils/.project
  4. +5 −0 basic_poker_utils/.settings/org.eclipse.core.resources.prefs
  5. +5 −0 basic_poker_utils/.settings/org.eclipse.jdt.core.prefs
  6. +4 −0 basic_poker_utils/.settings/org.eclipse.m2e.core.prefs
  7. +34 −0 basic_poker_utils/pom.xml
  8. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/data/Card.java
  9. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/data_structures/CardDeck.java
  10. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/data_structures/PokerHand.java
  11. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/enums/ECardNumber.java
  12. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/enums/ECardSuit.java
  13. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/enums/EPokerHand.java
  14. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/interfaces/ICard.java
  15. 0  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/main/MainGame.java
  16. +1 −1  basic_poker_utils/src/{ → main/java}/jtj_holdem/game/utility/PokerHandUtility.java
  17. 0  basic_poker_utils/src/{ → test/java}/jtj_holdem/tests/deck/BasicDeckTests.java
  18. 0  basic_poker_utils/src/{ → test/java}/jtj_holdem/tests/misc/CardTests.java
  19. 0  basic_poker_utils/src/{ → test/java}/jtj_holdem/tests/misc/GeneralTest.java
  20. 0  basic_poker_utils/src/{ → test/java}/jtj_holdem/tests/poker/PokerHandTests.java
  21. +11 −6 poker.front_end.2d/.classpath
  22. +1 −0  poker.front_end.2d/.gitignore
  23. +6 −0 poker.front_end.2d/.project
  24. +1 −0  poker.front_end.2d/.settings/org.eclipse.jdt.core.prefs
  25. +4 −0 poker.front_end.2d/.settings/org.eclipse.m2e.core.prefs
  26. BIN  poker.front_end.2d/lib/META-INF/LWJGL.RSA
  27. +0 −15 poker.front_end.2d/lib/META-INF/LWJGL.SF
  28. +0 −13 poker.front_end.2d/lib/META-INF/MANIFEST.MF
  29. BIN  poker.front_end.2d/lib/OpenAL32.dll
  30. BIN  poker.front_end.2d/lib/OpenAL64.dll
  31. BIN  poker.front_end.2d/lib/jinput-dx8.dll
  32. BIN  poker.front_end.2d/lib/jinput-dx8_64.dll
  33. BIN  poker.front_end.2d/lib/jinput-raw.dll
  34. BIN  poker.front_end.2d/lib/jinput-raw_64.dll
  35. BIN  poker.front_end.2d/lib/libjinput-linux.so
  36. BIN  poker.front_end.2d/lib/libjinput-linux64.so
  37. BIN  poker.front_end.2d/lib/libjinput-osx.jnilib
  38. BIN  poker.front_end.2d/lib/liblwjgl.jnilib
  39. BIN  poker.front_end.2d/lib/liblwjgl.so
  40. BIN  poker.front_end.2d/lib/liblwjgl64.so
  41. BIN  poker.front_end.2d/lib/libopenal.so
  42. BIN  poker.front_end.2d/lib/libopenal64.so
  43. BIN  poker.front_end.2d/lib/lwjgl.dll
  44. BIN  poker.front_end.2d/lib/lwjgl.jar
  45. BIN  poker.front_end.2d/lib/lwjgl64.dll
  46. BIN  poker.front_end.2d/lib/openal.dylib
  47. BIN  poker.front_end.2d/lib/slick.jar
  48. +78 −0 poker.front_end.2d/pom.xml
  49. +0 −635 poker.front_end.2d/slick_src/org/newdawn/slick/AngelCodeFont.java
  50. +0 −724 poker.front_end.2d/slick_src/org/newdawn/slick/Animation.java
  51. +0 −547 poker.front_end.2d/slick_src/org/newdawn/slick/AppGameContainer.java
  52. +0 −576 poker.front_end.2d/slick_src/org/newdawn/slick/AppletGameContainer.java
  53. +0 −205 poker.front_end.2d/slick_src/org/newdawn/slick/BasicGame.java
  54. +0 −768 poker.front_end.2d/slick_src/org/newdawn/slick/BigImage.java
  55. +0 −76 poker.front_end.2d/slick_src/org/newdawn/slick/CachedRender.java
  56. +0 −184 poker.front_end.2d/slick_src/org/newdawn/slick/CanvasGameContainer.java
  57. +0 −392 poker.front_end.2d/slick_src/org/newdawn/slick/Color.java
  58. +0 −42 poker.front_end.2d/slick_src/org/newdawn/slick/ControlledInputReciever.java
  59. +0 −102 poker.front_end.2d/slick_src/org/newdawn/slick/ControllerListener.java
  60. +0 −65 poker.front_end.2d/slick_src/org/newdawn/slick/Font.java
  61. +0 −55 poker.front_end.2d/slick_src/org/newdawn/slick/Game.java
  62. +0 −868 poker.front_end.2d/slick_src/org/newdawn/slick/GameContainer.java
  63. +0 −1,780 poker.front_end.2d/slick_src/org/newdawn/slick/Graphics.java
  64. +0 −1,403 poker.front_end.2d/slick_src/org/newdawn/slick/Image.java
  65. +0 −167 poker.front_end.2d/slick_src/org/newdawn/slick/ImageBuffer.java
  66. +0 −1,533 poker.front_end.2d/slick_src/org/newdawn/slick/Input.java
  67. +0 −9 poker.front_end.2d/slick_src/org/newdawn/slick/InputListener.java
  68. +0 −25 poker.front_end.2d/slick_src/org/newdawn/slick/KeyListener.java
  69. +0 −69 poker.front_end.2d/slick_src/org/newdawn/slick/MouseListener.java
  70. +0 −412 poker.front_end.2d/slick_src/org/newdawn/slick/Music.java
  71. +0 −26 poker.front_end.2d/slick_src/org/newdawn/slick/MusicListener.java
  72. +0 −193 poker.front_end.2d/slick_src/org/newdawn/slick/PackedSpriteSheet.java
  73. +0 −18 poker.front_end.2d/slick_src/org/newdawn/slick/Renderable.java
  74. +0 −176 poker.front_end.2d/slick_src/org/newdawn/slick/SavedState.java
  75. +0 −188 poker.front_end.2d/slick_src/org/newdawn/slick/ScalableGame.java
  76. +0 −33 poker.front_end.2d/slick_src/org/newdawn/slick/ShapeFill.java
  77. +0 −27 poker.front_end.2d/slick_src/org/newdawn/slick/SlickException.java
  78. +0 −175 poker.front_end.2d/slick_src/org/newdawn/slick/Sound.java
  79. +0 −303 poker.front_end.2d/slick_src/org/newdawn/slick/SpriteSheet.java
  80. +0 −111 poker.front_end.2d/slick_src/org/newdawn/slick/SpriteSheetFont.java
  81. +0 −409 poker.front_end.2d/slick_src/org/newdawn/slick/TrueTypeFont.java
  82. +0 −980 poker.front_end.2d/slick_src/org/newdawn/slick/UnicodeFont.java
  83. +0 −65 poker.front_end.2d/slick_src/org/newdawn/slick/XMLPackedSheet.java
  84. +0 −54 poker.front_end.2d/slick_src/org/newdawn/slick/command/BasicCommand.java
  85. +0 −12 poker.front_end.2d/slick_src/org/newdawn/slick/command/Command.java
  86. +0 −9 poker.front_end.2d/slick_src/org/newdawn/slick/command/Control.java
  87. +0 −20 poker.front_end.2d/slick_src/org/newdawn/slick/command/ControllerButtonControl.java
  88. +0 −61 poker.front_end.2d/slick_src/org/newdawn/slick/command/ControllerControl.java
  89. +0 −47 poker.front_end.2d/slick_src/org/newdawn/slick/command/ControllerDirectionControl.java
  90. +0 −464 poker.front_end.2d/slick_src/org/newdawn/slick/command/InputProvider.java
  91. +0 −24 poker.front_end.2d/slick_src/org/newdawn/slick/command/InputProviderListener.java
  92. +0 −39 poker.front_end.2d/slick_src/org/newdawn/slick/command/KeyControl.java
  93. +0 −39 poker.front_end.2d/slick_src/org/newdawn/slick/command/MouseButtonControl.java
  94. +0 −4 poker.front_end.2d/slick_src/org/newdawn/slick/command/package.html
  95. +0 −195 poker.front_end.2d/slick_src/org/newdawn/slick/data/defaultfont.fnt
  96. BIN  poker.front_end.2d/slick_src/org/newdawn/slick/data/defaultfont.png
  97. +0 −131 poker.front_end.2d/slick_src/org/newdawn/slick/data/helvetica_svg
  98. +0 −4 poker.front_end.2d/slick_src/org/newdawn/slick/data/package.html
  99. BIN  poker.front_end.2d/slick_src/org/newdawn/slick/data/particle.tga
  100. +0 −253 poker.front_end.2d/slick_src/org/newdawn/slick/fills/GradientFill.java
  101. +0 −3  poker.front_end.2d/slick_src/org/newdawn/slick/fills/package.html
  102. +0 −152 poker.front_end.2d/slick_src/org/newdawn/slick/font/Glyph.java
  103. +0 −260 poker.front_end.2d/slick_src/org/newdawn/slick/font/GlyphPage.java
  104. +0 −380 poker.front_end.2d/slick_src/org/newdawn/slick/font/HieroSettings.java
  105. +0 −92 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/ColorEffect.java
  106. +0 −53 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/ConfigurableEffect.java
  107. +0 −25 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/Effect.java
  108. +0 −368 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/EffectUtil.java
  109. +0 −62 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/FilterEffect.java
  110. +0 −195 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/GradientEffect.java
  111. +0 −178 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/OutlineEffect.java
  112. +0 −200 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/OutlineWobbleEffect.java
  113. +0 −194 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/OutlineZigzagEffect.java
  114. +0 −321 poker.front_end.2d/slick_src/org/newdawn/slick/font/effects/ShadowEffect.java
  115. +0 −437 poker.front_end.2d/slick_src/org/newdawn/slick/geom/BasicTriangulator.java
  116. +0 −234 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Circle.java
  117. +0 −113 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Curve.java
  118. +0 −196 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Ellipse.java
  119. +0 −449 poker.front_end.2d/slick_src/org/newdawn/slick/geom/GeomUtil.java
  120. +0 −32 poker.front_end.2d/slick_src/org/newdawn/slick/geom/GeomUtilListener.java
  121. +0 −482 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Line.java
  122. +0 −617 poker.front_end.2d/slick_src/org/newdawn/slick/geom/MannTriangulator.java
  123. +0 −193 poker.front_end.2d/slick_src/org/newdawn/slick/geom/MorphShape.java
  124. +0 −617 poker.front_end.2d/slick_src/org/newdawn/slick/geom/NeatTriangulator.java
  125. +0 −113 poker.front_end.2d/slick_src/org/newdawn/slick/geom/OverTriangulator.java
  126. +0 −241 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Path.java
  127. +0 −72 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Point.java
  128. +0 −200 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Polygon.java
  129. +0 −269 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Rectangle.java
  130. +0 −284 poker.front_end.2d/slick_src/org/newdawn/slick/geom/RoundedRectangle.java
  131. +0 −767 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Shape.java
  132. +0 −391 poker.front_end.2d/slick_src/org/newdawn/slick/geom/ShapeRenderer.java
  133. +0 −19 poker.front_end.2d/slick_src/org/newdawn/slick/geom/TexCoordGenerator.java
  134. +0 −230 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Transform.java
  135. +0 −48 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Triangulator.java
  136. +0 −396 poker.front_end.2d/slick_src/org/newdawn/slick/geom/Vector2f.java
  137. +0 −3  poker.front_end.2d/slick_src/org/newdawn/slick/geom/package.html
  138. +0 −182 poker.front_end.2d/slick_src/org/newdawn/slick/gui/AbstractComponent.java
  139. +0 −83 poker.front_end.2d/slick_src/org/newdawn/slick/gui/BasicComponent.java
  140. +0 −17 poker.front_end.2d/slick_src/org/newdawn/slick/gui/ComponentListener.java
  141. +0 −103 poker.front_end.2d/slick_src/org/newdawn/slick/gui/GUIContext.java
  142. +0 −433 poker.front_end.2d/slick_src/org/newdawn/slick/gui/MouseOverArea.java
  143. +0 −476 poker.front_end.2d/slick_src/org/newdawn/slick/gui/TextField.java
  144. +0 −3  poker.front_end.2d/slick_src/org/newdawn/slick/gui/package.html
  145. +0 −94 poker.front_end.2d/slick_src/org/newdawn/slick/imageout/ImageIOWriter.java
  146. +0 −131 poker.front_end.2d/slick_src/org/newdawn/slick/imageout/ImageOut.java
  147. +0 −25 poker.front_end.2d/slick_src/org/newdawn/slick/imageout/ImageWriter.java
  148. +0 −76 poker.front_end.2d/slick_src/org/newdawn/slick/imageout/ImageWriterFactory.java
  149. +0 −86 poker.front_end.2d/slick_src/org/newdawn/slick/imageout/TGAWriter.java
  150. +0 −3  poker.front_end.2d/slick_src/org/newdawn/slick/imageout/package.html
  151. +0 −26 poker.front_end.2d/slick_src/org/newdawn/slick/loading/DeferredResource.java
  152. +0 −112 poker.front_end.2d/slick_src/org/newdawn/slick/loading/LoadingList.java
  153. +0 −4 poker.front_end.2d/slick_src/org/newdawn/slick/loading/package.html
  154. +0 −74 poker.front_end.2d/slick_src/org/newdawn/slick/muffin/FileMuffin.java
  155. +0 −29 poker.front_end.2d/slick_src/org/newdawn/slick/muffin/Muffin.java
  156. +0 −138 poker.front_end.2d/slick_src/org/newdawn/slick/muffin/WebstartMuffin.java
  157. +0 −3  poker.front_end.2d/slick_src/org/newdawn/slick/muffin/package.html
  158. +0 −268 poker.front_end.2d/slick_src/org/newdawn/slick/openal/AiffData.java
  159. +0 −79 poker.front_end.2d/slick_src/org/newdawn/slick/openal/Audio.java
  160. +0 −139 poker.front_end.2d/slick_src/org/newdawn/slick/openal/AudioImpl.java
  161. +0 −71 poker.front_end.2d/slick_src/org/newdawn/slick/openal/AudioInputStream.java
  162. +0 −96 poker.front_end.2d/slick_src/org/newdawn/slick/openal/AudioLoader.java
  163. +0 −164 poker.front_end.2d/slick_src/org/newdawn/slick/openal/DeferredSound.java
  164. +0 −105 poker.front_end.2d/slick_src/org/newdawn/slick/openal/MODSound.java
  165. +0 −66 poker.front_end.2d/slick_src/org/newdawn/slick/openal/NullAudio.java
  166. +0 −17 poker.front_end.2d/slick_src/org/newdawn/slick/openal/OggData.java
  167. +0 −329 poker.front_end.2d/slick_src/org/newdawn/slick/openal/OggDecoder.java
  168. +0 −506 poker.front_end.2d/slick_src/org/newdawn/slick/openal/OggInputStream.java
  169. +0 −322 poker.front_end.2d/slick_src/org/newdawn/slick/openal/OpenALStreamPlayer.java
  170. +0 −974 poker.front_end.2d/slick_src/org/newdawn/slick/openal/SoundStore.java
  171. +0 −108 poker.front_end.2d/slick_src/org/newdawn/slick/openal/StreamSound.java
  172. +0 −265 poker.front_end.2d/slick_src/org/newdawn/slick/openal/WaveData.java
  173. +0 −4 poker.front_end.2d/slick_src/org/newdawn/slick/openal/package.html
  174. +0 −42 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/CompositeIOException.java
  175. +0 −151 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/CompositeImageData.java
  176. +0 −183 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/CursorLoader.java
  177. +0 −234 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/DeferredTexture.java
  178. +0 −71 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/EmptyImageData.java
  179. +0 −22 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/GLUtils.java
  180. +0 −55 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/ImageData.java
  181. +0 −77 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/ImageDataFactory.java
  182. +0 −244 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/ImageIOImageData.java
  183. +0 −530 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/InternalTextureLoader.java
  184. +0 −54 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/LoadableImageData.java
  185. +0 −762 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/PNGDecoder.java
  186. +0 −202 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/PNGImageData.java
  187. +0 −122 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/SlickCallable.java
  188. +0 −319 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/TGAImageData.java
  189. +0 −97 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/Texture.java
  190. +0 −377 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/TextureImpl.java
  191. +0 −66 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/TextureLoader.java
  192. +0 −4 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/package.html
  193. +0 −228 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/pbuffer/FBOGraphics.java
  194. +0 −141 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/pbuffer/GraphicsFactory.java
  195. +0 −172 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/pbuffer/PBufferGraphics.java
  196. +0 −167 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/pbuffer/PBufferUniqueGraphics.java
  197. +0 −72 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/DefaultLineStripRenderer.java
  198. +0 −426 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/ImmediateModeOGLRenderer.java
  199. +0 −66 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/LineStripRenderer.java
  200. +0 −293 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/QuadBasedLineStripRenderer.java
  201. +0 −99 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/Renderer.java
  202. +0 −535 poker.front_end.2d/slick_src/org/newdawn/slick/opengl/renderer/SGL.java
Sorry, we could not display the entire diff because too many files (514) changed.
View
27 basic_poker_utils/.classpath
@@ -1,7 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
View
1  basic_poker_utils/.gitignore
@@ -1 +1,2 @@
/bin
+/target
View
6 basic_poker_utils/.project
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
View
5 basic_poker_utils/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding/<project>=UTF-8
View
5 basic_poker_utils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7
View
4 basic_poker_utils/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
View
34 basic_poker_utils/pom.xml
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>basic_poker_utils</groupId>
+ <artifactId>basic_poker_utils</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Basic_Poker_Utils</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
0  basic_poker_utils/src/jtj_holdem/game/data/Card.java → ...tils/src/main/java/jtj_holdem/game/data/Card.java
File renamed without changes
View
0  ...src/jtj_holdem/game/data_structures/CardDeck.java → ...ava/jtj_holdem/game/data_structures/CardDeck.java
File renamed without changes
View
0  ...rc/jtj_holdem/game/data_structures/PokerHand.java → ...va/jtj_holdem/game/data_structures/PokerHand.java
File renamed without changes
View
0  ..._utils/src/jtj_holdem/game/enums/ECardNumber.java → .../main/java/jtj_holdem/game/enums/ECardNumber.java
File renamed without changes
View
0  ...er_utils/src/jtj_holdem/game/enums/ECardSuit.java → ...rc/main/java/jtj_holdem/game/enums/ECardSuit.java
File renamed without changes
View
0  ...r_utils/src/jtj_holdem/game/enums/EPokerHand.java → ...c/main/java/jtj_holdem/game/enums/EPokerHand.java
File renamed without changes
View
0  ...r_utils/src/jtj_holdem/game/interfaces/ICard.java → ...c/main/java/jtj_holdem/game/interfaces/ICard.java
File renamed without changes
View
0  ...oker_utils/src/jtj_holdem/game/main/MainGame.java → .../src/main/java/jtj_holdem/game/main/MainGame.java
File renamed without changes
View
2  ...src/jtj_holdem/game/utility/PokerHandUtility.java → ...ava/jtj_holdem/game/utility/PokerHandUtility.java
@@ -95,7 +95,7 @@ public static PokerHand determineStraight(List<ICard> pHand){
PokerHand hand = PokerHand.INVALID;
- List<ICard> sortedList = new ArrayList<>(pHand);
+ List<ICard> sortedList = new ArrayList<ICard>(pHand);
Collections.sort(sortedList);
List<ICard> consecutiveCards = new ArrayList<ICard>();
View
0  ...ils/src/jtj_holdem/tests/deck/BasicDeckTests.java → ...st/java/jtj_holdem/tests/deck/BasicDeckTests.java
File renamed without changes
View
0  ...er_utils/src/jtj_holdem/tests/misc/CardTests.java → ...rc/test/java/jtj_holdem/tests/misc/CardTests.java
File renamed without changes
View
0  ..._utils/src/jtj_holdem/tests/misc/GeneralTest.java → .../test/java/jtj_holdem/tests/misc/GeneralTest.java
File renamed without changes
View
0  ...ls/src/jtj_holdem/tests/poker/PokerHandTests.java → ...t/java/jtj_holdem/tests/poker/PokerHandTests.java
File renamed without changes
View
17 poker.front_end.2d/.classpath
@@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/basic_poker_utils"/>
- <classpathentry kind="lib" path="lib/slick.jar" sourcepath="slick_src"/>
- <classpathentry kind="lib" path="lib/lwjgl.jar">
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
- <attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="poker.front_end.2d/lib"/>
+ <attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
View
1  poker.front_end.2d/.gitignore
@@ -1 +1,2 @@
/bin
+/target
View
6 poker.front_end.2d/.project
@@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
View
1  poker.front_end.2d/.settings/org.eclipse.jdt.core.prefs
@@ -8,4 +8,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
View
4 poker.front_end.2d/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
View
BIN  poker.front_end.2d/lib/META-INF/LWJGL.RSA
Binary file not shown
View
15 poker.front_end.2d/lib/META-INF/LWJGL.SF
@@ -1,15 +0,0 @@
-Signature-Version: 1.0
-SHA-256-Digest-Manifest-Main-Attributes: WkrGnunUDILDJLhOInzfRt8YhMaAM
- SnFmsOQufbveus=
-SHA-256-Digest-Manifest: kbr4tLWTB6x4HEO2w2o7G3VC/bAUAiJNOSXrpF6tOYg=
-Created-By: 1.7.0_17 (Oracle Corporation)
-
-Name: liblwjgl.jnilib
-SHA-256-Digest: 0UWrfDMx5Eu47qF4Od7kcR3kuc4xF21we+3yGL7M99s=
-
-Name: openal.dylib
-SHA-256-Digest: gAyTEUjv6AzKYqZ5FcgwubYS25HriVTsc1sg4XETI/8=
-
-Name: libjinput-osx.jnilib
-SHA-256-Digest: Z06Hppn1Gf3E72QC5ulmkQkqqaNXrY7kl5kLfff98d8=
-
View
13 poker.front_end.2d/lib/META-INF/MANIFEST.MF
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Ant-Version: Apache Ant 1.8.2
-Created-By: 1.7.0_17-b02 (Oracle Corporation)
-
-Name: liblwjgl.jnilib
-SHA-256-Digest: Zm31kaiqQJ5X0+dBrcuE7umjUksfIdPXQzamA8DGjYc=
-
-Name: openal.dylib
-SHA-256-Digest: 2EX6si/VhCXer7yxpVJjO0pivV36J7kmPAUNkaP62MA=
-
-Name: libjinput-osx.jnilib
-SHA-256-Digest: 0VXCnPp9e0nKsIIdW6AKj9yLOGyL9WafAxOmLkS6cNY=
-
View
BIN  poker.front_end.2d/lib/OpenAL32.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/OpenAL64.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/jinput-dx8.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/jinput-dx8_64.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/jinput-raw.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/jinput-raw_64.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/libjinput-linux.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/libjinput-linux64.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/libjinput-osx.jnilib
Binary file not shown
View
BIN  poker.front_end.2d/lib/liblwjgl.jnilib
Binary file not shown
View
BIN  poker.front_end.2d/lib/liblwjgl.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/liblwjgl64.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/libopenal.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/libopenal64.so
Binary file not shown
View
BIN  poker.front_end.2d/lib/lwjgl.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/lwjgl.jar
Binary file not shown
View
BIN  poker.front_end.2d/lib/lwjgl64.dll
Binary file not shown
View
BIN  poker.front_end.2d/lib/openal.dylib
Binary file not shown
View
BIN  poker.front_end.2d/lib/slick.jar
Binary file not shown
View
78 poker.front_end.2d/pom.xml
@@ -0,0 +1,78 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>poker.front_end.2d</groupId>
+ <artifactId>poker.front_end.2d</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>Poker_2d</name>
+
+ <repositories>
+ <repository>
+ <id>mavenNatives</id>
+ <name>Maven Natives Repository</name>
+ <url>http://mavennatives.googlecode.com/svn/repo</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.lwjgl.lwjgl</groupId>
+ <artifactId>lwjgl</artifactId>
+ <version>2.9.0</version>
+ </dependency>
+ <dependency>
+ <groupId>java3d</groupId>
+ <artifactId>vecmath</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>basic_poker_utils</groupId>
+ <artifactId>basic_poker_utils</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slick2d</groupId>
+ <artifactId>slick2d-core</artifactId>
+ <version>2013.10-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.googlecode.mavennatives</groupId>
+ <artifactId>maven-nativedependencies-plugin</artifactId>
+ <version>0.0.6</version>
+ <executions>
+ <execution>
+ <id>unpacknatives</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <!--suppress MavenModelInspection (this line is for IDEA)-->
+ <goal>copy</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
View
635 poker.front_end.2d/slick_src/org/newdawn/slick/AngelCodeFont.java
@@ -1,635 +0,0 @@
-package org.newdawn.slick;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Map.Entry;
-
-import org.newdawn.slick.opengl.renderer.Renderer;
-import org.newdawn.slick.opengl.renderer.SGL;
-import org.newdawn.slick.util.Log;
-import org.newdawn.slick.util.ResourceLoader;
-
-/**
- * A font implementation that will parse BMFont format font files. The font files can be output
- * by Hiero, which is included with Slick, and also the AngelCode font tool available at:
- *
- * <a
- * href="http://www.angelcode.com/products/bmfont/">http://www.angelcode.com/products/bmfont/</a>
- *
- * This implementation copes with both the font display and kerning information
- * allowing nicer looking paragraphs of text. Note that this utility only
- * supports the text BMFont format definition file.
- *
- * @author kevin
- * @author Nathan Sweet <misc@n4te.com>
- */
-public class AngelCodeFont implements Font {
- /** The renderer to use for all GL operations */
- private static SGL GL = Renderer.get();
-
- /**
- * The line cache size, this is how many lines we can render before starting
- * to regenerate lists
- */
- private static final int DISPLAY_LIST_CACHE_SIZE = 200;
-
- /** The highest character that AngelCodeFont will support. */
- private static final int MAX_CHAR = 255;
-
- /** True if this font should use display list caching */
- private boolean displayListCaching = true;
-
- /** The image containing the bitmap font */
- private Image fontImage;
- /** The characters building up the font */
- private CharDef[] chars;
- /** The height of a line */
- private int lineHeight;
- /** The first display list ID */
- private int baseDisplayListID = -1;
- /** The eldest display list ID */
- private int eldestDisplayListID;
- /** The eldest display list */
- private DisplayList eldestDisplayList;
-
- /** The display list cache for rendered lines */
- private final LinkedHashMap displayLists = new LinkedHashMap(DISPLAY_LIST_CACHE_SIZE, 1, true) {
- protected boolean removeEldestEntry(Entry eldest) {
- eldestDisplayList = (DisplayList)eldest.getValue();
- eldestDisplayListID = eldestDisplayList.id;
-
- return false;
- }
- };
-
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param fntFile
- * The location of the font defnition file
- * @param image
- * The image to use for the font
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String fntFile, Image image) throws SlickException {
- fontImage = image;
-
- parseFnt(ResourceLoader.getResourceAsStream(fntFile));
- }
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param fntFile
- * The location of the font defnition file
- * @param imgFile
- * The location of the font image
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String fntFile, String imgFile) throws SlickException {
- fontImage = new Image(imgFile);
-
- parseFnt(ResourceLoader.getResourceAsStream(fntFile));
- }
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param fntFile
- * The location of the font defnition file
- * @param image
- * The image to use for the font
- * @param caching
- * True if this font should use display list caching
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String fntFile, Image image, boolean caching)
- throws SlickException {
- fontImage = image;
- displayListCaching = caching;
- parseFnt(ResourceLoader.getResourceAsStream(fntFile));
- }
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param fntFile
- * The location of the font defnition file
- * @param imgFile
- * The location of the font image
- * @param caching
- * True if this font should use display list caching
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String fntFile, String imgFile, boolean caching)
- throws SlickException {
- fontImage = new Image(imgFile);
- displayListCaching = caching;
- parseFnt(ResourceLoader.getResourceAsStream(fntFile));
- }
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param name
- * The name to assign to the font image in the image store
- * @param fntFile
- * The stream of the font defnition file
- * @param imgFile
- * The stream of the font image
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String name, InputStream fntFile, InputStream imgFile)
- throws SlickException {
- fontImage = new Image(imgFile, name, false);
-
- parseFnt(fntFile);
- }
-
- /**
- * Create a new font based on a font definition from AngelCode's tool and
- * the font image generated from the tool.
- *
- * @param name
- * The name to assign to the font image in the image store
- * @param fntFile
- * The stream of the font defnition file
- * @param imgFile
- * The stream of the font image
- * @param caching
- * True if this font should use display list caching
- * @throws SlickException
- * Indicates a failure to load either file
- */
- public AngelCodeFont(String name, InputStream fntFile, InputStream imgFile,
- boolean caching) throws SlickException {
- fontImage = new Image(imgFile, name, false);
-
- displayListCaching = caching;
- parseFnt(fntFile);
- }
-
- /**
- * Parse the font definition file
- *
- * @param fntFile
- * The stream from which the font file can be read
- * @throws SlickException
- */
- private void parseFnt(InputStream fntFile) throws SlickException {
- if (displayListCaching) {
- baseDisplayListID = GL.glGenLists(DISPLAY_LIST_CACHE_SIZE);
- if (baseDisplayListID == 0) displayListCaching = false;
- }
-
- try {
- // now parse the font file
- BufferedReader in = new BufferedReader(new InputStreamReader(
- fntFile));
- String info = in.readLine();
- String common = in.readLine();
- String page = in.readLine();
-
- Map kerning = new HashMap(64);
- List charDefs = new ArrayList(MAX_CHAR);
- int maxChar = 0;
- boolean done = false;
- while (!done) {
- String line = in.readLine();
- if (line == null) {
- done = true;
- } else {
- if (line.startsWith("chars c")) {
- // ignore
- } else if (line.startsWith("char")) {
- CharDef def = parseChar(line);
- if (def != null) {
- maxChar = Math.max(maxChar, def.id);
- charDefs.add(def);
- }
- }
- if (line.startsWith("kernings c")) {
- // ignore
- } else if (line.startsWith("kerning")) {
- StringTokenizer tokens = new StringTokenizer(line, " =");
- tokens.nextToken(); // kerning
- tokens.nextToken(); // first
- short first = Short.parseShort(tokens.nextToken()); // first value
- tokens.nextToken(); // second
- int second = Integer.parseInt(tokens.nextToken()); // second value
- tokens.nextToken(); // offset
- int offset = Integer.parseInt(tokens.nextToken()); // offset value
- List values = (List)kerning.get(new Short(first));
- if (values == null) {
- values = new ArrayList();
- kerning.put(new Short(first), values);
- }
- // Pack the character and kerning offset into a short.
- values.add(new Short((short)((offset << 8) | second)));
- }
- }
- }
-
- chars = new CharDef[maxChar + 1];
- for (Iterator iter = charDefs.iterator(); iter.hasNext();) {
- CharDef def = (CharDef)iter.next();
- chars[def.id] = def;
- }
-
- // Turn each list of kerning values into a short[] and set on the chardef.
- for (Iterator iter = kerning.entrySet().iterator(); iter.hasNext(); ) {
- Entry entry = (Entry)iter.next();
- short first = ((Short)entry.getKey()).shortValue();
- List valueList = (List)entry.getValue();
- short[] valueArray = new short[valueList.size()];
- int i = 0;
- for (Iterator valueIter = valueList.iterator(); valueIter.hasNext(); i++)
- valueArray[i] = ((Short)valueIter.next()).shortValue();
- chars[first].kerning = valueArray;
- }
- } catch (IOException e) {
- Log.error(e);
- throw new SlickException("Failed to parse font file: " + fntFile);
- }
- }
-
- /**
- * Parse a single character line from the definition
- *
- * @param line
- * The line to be parsed
- * @return The character definition from the line
- * @throws SlickException Indicates a given character is not valid in an angel code font
- */
- private CharDef parseChar(String line) throws SlickException {
- CharDef def = new CharDef();
- StringTokenizer tokens = new StringTokenizer(line, " =");
-
- tokens.nextToken(); // char
- tokens.nextToken(); // id
- def.id = Short.parseShort(tokens.nextToken()); // id value
- if (def.id < 0) {
- return null;
- }
- if (def.id > MAX_CHAR) {
- throw new SlickException("Invalid character '" + def.id
- + "': AngelCodeFont does not support characters above " + MAX_CHAR);
- }
-
- tokens.nextToken(); // x
- def.x = Short.parseShort(tokens.nextToken()); // x value
- tokens.nextToken(); // y
- def.y = Short.parseShort(tokens.nextToken()); // y value
- tokens.nextToken(); // width
- def.width = Short.parseShort(tokens.nextToken()); // width value
- tokens.nextToken(); // height
- def.height = Short.parseShort(tokens.nextToken()); // height value
- tokens.nextToken(); // x offset
- def.xoffset = Short.parseShort(tokens.nextToken()); // xoffset value
- tokens.nextToken(); // y offset
- def.yoffset = Short.parseShort(tokens.nextToken()); // yoffset value
- tokens.nextToken(); // xadvance
- def.xadvance = Short.parseShort(tokens.nextToken()); // xadvance
-
- def.init();
-
- if (def.id != ' ') {
- lineHeight = Math.max(def.height + def.yoffset, lineHeight);
- }
-
- return def;
- }
-
- /**
- * @see org.newdawn.slick.Font#drawString(float, float, java.lang.String)
- */
- public void drawString(float x, float y, String text) {
- drawString(x, y, text, Color.white);
- }
-
- /**
- * @see org.newdawn.slick.Font#drawString(float, float, java.lang.String,
- * org.newdawn.slick.Color)
- */
- public void drawString(float x, float y, String text, Color col) {
- drawString(x, y, text, col, 0, text.length() - 1);
- }
-
- /**
- * @see Font#drawString(float, float, String, Color, int, int)
- */
- public void drawString(float x, float y, String text, Color col,
- int startIndex, int endIndex) {
- fontImage.bind();
- col.bind();
-
- GL.glTranslatef(x, y, 0);
- if (displayListCaching && startIndex == 0 && endIndex == text.length() - 1) {
- DisplayList displayList = (DisplayList)displayLists.get(text);
- if (displayList != null) {
- GL.glCallList(displayList.id);
- } else {
- // Compile a new display list.
- displayList = new DisplayList();
- displayList.text = text;
- int displayListCount = displayLists.size();
- if (displayListCount < DISPLAY_LIST_CACHE_SIZE) {
- displayList.id = baseDisplayListID + displayListCount;
- } else {
- displayList.id = eldestDisplayListID;
- displayLists.remove(eldestDisplayList.text);
- }
-
- displayLists.put(text, displayList);
-
- GL.glNewList(displayList.id, SGL.GL_COMPILE_AND_EXECUTE);
- render(text, startIndex, endIndex);
- GL.glEndList();
- }
- } else {
- render(text, startIndex, endIndex);
- }
- GL.glTranslatef(-x, -y, 0);
- }
-
- /**
- * Render based on immediate rendering
- *
- * @param text The text to be rendered
- * @param start The index of the first character in the string to render
- * @param end The index of the last character in the string to render
- */
- private void render(String text, int start, int end) {
- GL.glBegin(SGL.GL_QUADS);
-
- int x = 0, y = 0;
- CharDef lastCharDef = null;
- char[] data = text.toCharArray();
- for (int i = 0; i < data.length; i++) {
- int id = data[i];
- if (id == '\n') {
- x = 0;
- y += getLineHeight();
- continue;
- }
- if (id >= chars.length) {
- continue;
- }
- CharDef charDef = chars[id];
- if (charDef == null) {
- continue;
- }
-
- if (lastCharDef != null) x += lastCharDef.getKerning(id);
- lastCharDef = charDef;
-
- if ((i >= start) && (i <= end)) {
- charDef.draw(x, y);
- }
-
- x += charDef.xadvance;
- }
- GL.glEnd();
- }
-
- /**
- * Returns the distance from the y drawing location to the top most pixel of the specified text.
- *
- * @param text
- * The text that is to be tested
- * @return The yoffset from the y draw location at which text will start
- */
- public int getYOffset(String text) {
- DisplayList displayList = null;
- if (displayListCaching) {
- displayList = (DisplayList)displayLists.get(text);
- if (displayList != null && displayList.yOffset != null) return displayList.yOffset.intValue();
- }
-
- int stopIndex = text.indexOf('\n');
- if (stopIndex == -1) stopIndex = text.length();
-
- int minYOffset = 10000;
- for (int i = 0; i < stopIndex; i++) {
- int id = text.charAt(i);
- CharDef charDef = chars[id];
- if (charDef == null) {
- continue;
- }
- minYOffset = Math.min(charDef.yoffset, minYOffset);
- }
-
- if (displayList != null) displayList.yOffset = new Short((short)minYOffset);
-
- return minYOffset;
- }
-
- /**
- * @see org.newdawn.slick.Font#getHeight(java.lang.String)
- */
- public int getHeight(String text) {
- DisplayList displayList = null;
- if (displayListCaching) {
- displayList = (DisplayList)displayLists.get(text);
- if (displayList != null && displayList.height != null) return displayList.height.intValue();
- }
-
- int lines = 0;
- int maxHeight = 0;
- for (int i = 0; i < text.length(); i++) {
- int id = text.charAt(i);
- if (id == '\n') {
- lines++;
- maxHeight = 0;
- continue;
- }
- // ignore space, it doesn't contribute to height
- if (id == ' ') {
- continue;
- }
- CharDef charDef = chars[id];
- if (charDef == null) {
- continue;
- }
-
- maxHeight = Math.max(charDef.height + charDef.yoffset,
- maxHeight);
- }
-
- maxHeight += lines * getLineHeight();
-
- if (displayList != null) displayList.height = new Short((short)maxHeight);
-
- return maxHeight;
- }
-
- /**
- * @see org.newdawn.slick.Font#getWidth(java.lang.String)
- */
- public int getWidth(String text) {
- DisplayList displayList = null;
- if (displayListCaching) {
- displayList = (DisplayList)displayLists.get(text);
- if (displayList != null && displayList.width != null) return displayList.width.intValue();
- }
-
- int maxWidth = 0;
- int width = 0;
- CharDef lastCharDef = null;
- for (int i = 0, n = text.length(); i < n; i++) {
- int id = text.charAt(i);
- if (id == '\n') {
- width = 0;
- continue;
- }
- if (id >= chars.length) {
- continue;
- }
- CharDef charDef = chars[id];
- if (charDef == null) {
- continue;
- }
-
- if (lastCharDef != null) width += lastCharDef.getKerning(id);
- lastCharDef = charDef;
-
- if (i < n - 1) {
- width += charDef.xadvance;
- } else {
- width += charDef.width;
- }
- maxWidth = Math.max(maxWidth, width);
- }
-
- if (displayList != null) displayList.width = new Short((short)maxWidth);
-
- return maxWidth;
- }
-
- /**
- * The definition of a single character as defined in the AngelCode file
- * format
- *
- * @author kevin
- */
- private class CharDef {
- /** The id of the character */
- public short id;
- /** The x location on the sprite sheet */
- public short x;
- /** The y location on the sprite sheet */
- public short y;
- /** The width of the character image */
- public short width;
- /** The height of the character image */
- public short height;
- /** The amount the x position should be offset when drawing the image */
- public short xoffset;
- /** The amount the y position should be offset when drawing the image */
- public short yoffset;
-
- /** The amount to move the current position after drawing the character */
- public short xadvance;
- /** The image containing the character */
- public Image image;
- /** The display list index for this character */
- public short dlIndex;
- /** The kerning info for this character */
- public short[] kerning;
-
- /**
- * Initialise the image by cutting the right section from the map
- * produced by the AngelCode tool.
- */
- public void init() {
- image = fontImage.getSubImage(x, y, width, height);
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- return "[CharDef id=" + id + " x=" + x + " y=" + y + "]";
- }
-
- /**
- * Draw this character embedded in a image draw
- *
- * @param x
- * The x position at which to draw the text
- * @param y
- * The y position at which to draw the text
- */
- public void draw(float x, float y) {
- image.drawEmbedded(x + xoffset, y + yoffset, width, height);
- }
-
- /**
- * Get the kerning offset between this character and the specified character.
- * @param otherCodePoint The other code point
- * @return the kerning offset
- */
- public int getKerning (int otherCodePoint) {
- if (kerning == null) return 0;
- int low = 0;
- int high = kerning.length - 1;
- while (low <= high) {
- int midIndex = (low + high) >>> 1;
- int value = kerning[midIndex];
- int foundCodePoint = value & 0xff;
- if (foundCodePoint < otherCodePoint)
- low = midIndex + 1;
- else if (foundCodePoint > otherCodePoint)
- high = midIndex - 1;
- else
- return value >> 8;
- }
- return 0;
- }
- }
-
- /**
- * @see org.newdawn.slick.Font#getLineHeight()
- */
- public int getLineHeight() {
- return lineHeight;
- }
-
- /**
- * A descriptor for a single display list
- *
- * @author Nathan Sweet <misc@n4te.com>
- */
- static private class DisplayList {
- /** The if of the distance list */
- int id;
- /** The offset of the line rendered */
- Short yOffset;
- /** The width of the line rendered */
- Short width;
- /** The height of the line rendered */
- Short height;
- /** The text that the display list holds */
- String text;
- }
-}
View
724 poker.front_end.2d/slick_src/org/newdawn/slick/Animation.java
@@ -1,724 +0,0 @@
-package org.newdawn.slick;
-
-import java.util.ArrayList;
-
-import org.lwjgl.Sys;
-import org.newdawn.slick.util.Log;
-
-/**
- * A utility to hold and render animations
- *
- * @author kevin
- * @author DeX (speed updates)
- */
-public class Animation implements Renderable {
- /** The list of frames to render in this animation */
- private ArrayList frames = new ArrayList();
- /** The frame currently being displayed */
- private int currentFrame = -1;
- /** The time the next frame change should take place */
- private long nextChange = 0;
- /** True if the animation is stopped */
- private boolean stopped = false;
- /** The time left til the next frame */
- private long timeLeft;
- /** The current speed of the animation */
- private float speed = 1.0f;
- /** The frame to stop at */
- private int stopAt = -2;
- /** The last time the frame was automagically updated */
- private long lastUpdate;
- /** True if this is the first update */
- private boolean firstUpdate = true;
- /** True if we should auto update the animation - default true */
- private boolean autoUpdate = true;
- /** The direction the animation is running */
- private int direction = 1;
- /** True if the animation in ping ponging back and forth */
- private boolean pingPong;
- /** True if the animation should loop (default) */
- private boolean loop = true;
- /** The spriteSheet backing this animation */
- private SpriteSheet spriteSheet = null;
-
- /**
- * Create an empty animation
- */
- public Animation() {
- this(true);
- }
-
- /**
- * Create a new animation from a set of images
- *
- * @param frames The images for the animation frames
- * @param duration The duration to show each frame
- */
- public Animation(Image[] frames, int duration) {
- this(frames, duration, true);
- }
-
- /**
- * Create a new animation from a set of images
- *
- * @param frames The images for the animation frames
- * @param durations The duration to show each frame
- */
- public Animation(Image[] frames, int[] durations) {
- this(frames, durations, true);
- }
-
- /**
- * Create an empty animation
- *
- * @param autoUpdate True if this animation should automatically update. This means that the
- * current frame will be caculated based on the time between renders
- */
- public Animation(boolean autoUpdate) {
- currentFrame = 0;
- this.autoUpdate = autoUpdate;
- }
-
- /**
- * Create a new animation from a set of images
- *
- * @param frames The images for the animation frames
- * @param duration The duration to show each frame
- * @param autoUpdate True if this animation should automatically update. This means that the
- * current frame will be caculated based on the time between renders
- */
- public Animation(Image[] frames, int duration, boolean autoUpdate) {
- for (int i=0;i<frames.length;i++) {
- addFrame(frames[i], duration);
- }
- currentFrame = 0;
- this.autoUpdate = autoUpdate;
- }
-
- /**
- * Create a new animation from a set of images
- *
- * @param frames The images for the animation frames
- * @param durations The duration to show each frame
- * @param autoUpdate True if this animation should automatically update. This means that the
- * current frame will be caculated based on the time between renders
- */
- public Animation(Image[] frames, int[] durations, boolean autoUpdate) {
- this.autoUpdate = autoUpdate;
- if (frames.length != durations.length) {
- throw new RuntimeException("There must be one duration per frame");
- }
-
- for (int i=0;i<frames.length;i++) {
- addFrame(frames[i], durations[i]);
- }
- currentFrame = 0;
- }
-
- /**
- * Create a new animation based on the sprite from a sheet. It assumed that
- * the sprites are organised on horizontal scan lines and that every sprite
- * in the sheet should be used.
- *
- * @param frames The sprite sheet containing the frames
- * @param duration The duration each frame should be displayed for
- */
- public Animation(SpriteSheet frames, int duration) {
- this(frames, 0,0,frames.getHorizontalCount()-1,frames.getVerticalCount()-1,true,duration,true);
- }
-
- /**
- * Create a new animation based on a selection of sprites from a sheet
- *
- * @param frames The sprite sheet containing the frames
- * @param x1 The x coordinate of the first sprite from the sheet to appear in the animation
- * @param y1 The y coordinate of the first sprite from the sheet to appear in the animation
- * @param x2 The x coordinate of the last sprite from the sheet to appear in the animation
- * @param y2 The y coordinate of the last sprite from the sheet to appear in the animation
- * @param horizontalScan True if the sprites are arranged in hoizontal scan lines. Otherwise
- * vertical is assumed
- * @param duration The duration each frame should be displayed for
- * @param autoUpdate True if this animation should automatically update based on the render times
- */
- public Animation(SpriteSheet frames, int x1, int y1, int x2, int y2, boolean horizontalScan, int duration, boolean autoUpdate) {
- this.autoUpdate = autoUpdate;
-
- if (!horizontalScan) {
- for (int x=x1;x<=x2;x++) {
- for (int y=y1;y<=y2;y++) {
- addFrame(frames.getSprite(x, y), duration);
- }
- }
- } else {
- for (int y=y1;y<=y2;y++) {
- for (int x=x1;x<=x2;x++) {
- addFrame(frames.getSprite(x, y), duration);
- }
- }
- }
- }
-
- /**
- * Creates a new Animation where each frame is a sub-image of <tt>SpriteSheet</tt> ss.
- * @param ss The <tt>SpriteSheet</tt> backing this animation
- * @param frames An array of coordinates of sub-image locations for each frame
- * @param duration The duration each frame should be displayed for
- */
- public Animation(SpriteSheet ss, int[] frames, int[] duration){
- spriteSheet = ss;
- int x = -1;
- int y = -1;
-
- for(int i = 0; i < frames.length/2; i++){
- x = frames[i*2];
- y = frames[i*2 + 1];
- addFrame(duration[i], x, y);
- }
- }
-
- /**
- * Add animation frame to the animation.
- * @param duration The duration to display the frame for
- * @param x The x location of the frame on the <tt>SpriteSheet</tt>
- * @param y The y location of the frame on the <tt>spriteSheet</tt>
- */
- public void addFrame(int duration, int x, int y){
- if (duration == 0) {
- Log.error("Invalid duration: "+duration);
- throw new RuntimeException("Invalid duration: "+duration);
- }
-
- if (frames.isEmpty()) {
- nextChange = (int) (duration / speed);
- }
-
- frames.add(new Frame(duration, x, y));
- currentFrame = 0;
- }
-
- /**
- * Indicate if this animation should automatically update based on the
- * time between renders or if it should need updating via the update()
- * method.
- *
- * @param auto True if this animation should automatically update
- */
- public void setAutoUpdate(boolean auto) {
- this.autoUpdate = auto;
- }
-
- /**
- * Indicate if this animation should ping pong back and forth
- *
- * @param pingPong True if the animation should ping pong
- */
- public void setPingPong(boolean pingPong) {
- this.pingPong = pingPong;
- }
-
- /**
- * Check if this animation has stopped (either explictly or because it's reached its target frame)
- *
- * @see #stopAt
- * @return True if the animation has stopped
- */
- public boolean isStopped() {
- return stopped;
- }
-
- /**
- * Adjust the overall speed of the animation.
- *
- * @param spd The speed to run the animation. Default: 1.0
- */
- public void setSpeed(float spd) {
- if (spd > 0) {
- // Adjust nextChange
- nextChange = (long) (nextChange * speed / spd);
-
- speed = spd;
- }
- }
-
- /**
- * Returns the current speed of the animation.
- *
- * @return The speed this animation is being played back at
- */
- public float getSpeed() {
- return speed;
- }
-
-
- /**
- * Stop the animation
- */
- public void stop() {
- if (frames.size() == 0) {
- return;
- }
- timeLeft = nextChange;
- stopped = true;
- }
-
- /**
- * Start the animation playing again
- */
- public void start() {
- if (!stopped) {
- return;
- }
- if (frames.size() == 0) {
- return;
- }
- stopped = false;
- nextChange = timeLeft;
- }
-
- /**
- * Restart the animation from the beginning
- */
- public void restart() {
- if (frames.size() == 0) {
- return;
- }
- stopped = false;
- currentFrame = 0;
- nextChange = (int) (((Frame) frames.get(0)).duration / speed);
- firstUpdate = true;
- lastUpdate = 0;
- }
-
- /**
- * Add animation frame to the animation
- *
- * @param frame The image to display for the frame
- * @param duration The duration to display the frame for
- */
- public void addFrame(Image frame, int duration) {
- if (duration == 0) {
- Log.error("Invalid duration: "+duration);
- throw new RuntimeException("Invalid duration: "+duration);
- }
-
- if (frames.isEmpty()) {
- nextChange = (int) (duration / speed);
- }
-
- frames.add(new Frame(frame, duration));
- currentFrame = 0;
- }
-
- /**
- * Draw the animation to the screen
- */
- public void draw() {
- draw(0,0);
- }
-
- /**
- * Draw the animation at a specific location
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- */
- public void draw(float x,float y) {
- draw(x,y,getWidth(),getHeight());
- }
-
- /**
- * Draw the animation at a specific location
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- * @param filter The filter to apply
- */
- public void draw(float x,float y, Color filter) {
- draw(x,y,getWidth(),getHeight(), filter);
- }
-
- /**
- * Draw the animation
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- * @param width The width to draw the animation at
- * @param height The height to draw the animation at
- */
- public void draw(float x,float y,float width,float height) {
- draw(x,y,width,height,Color.white);
- }
-
- /**
- * Draw the animation
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- * @param width The width to draw the animation at
- * @param height The height to draw the animation at
- * @param col The colour filter to use
- */
- public void draw(float x,float y,float width,float height, Color col) {
- if (frames.size() == 0) {
- return;
- }
-
- if (autoUpdate) {
- long now = getTime();
- long delta = now - lastUpdate;
- if (firstUpdate) {
- delta = 0;
- firstUpdate = false;
- }
- lastUpdate = now;
- nextFrame(delta);
- }
-
- Frame frame = (Frame) frames.get(currentFrame);
- frame.image.draw(x,y,width,height, col);
- }
-
- /**
- * Render the appropriate frame when the spriteSheet backing this Animation is in use.
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- */
- public void renderInUse(int x, int y){
- if (frames.size() == 0) {
- return;
- }
-
- if (autoUpdate) {
- long now = getTime();
- long delta = now - lastUpdate;
- if (firstUpdate) {
- delta = 0;
- firstUpdate = false;
- }
- lastUpdate = now;
- nextFrame(delta);
- }
-
- Frame frame = (Frame) frames.get(currentFrame);
- spriteSheet.renderInUse(x, y, frame.x, frame.y);
- }
-
- /**
- * Get the width of the current frame
- *
- * @return The width of the current frame
- */
- public int getWidth() {
- return ((Frame) frames.get(currentFrame)).image.getWidth();
- }
-
- /**
- * Get the height of the current frame
- *
- * @return The height of the current frame
- */
- public int getHeight() {
- return ((Frame) frames.get(currentFrame)).image.getHeight();
- }
-
- /**
- * Draw the animation
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- * @param width The width to draw the animation at
- * @param height The height to draw the animation at
- */
- public void drawFlash(float x,float y,float width,float height) {
- drawFlash(x,y,width,height, Color.white);
- }
-
- /**
- * Draw the animation
- *
- * @param x The x position to draw the animation at
- * @param y The y position to draw the animation at
- * @param width The width to draw the animation at
- * @param height The height to draw the animation at
- * @param col The colour for the flash
- */
- public void drawFlash(float x,float y,float width,float height, Color col) {
- if (frames.size() == 0) {
- return;
- }
-
- if (autoUpdate) {
- long now = getTime();
- long delta = now - lastUpdate;
- if (firstUpdate) {
- delta = 0;
- firstUpdate = false;
- }
- lastUpdate = now;
- nextFrame(delta);
- }
-
- Frame frame = (Frame) frames.get(currentFrame);
- frame.image.drawFlash(x,y,width,height,col);
- }
-
- /**
- * Update the animation cycle without draw the image, useful
- * for keeping two animations in sync
- *
- * @deprecated
- */
- public void updateNoDraw() {
- if (autoUpdate) {
- long now = getTime();
- long delta = now - lastUpdate;
- if (firstUpdate) {
- delta = 0;
- firstUpdate = false;
- }
- lastUpdate = now;
- nextFrame(delta);
- }
- }
-
- /**
- * Update the animation, note that this will have odd effects if auto update
- * is also turned on
- *
- * @see #autoUpdate
- * @param delta The amount of time thats passed since last update
- */
- public void update(long delta) {
- nextFrame(delta);
- }
-
- /**
- * Get the index of the current frame
- *
- * @return The index of the current frame
- */
- public int getFrame() {
- return currentFrame;
- }
-
- /**
- * Set the current frame to be rendered
- *
- * @param index The index of the frame to rendered
- */
- public void setCurrentFrame(int index) {
- currentFrame = index;
- }
-
- /**
- * Get the image assocaited with a given frame index
- *
- * @param index The index of the frame image to retrieve
- * @return The image of the specified animation frame
- */
- public Image getImage(int index) {
- Frame frame = (Frame) frames.get(index);
- return frame.image;
- }
-
- /**
- * Get the number of frames that are in the animation
- *
- * @return The number of frames that are in the animation
- */
- public int getFrameCount() {
- return frames.size();
- }
-
- /**
- * Get the image associated with the current animation frame
- *
- * @return The image associated with the current animation frame
- */
- public Image getCurrentFrame() {
- Frame frame = (Frame) frames.get(currentFrame);
- return frame.image;
- }
-
- /**
- * Check if we need to move to the next frame
- *
- * @param delta The amount of time thats passed since last update
- */
- private void nextFrame(long delta) {
- if (stopped) {
- return;
- }
- if (frames.size() == 0) {
- return;
- }
-
- nextChange -= delta;
-
- while (nextChange < 0 && (!stopped)) {
- if (currentFrame == stopAt) {
- stopped = true;
- break;
- }
- if ((currentFrame == frames.size() - 1) && (!loop) && (!pingPong)) {
- stopped = true;
- break;
- }
- currentFrame = (currentFrame + direction) % frames.size();
-
- if (pingPong) {
- if (currentFrame <= 0) {
- currentFrame = 0;
- direction = 1;
- if (!loop) {
- stopped = true;
- break;
- }
- }
- else if (currentFrame >= frames.size()-1) {
- currentFrame = frames.size()-1;
- direction = -1;
- }
- }
- int realDuration = (int) (((Frame) frames.get(currentFrame)).duration / speed);
- nextChange = nextChange + realDuration;
- }
- }
-
- /**
- * Indicate if this animation should loop or stop at the last frame
- *
- * @param loop True if this animation should loop (true = default)
- */
- public void setLooping(boolean loop) {
- this.loop = loop;
- }
-
- /**
- * Get the accurate system time
- *
- * @return The system time in milliseconds
- */
- private long getTime() {
- return (Sys.getTime() * 1000) / Sys.getTimerResolution();
- }
-
- /**
- * Indicate the animation should stop when it reaches the specified
- * frame index (note, not frame number but index in the animation
- *
- * @param frameIndex The index of the frame to stop at
- */
- public void stopAt(int frameIndex) {
- stopAt = frameIndex;
- }
-
- /**
- * Get the duration of a particular frame
- *
- * @param index The index of the given frame
- * @return The duration in (ms) of the given frame
- */
- public int getDuration(int index) {
- return ((Frame) frames.get(index)).duration;
- }
-
- /**
- * Set the duration of the given frame
- *
- * @param index The index of the given frame
- * @param duration The duration in (ms) for the given frame
- */
- public void setDuration(int index, int duration) {
- ((Frame) frames.get(index)).duration = duration;
- }
-
- /**
- * Get the durations of all the frames in this animation
- *
- * @return The durations of all the frames in this animation
- */
- public int[] getDurations() {
- int[] durations = new int[frames.size()];
- for (int i=0;i<frames.size();i++) {
- durations[i] = getDuration(i);
- }
-
- return durations;
- }
-
-
- /**
- * @see java.lang.Object#toString()
- */
- public String toString() {
- String res = "[Animation ("+frames.size()+") ";
- for (int i=0;i<frames.size();i++) {
- Frame frame = (Frame) frames.get(i);
- res += frame.duration+",";
- }
-
- res += "]";
- return res;
- }
-
- /**
- * Create a copy of this animation. Note that the frames
- * are not duplicated but shared with the original
- *
- * @return A copy of this animation
- */
- public Animation copy() {
- Animation copy = new Animation();
-
- copy.spriteSheet = spriteSheet;
- copy.frames = frames;
- copy.autoUpdate = autoUpdate;
- copy.direction = direction;
- copy.loop = loop;
- copy.pingPong = pingPong;
- copy.speed = speed;
-
- return copy;
- }
-
- /**
- * A single frame within the animation
- *
- * @author kevin
- */
- private class Frame {
- /** The image to display for this frame */
- public Image image;
- /** The duration to display the image fro */
- public int duration;
- /** The x location of this frame on a SpriteSheet*/
- public int x = -1;
- /** The y location of this frame on a SpriteSheet*/
- public int y = -1;
-
- /**
- * Create a new animation frame
- *
- * @param image The image to display for the frame
- * @param duration The duration in millisecond to display the image for
- */
- public Frame(Image image, int duration) {
- this.image = image;
- this.duration = duration;
- }
-
- /**
- * Creates a new animation frame with the frames image location on a sprite sheet
- * @param duration The duration in millisecond to display the image for
- * @param x the x location of the frame on the <tt>SpriteSheet</tt>
- * @param y the y location of the frame on the <tt>SpriteSheet</tt>
- */
- public Frame(int duration, int x, int y) {
- this.image = spriteSheet.getSubImage(x, y);
- this.duration = duration;
- this.x = x;
- this.y = y;
- }
- }
-}
View
547 poker.front_end.2d/slick_src/org/newdawn/slick/AppGameContainer.java
@@ -1,547 +0,0 @@
-package org.newdawn.slick;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.lwjgl.BufferUtils;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.Sys;
-import org.lwjgl.input.Cursor;
-import org.lwjgl.input.Mouse;
-import org.lwjgl.openal.AL;
-import org.lwjgl.opengl.Display;
-import org.lwjgl.opengl.DisplayMode;
-import org.lwjgl.opengl.PixelFormat;
-import org.newdawn.slick.openal.SoundStore;
-import org.newdawn.slick.opengl.CursorLoader;
-import org.newdawn.slick.opengl.ImageData;
-import org.newdawn.slick.opengl.ImageIOImageData;
-import org.newdawn.slick.opengl.InternalTextureLoader;
-import org.newdawn.slick.opengl.LoadableImageData;
-import org.newdawn.slick.opengl.TGAImageData;
-import org.newdawn.slick.util.Log;
-import org.newdawn.slick.util.ResourceLoader;
-
-/**
- * A game container that will display the game as an stand alone
- * application.
- *
- * @author kevin
- */
-public class AppGameContainer extends GameContainer {
- static {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- try {
- Display.getDisplayMode();
- } catch (Exception e) {
- Log.error(e);
- }
- return null;
- }});
- }
-
- /** The original display mode before we tampered with things */
- protected DisplayMode originalDisplayMode;
- /** The display mode we're going to try and use */
- protected DisplayMode targetDisplayMode;
- /** True if we should update the game only when the display is visible */
- protected boolean updateOnlyOnVisible = true;
- /** Alpha background supported */
- protected boolean alphaSupport = false;
-
- /**
- * Create a new container wrapping a game
- *
- * @param game The game to be wrapped
- * @throws SlickException Indicates a failure to initialise the display
- */
- public AppGameContainer(Game game) throws SlickException {
- this(game,640,480,false);
- }
-
- /**
- * Create a new container wrapping a game
- *
- * @param game The game to be wrapped
- * @param width The width of the display required
- * @param height The height of the display required
- * @param fullscreen True if we want fullscreen mode
- * @throws SlickException Indicates a failure to initialise the display
- */
- public AppGameContainer(Game game,int width,int height,boolean fullscreen) throws SlickException {
- super(game);
-
- originalDisplayMode = Display.getDisplayMode();
-
- setDisplayMode(width,height,fullscreen);
- }
-
- /**
- * Check if the display created supported alpha in the back buffer
- *
- * @return True if the back buffer supported alpha
- */
- public boolean supportsAlphaInBackBuffer() {
- return alphaSupport;
- }
-
- /**
- * Set the title of the window
- *
- * @param title The title to set on the window
- */
- public void setTitle(String title) {
- Display.setTitle(title);
- }
-
- /**
- * Set the display mode to be used
- *
- * @param width The width of the display required
- * @param height The height of the display required
- * @param fullscreen True if we want fullscreen mode
- * @throws SlickException Indicates a failure to initialise the display
- */
- public void setDisplayMode(int width, int height, boolean fullscreen) throws SlickException {
- if ((this.width == width) && (this.height == height) && (isFullscreen() == fullscreen)) {
- return;
- }
-
- try {
- targetDisplayMode = null;
- if (fullscreen) {
- DisplayMode[] modes = Display.getAvailableDisplayModes();
- int freq = 0;
-
- for (int i=0;i<modes.length;i++) {
- DisplayMode current = modes[i];
-
- if ((current.getWidth() == width) && (current.getHeight() == height)) {
- if ((targetDisplayMode == null) || (current.getFrequency() >= freq)) {
- if ((targetDisplayMode == null) || (current.getBitsPerPixel() > targetDisplayMode.getBitsPerPixel())) {
- targetDisplayMode = current;
- freq = targetDisplayMode.getFrequency();
- }
- }
-
- // if we've found a match for bpp and frequence against the
- // original display mode then it's probably best to go for this one
- // since it's most likely compatible with the monitor
- if ((current.getBitsPerPixel() == originalDisplayMode.getBitsPerPixel()) &&
- (current.getFrequency() == originalDisplayMode.getFrequency())) {
- targetDisplayMode = current;
- break;
- }
- }
- }
- } else {
- targetDisplayMode = new DisplayMode(width,height);
- }
-
- if (targetDisplayMode == null) {
- throw new SlickException("Failed to find value mode: "+width+"x"+height+" fs="+fullscreen);
- }
-
- this.width = width;
- this.height = height;
-
- Display.setDisplayMode(targetDisplayMode);
- Display.setFullscreen(fullscreen);
-
- if (Display.isCreated()) {
- initGL();
- enterOrtho();
- }
-
- if (targetDisplayMode.getBitsPerPixel() == 16) {
- InternalTextureLoader.get().set16BitMode();
- }
- } catch (LWJGLException e) {
- throw new SlickException("Unable to setup mode "+width+"x"+height+" fullscreen="+fullscreen, e);
- }
-
- getDelta();
- }
-
- /**
- * Check if the display is in fullscreen mode
- *
- * @return True if the display is in fullscreen mode
- */
- public boolean isFullscreen() {
- return Display.isFullscreen();
- }
-
- /**
- * Indicate whether we want to be in fullscreen mode. Note that the current
- * display mode must be valid as a fullscreen mode for this to work
- *
- * @param fullscreen True if we want to be in fullscreen mode
- * @throws SlickException Indicates we failed to change the display mode
- */
- public void setFullscreen(boolean fullscreen) throws SlickException {
- if (isFullscreen() == fullscreen) {
- return;
- }
-
- if (!fullscreen) {
- try {
- Display.setFullscreen(fullscreen);
- } catch (LWJGLException e) {
- throw new SlickException("Unable to set fullscreen="+fullscreen, e);
- }
- } else {
- setDisplayMode(width, height, fullscreen);
- }
- getDelta();
- }
-
- /**
- * @see org.newdawn.slick.GameContainer#setMouseCursor(java.lang.String, int, int)
- */
- public void setMouseCursor(String ref, int hotSpotX, int hotSpotY) throws SlickException {
- try {
- Cursor cursor = CursorLoader.get().getCursor(ref, hotSpotX, hotSpotY);
- Mouse.setNativeCursor(cursor);
- } catch (Throwable e) {
- Log.error("Failed to load and apply cursor.", e);
- throw new SlickException("Failed to set mouse cursor", e);
- }
- }
-
- /**
- * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.opengl.ImageData, int, int)
- */
- public void setMouseCursor(ImageData data, int hotSpotX, int hotSpotY) throws SlickException {
- try {
- Cursor cursor = CursorLoader.get().getCursor(data, hotSpotX, hotSpotY);
- Mouse.setNativeCursor(cursor);
- } catch (Throwable e) {
- Log.error("Failed to load and apply cursor.", e);
- throw new SlickException("Failed to set mouse cursor", e);
- }
- }
-
- /**
- * @see org.newdawn.slick.GameContainer#setMouseCursor(org.lwjgl.input.Cursor, int, int)
- */
- public void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException {
- try {
- Mouse.setNativeCursor(cursor);
- } catch (Throwable e) {
- Log.error("Failed to load and apply cursor.", e);
- throw new SlickException("Failed to set mouse cursor", e);
- }
- }
-
- /**
- * Get the closest greater power of 2 to the fold number
- *
- * @param fold The target number
- * @return The power of 2
- */
- private int get2Fold(int fold) {
-