Bug fixes and add Label
This commit is contained in:
parent
60f16efe7f
commit
8272b153ff
12 changed files with 481 additions and 463 deletions
|
@ -2,8 +2,18 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="00f293cb-c755-478c-9b6f-422f827454e0" name="Default" comment="">
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/tiles/PlayerTile.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" afterPath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/ActionGUI.java" />
|
||||
<change type="DELETED" beforePath="$PROJECT_DIR$/src/globalgamejam/gui/Image.java" afterPath="" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/production/Global-Gam-Jam-2017/shaders/main.frag" afterPath="$PROJECT_DIR$/out/production/Global-Gam-Jam-2017/shaders/main.frag" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/res/shaders/main.frag" afterPath="$PROJECT_DIR$/res/shaders/main.frag" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" afterPath="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/gui/GUI.java" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/GUI.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" afterPath="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
|
@ -31,37 +41,61 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Vector3f.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java">
|
||||
<file leaf-file-name="GUILabel.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="206">
|
||||
<caret line="28" column="26" lean-forward="false" selection-start-line="28" selection-start-column="26" selection-end-line="28" selection-end-column="26" />
|
||||
<state relative-caret-position="-1411">
|
||||
<caret line="49" column="55" lean-forward="true" selection-start-line="49" selection-start-column="55" selection-end-line="49" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#465#466#0" expanded="true" />
|
||||
<element signature="e#495#496#0" expanded="true" />
|
||||
<element signature="e#3402#3403#0" expanded="true" />
|
||||
<element signature="e#3417#3418#0" expanded="true" />
|
||||
<element signature="e#4962#4963#0" expanded="true" />
|
||||
<element signature="e#4982#4983#0" expanded="true" />
|
||||
<element signature="e#5303#5304#0" expanded="true" />
|
||||
<element signature="e#5323#5324#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Matrix4f.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<file leaf-file-name="Texture.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="206">
|
||||
<caret line="83" column="0" lean-forward="true" selection-start-line="83" selection-start-column="0" selection-end-line="83" selection-end-column="0" />
|
||||
<folding />
|
||||
<state relative-caret-position="360">
|
||||
<caret line="46" column="21" lean-forward="false" selection-start-line="46" selection-start-column="21" selection-end-line="46" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GUILabel.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java">
|
||||
<file leaf-file-name="Tile.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-167">
|
||||
<caret line="303" column="38" lean-forward="false" selection-start-line="303" selection-start-column="38" selection-end-line="303" selection-end-column="38" />
|
||||
<state relative-caret-position="305">
|
||||
<caret line="67" column="0" lean-forward="true" selection-start-line="67" selection-start-column="0" selection-end-line="67" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#3763#3764#0" expanded="true" />
|
||||
<element signature="e#3778#3779#0" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="MainGame.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="44" column="13" lean-forward="false" selection-start-line="44" selection-start-column="13" selection-end-line="44" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#937#938#0" expanded="true" />
|
||||
<element signature="e#973#974#0" expanded="true" />
|
||||
<element signature="e#1038#1039#0" expanded="true" />
|
||||
<element signature="e#1076#1077#0" expanded="true" />
|
||||
<element signature="e#1242#1243#0" expanded="true" />
|
||||
<element signature="e#1278#1279#0" expanded="true" />
|
||||
<element signature="e#1318#1319#0" expanded="true" />
|
||||
<element signature="e#1352#1353#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -70,17 +104,19 @@
|
|||
<file leaf-file-name="GUI.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="374">
|
||||
<caret line="28" column="60" lean-forward="false" selection-start-line="28" selection-start-column="60" selection-end-line="28" selection-end-column="60" />
|
||||
<state relative-caret-position="697">
|
||||
<caret line="44" column="13" lean-forward="true" selection-start-line="44" selection-start-column="13" selection-end-line="44" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#1299#1300#0" expanded="true" />
|
||||
<element signature="e#1323#1324#0" expanded="true" />
|
||||
<element signature="e#1354#1355#0" expanded="true" />
|
||||
<element signature="e#1380#1381#0" expanded="true" />
|
||||
<element signature="e#1405#1406#0" expanded="true" />
|
||||
<element signature="e#1429#1430#0" expanded="true" />
|
||||
<element signature="e#1460#1461#0" expanded="true" />
|
||||
<element signature="e#1486#1487#0" expanded="true" />
|
||||
<element signature="e#468#469#0" expanded="true" />
|
||||
<element signature="e#504#505#0" expanded="true" />
|
||||
<element signature="e#1648#1649#0" expanded="true" />
|
||||
<element signature="e#1672#1673#0" expanded="true" />
|
||||
<element signature="e#1703#1704#0" expanded="true" />
|
||||
<element signature="e#1729#1730#0" expanded="true" />
|
||||
<element signature="e#1754#1755#0" expanded="true" />
|
||||
<element signature="e#1778#1779#0" expanded="true" />
|
||||
<element signature="e#1809#1810#0" expanded="true" />
|
||||
<element signature="e#1835#1836#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -89,7 +125,7 @@
|
|||
<file leaf-file-name="Input.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/input/Input.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-610">
|
||||
<state relative-caret-position="-137">
|
||||
<caret line="130" column="26" lean-forward="true" selection-start-line="130" selection-start-column="26" selection-end-line="130" selection-end-column="26" />
|
||||
<folding />
|
||||
</state>
|
||||
|
@ -99,8 +135,8 @@
|
|||
<file leaf-file-name="DisplayManager.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="212">
|
||||
<caret line="21" column="65" lean-forward="false" selection-start-line="21" selection-start-column="65" selection-end-line="21" selection-end-column="65" />
|
||||
<state relative-caret-position="312">
|
||||
<caret line="31" column="56" lean-forward="false" selection-start-line="31" selection-start-column="56" selection-end-line="31" selection-end-column="56" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -110,17 +146,17 @@
|
|||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="81" lean-forward="true" selection-start-line="9" selection-start-column="81" selection-end-line="9" selection-end-column="81" />
|
||||
<caret line="9" column="49" lean-forward="true" selection-start-line="9" selection-start-column="49" selection-end-line="9" selection-end-column="49" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Image.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/Image.java">
|
||||
<file leaf-file-name="ActionGUI.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/ActionGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="25" />
|
||||
<state relative-caret-position="391">
|
||||
<caret line="25" column="0" lean-forward="true" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -131,8 +167,8 @@
|
|||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
<option value="Interface" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -163,7 +199,6 @@
|
|||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Quaternion.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector2f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector4f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Tile.java" />
|
||||
<option value="$PROJECT_DIR$/../BasicLighting-master/src/Main.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java" />
|
||||
|
@ -171,23 +206,25 @@
|
|||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Camera.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/game/Game.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/FBOTile.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/fbo.vert" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/fbo.frag" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Shaders.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/Main.java" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/main.frag" />
|
||||
<option value="$PROJECT_DIR$/.gitignore" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/Label.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/GUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/input/Input.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/main.frag" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/ActionGUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/GUI.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/Texture.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/game/MainGame.java" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -242,6 +279,28 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="globalgamejam" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="tiles" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
|
@ -330,6 +389,28 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="globalgamejam" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="game" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
|
@ -352,6 +433,38 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="res" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="Global-Gam-Jam-2017" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="res" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="shaders" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
|
@ -594,16 +707,16 @@
|
|||
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33258426" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
|
@ -633,14 +746,6 @@
|
|||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="340">
|
||||
<caret line="22" column="27" lean-forward="true" selection-start-line="22" selection-start-column="27" selection-end-line="22" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/.gitignore">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
|
@ -710,18 +815,6 @@
|
|||
<caret line="66" column="5" lean-forward="true" selection-start-line="66" selection-start-column="5" selection-end-line="66" selection-end-column="5" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#3194#3195#0" expanded="true" />
|
||||
<element signature="e#3225#3226#0" expanded="true" />
|
||||
<element signature="e#3259#3260#0" expanded="true" />
|
||||
<element signature="e#3287#3288#0" expanded="true" />
|
||||
<element signature="e#3321#3322#0" expanded="true" />
|
||||
<element signature="e#3352#3353#0" expanded="true" />
|
||||
<element signature="e#3402#3403#0" expanded="true" />
|
||||
<element signature="e#3442#3443#0" expanded="true" />
|
||||
<element signature="e#3486#3487#0" expanded="true" />
|
||||
<element signature="e#3520#3521#0" expanded="true" />
|
||||
<element signature="e#3567#3568#0" expanded="true" />
|
||||
<element signature="e#3607#3608#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -778,9 +871,7 @@
|
|||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="85">
|
||||
<caret line="14" column="3" lean-forward="false" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -863,16 +954,6 @@
|
|||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/FBOTile.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="359">
|
||||
<caret line="84" column="41" lean-forward="false" selection-start-line="84" selection-start-column="8" selection-end-line="84" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Shaders.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="731">
|
||||
|
@ -916,22 +997,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="578">
|
||||
<caret line="38" column="24" lean-forward="false" selection-start-line="38" selection-start-column="24" selection-end-line="38" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="86" lean-forward="false" selection-start-line="9" selection-start-column="86" selection-end-line="9" selection-end-column="86" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/FrameBufferObject.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="646">
|
||||
|
@ -959,28 +1024,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1190">
|
||||
<caret line="14" column="3" lean-forward="true" selection-start-line="14" selection-start-column="3" selection-end-line="14" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#3194#3195#0" expanded="true" />
|
||||
<element signature="e#3225#3226#0" expanded="true" />
|
||||
<element signature="e#3259#3260#0" expanded="true" />
|
||||
<element signature="e#3287#3288#0" expanded="true" />
|
||||
<element signature="e#3321#3322#0" expanded="true" />
|
||||
<element signature="e#3352#3353#0" expanded="true" />
|
||||
<element signature="e#3402#3403#0" expanded="true" />
|
||||
<element signature="e#3442#3443#0" expanded="true" />
|
||||
<element signature="e#3486#3487#0" expanded="true" />
|
||||
<element signature="e#3520#3521#0" expanded="true" />
|
||||
<element signature="e#3567#3568#0" expanded="true" />
|
||||
<element signature="e#3607#3608#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="206">
|
||||
|
@ -992,18 +1035,26 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/Image.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="51">
|
||||
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="25" />
|
||||
<state relative-caret-position="257">
|
||||
<caret line="86" column="22" lean-forward="true" selection-start-line="86" selection-start-column="22" selection-end-line="86" selection-end-column="22" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="212">
|
||||
<caret line="21" column="65" lean-forward="false" selection-start-line="21" selection-start-column="65" selection-end-line="21" selection-end-column="65" />
|
||||
<state relative-caret-position="238">
|
||||
<caret line="14" column="14" lean-forward="false" selection-start-line="14" selection-start-column="14" selection-end-line="14" selection-end-column="14" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/Image.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-732">
|
||||
<caret line="3" column="0" lean-forward="false" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="25" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -1018,55 +1069,106 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="81" lean-forward="true" selection-start-line="9" selection-start-column="81" selection-end-line="9" selection-end-column="81" />
|
||||
<state relative-caret-position="312">
|
||||
<caret line="31" column="56" lean-forward="false" selection-start-line="31" selection-start-column="56" selection-end-line="31" selection-end-column="56" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-167">
|
||||
<caret line="303" column="38" lean-forward="false" selection-start-line="303" selection-start-column="38" selection-end-line="303" selection-end-column="38" />
|
||||
<folding>
|
||||
<element signature="e#3763#3764#0" expanded="true" />
|
||||
<element signature="e#3778#3779#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/input/Input.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-610">
|
||||
<state relative-caret-position="-137">
|
||||
<caret line="130" column="26" lean-forward="true" selection-start-line="130" selection-start-column="26" selection-end-line="130" selection-end-column="26" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUI.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="374">
|
||||
<caret line="28" column="60" lean-forward="false" selection-start-line="28" selection-start-column="60" selection-end-line="28" selection-end-column="60" />
|
||||
<state relative-caret-position="153">
|
||||
<caret line="9" column="49" lean-forward="true" selection-start-line="9" selection-start-column="49" selection-end-line="9" selection-end-column="49" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/ActionGUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="391">
|
||||
<caret line="25" column="0" lean-forward="true" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/Texture.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="360">
|
||||
<caret line="46" column="21" lean-forward="false" selection-start-line="46" selection-start-column="21" selection-end-line="46" selection-end-column="21" />
|
||||
<folding>
|
||||
<element signature="e#1299#1300#0" expanded="true" />
|
||||
<element signature="e#1323#1324#0" expanded="true" />
|
||||
<element signature="e#1354#1355#0" expanded="true" />
|
||||
<element signature="e#1380#1381#0" expanded="true" />
|
||||
<element signature="e#1405#1406#0" expanded="true" />
|
||||
<element signature="e#1429#1430#0" expanded="true" />
|
||||
<element signature="e#1460#1461#0" expanded="true" />
|
||||
<element signature="e#1486#1487#0" expanded="true" />
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="206">
|
||||
<caret line="83" column="0" lean-forward="true" selection-start-line="83" selection-start-column="0" selection-end-line="83" selection-end-column="0" />
|
||||
<folding />
|
||||
<state relative-caret-position="305">
|
||||
<caret line="67" column="0" lean-forward="true" selection-start-line="67" selection-start-column="0" selection-end-line="67" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUI.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="697">
|
||||
<caret line="44" column="13" lean-forward="true" selection-start-line="44" selection-start-column="13" selection-end-line="44" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#468#469#0" expanded="true" />
|
||||
<element signature="e#504#505#0" expanded="true" />
|
||||
<element signature="e#1648#1649#0" expanded="true" />
|
||||
<element signature="e#1672#1673#0" expanded="true" />
|
||||
<element signature="e#1703#1704#0" expanded="true" />
|
||||
<element signature="e#1729#1730#0" expanded="true" />
|
||||
<element signature="e#1754#1755#0" expanded="true" />
|
||||
<element signature="e#1778#1779#0" expanded="true" />
|
||||
<element signature="e#1809#1810#0" expanded="true" />
|
||||
<element signature="e#1835#1836#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-1411">
|
||||
<caret line="49" column="55" lean-forward="true" selection-start-line="49" selection-start-column="55" selection-end-line="49" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#3402#3403#0" expanded="true" />
|
||||
<element signature="e#3417#3418#0" expanded="true" />
|
||||
<element signature="e#4962#4963#0" expanded="true" />
|
||||
<element signature="e#4982#4983#0" expanded="true" />
|
||||
<element signature="e#5303#5304#0" expanded="true" />
|
||||
<element signature="e#5323#5324#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/game/MainGame.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="289">
|
||||
<caret line="44" column="13" lean-forward="false" selection-start-line="44" selection-start-column="13" selection-end-line="44" selection-end-column="13" />
|
||||
<folding>
|
||||
<element signature="e#937#938#0" expanded="true" />
|
||||
<element signature="e#973#974#0" expanded="true" />
|
||||
<element signature="e#1038#1039#0" expanded="true" />
|
||||
<element signature="e#1076#1077#0" expanded="true" />
|
||||
<element signature="e#1242#1243#0" expanded="true" />
|
||||
<element signature="e#1278#1279#0" expanded="true" />
|
||||
<element signature="e#1318#1319#0" expanded="true" />
|
||||
<element signature="e#1352#1353#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
|
|
@ -6,9 +6,11 @@ uniform vec4 color;
|
|||
in vec2 fragTexCoord;
|
||||
in vec3 fragVert;
|
||||
|
||||
out vec4 finalColor;
|
||||
|
||||
//layout(location = 0) out vec4 finalColor;
|
||||
// https://learnopengl.com/#!Lighting/Multiple-lights pour le lighing en cas de besoin
|
||||
|
||||
void main() {
|
||||
gl_FragData[0] = texture(materialTex, fragTexCoord) * color;
|
||||
finalColor = texture(materialTex, fragTexCoord) * color;
|
||||
}
|
|
@ -6,9 +6,11 @@ uniform vec4 color;
|
|||
in vec2 fragTexCoord;
|
||||
in vec3 fragVert;
|
||||
|
||||
out vec4 finalColor;
|
||||
|
||||
//layout(location = 0) out vec4 finalColor;
|
||||
// https://learnopengl.com/#!Lighting/Multiple-lights pour le lighing en cas de besoin
|
||||
|
||||
void main() {
|
||||
gl_FragData[0] = texture(materialTex, fragTexCoord) * color;
|
||||
finalColor = texture(materialTex, fragTexCoord) * color;
|
||||
}
|
|
@ -1,9 +1,15 @@
|
|||
package globalgamejam.game;
|
||||
|
||||
import globalgamejam.gui.ActionGUI;
|
||||
import globalgamejam.gui.GUI;
|
||||
import globalgamejam.gui.GUILabel;
|
||||
import globalgamejam.gui.IActionGUI;
|
||||
import globalgamejam.input.Input;
|
||||
import globalgamejam.render.*;
|
||||
import globalgamejam.tiles.TestTile;
|
||||
import globalgamejam.tiles.Tile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
@ -12,43 +18,58 @@ import java.util.ArrayList;
|
|||
public class MainGame extends Game{
|
||||
|
||||
private ArrayList<Tile> tiles;
|
||||
private FrameBufferObject fbo;
|
||||
private ArrayList<GUI> guis;
|
||||
private GUILabel label;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
fbo = new FrameBufferObject();
|
||||
tiles = new ArrayList<Tile>();
|
||||
guis = new ArrayList<GUI>();
|
||||
TestTile t = new TestTile();
|
||||
t.getTransform().translate(100,100,0);
|
||||
t.getTransform().scale(10,10,0);
|
||||
tiles.add(t);
|
||||
label = new GUILabel("Test");
|
||||
label.setX(10);
|
||||
label.setY(10);
|
||||
label.setAction(new ActionGUI() {
|
||||
@Override
|
||||
public void enter(float mouseX, float mouseY) {
|
||||
label.setColor(Color.RED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(float mouseX, float mouseY) {
|
||||
label.setColor(Color.WHITE);
|
||||
}
|
||||
});
|
||||
guis.add(label);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
Camera.transform();
|
||||
for(GUI g : guis)g.update();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render2D() {
|
||||
fbo.startRenderToFBO();
|
||||
for(Tile t : tiles)t.render();
|
||||
fbo.stopRenderToFBO();
|
||||
|
||||
fbo.renderFBO();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void renderGUI() {
|
||||
|
||||
for(GUI g : guis)g.render();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
fbo.destroy();
|
||||
tiles.clear();
|
||||
guis.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
33
src/globalgamejam/gui/ActionGUI.java
Normal file
33
src/globalgamejam/gui/ActionGUI.java
Normal file
|
@ -0,0 +1,33 @@
|
|||
package globalgamejam.gui;
|
||||
|
||||
/**
|
||||
* Created by trexr on 20/01/2017.
|
||||
*/
|
||||
public class ActionGUI implements IActionGUI{
|
||||
|
||||
|
||||
@Override
|
||||
public void enter(float mouseX, float mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(float mouseX, float mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void move(float mouseX, float mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hover(float mouseX, float mouseY) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clicked(float mouseX, float mouseY, int buttonKey, int buttonState) {
|
||||
|
||||
}
|
||||
}
|
|
@ -20,10 +20,16 @@ public abstract class GUI {
|
|||
this.height = 0;
|
||||
}
|
||||
|
||||
public void setAction(IActionGUI action){
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public void update(){
|
||||
float mouseX = Input.getMousePosition().x;
|
||||
float mouseY = Input.getMousePosition().y;
|
||||
if(mouseX >= this.x && mouseX <= this.x && mouseY >= this.y && mouseY <= this.y){
|
||||
float dMouseX = Input.getDMouse().x;
|
||||
float dMouseY = Input.getDMouse().y;
|
||||
if(mouseX >= this.x && mouseX <= this.x + this.width && mouseY >= this.y && mouseY <= this.y + this.height){
|
||||
for(int i = 0;i < Input.NBRE_BUTTON;i++){
|
||||
if(Input.isButton(i)){
|
||||
action.clicked(mouseX,mouseY,i,Input.getButtonState(i));
|
||||
|
@ -32,18 +38,22 @@ public abstract class GUI {
|
|||
if(mouseInGUI == 0){
|
||||
mouseInGUI = 1;
|
||||
action.enter(mouseX,mouseY);
|
||||
}else if(mouseInGUI == 1 && mouseInGUI == 2){
|
||||
}else if(mouseInGUI == 1 || mouseInGUI == 2){
|
||||
mouseInGUI = 2;
|
||||
action.move(mouseX,mouseY);
|
||||
action.hover(mouseX,mouseY);
|
||||
if(dMouseX != 0 || dMouseY != 0)action.move(mouseX,mouseY);
|
||||
}
|
||||
}else{
|
||||
if(mouseInGUI == 1 && mouseInGUI == 2){
|
||||
if(mouseInGUI == 1 || mouseInGUI == 2){
|
||||
mouseInGUI = 0;
|
||||
action.leave(mouseX,mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void render();
|
||||
public abstract void destroy();
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
|
|
@ -7,9 +7,16 @@ import java.awt.FontMetrics;
|
|||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import globalgamejam.math.Color4f;
|
||||
import globalgamejam.math.Matrix4f;
|
||||
import globalgamejam.render.Camera;
|
||||
import globalgamejam.render.DisplayManager;
|
||||
import globalgamejam.render.Shaders;
|
||||
import globalgamejam.render.Texture;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
/**
|
||||
* usefull to print 2D text in openGL LWJGL application
|
||||
|
@ -17,14 +24,13 @@ import org.lwjgl.opengl.GL12;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class GUILabel extends GUI {
|
||||
|
||||
private static final int BYTES_PER_PIXEL = 4;//3 for RGB, 4 for RGBA
|
||||
|
||||
private Image label;
|
||||
private Texture texture;
|
||||
private String text;
|
||||
private Color color;
|
||||
private int size;
|
||||
private String font;
|
||||
private int vbo,numberOfVertices;
|
||||
|
||||
/**
|
||||
* Full constructor of a Label
|
||||
|
@ -37,67 +43,51 @@ public class GUILabel extends GUI {
|
|||
*/
|
||||
public GUILabel(String text, int xC, int yC, Color color, String font, int size){
|
||||
super(xC,yC);
|
||||
this.text = text;
|
||||
this.color = color;
|
||||
this.size = size;
|
||||
this.font = font;
|
||||
|
||||
Font f_font = new Font(font, Font.PLAIN, size);
|
||||
|
||||
// to get the width of the text
|
||||
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
FontMetrics fm = img.getGraphics().getFontMetrics(f_font);
|
||||
|
||||
super.width = fm.stringWidth(this.text);
|
||||
super.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(super.width, this.height, BufferedImage.TYPE_INT_ARGB);
|
||||
// makeTransparent(image);
|
||||
|
||||
Graphics g = image.getGraphics();
|
||||
g.setFont(f_font);
|
||||
g.setColor(this.color);
|
||||
g.drawString(this.text, 0, size);
|
||||
g.dispose();
|
||||
|
||||
int[] pixels = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
|
||||
|
||||
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL); //4 for RGBA, 3 for RGB
|
||||
|
||||
for(int y = 0; y < image.getHeight(); y++){
|
||||
for(int x = 0; x < image.getWidth(); x++){
|
||||
int pixel = pixels[y * image.getWidth() + x];
|
||||
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
|
||||
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
|
||||
buffer.put((byte) (pixel & 0xFF)); // Blue component
|
||||
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
|
||||
}
|
||||
}
|
||||
|
||||
buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS
|
||||
|
||||
// You now have a ByteBuffer filled with the color data of each pixel.
|
||||
// Now just create a texture ID and bind it. Then you can load it using
|
||||
// whatever OpenGL method you want, for example:
|
||||
|
||||
int textureID = glGenTextures(); //Generate texture ID
|
||||
glBindTexture(GL_TEXTURE_2D, textureID); //Bind texture ID
|
||||
|
||||
//Setup wrap mode
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
|
||||
//Setup texture scaling filtering
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
//Send texel data to OpenGL
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
this.label = new Image(xC, yC, image.getWidth(), image.getHeight(), textureID);
|
||||
this.color = color;
|
||||
this.text = text;
|
||||
this.size = size;
|
||||
if(this.texture != null)this.texture.destroy();
|
||||
this.texture = Texture.loadFont(text,color,font,size);
|
||||
super.width = this.texture.width;
|
||||
super.height = this.texture.height;
|
||||
this.vbo = GL15.glGenBuffers();
|
||||
float[] a = new float[]{
|
||||
0,0, 0.0f,0.0f,
|
||||
this.texture.width,0, 1.0f,0.0f,
|
||||
this.texture.width,this.texture.height, 1.0f,1.0f,
|
||||
0,this.texture.height, 0.0f,1.0f
|
||||
};
|
||||
FloatBuffer buff = BufferUtils.createFloatBuffer(a.length);
|
||||
buff.put(a).flip();
|
||||
this.numberOfVertices = a.length/(2+2);
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, this.vbo);
|
||||
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buff, GL15.GL_STATIC_DRAW);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void render(){
|
||||
Shaders.MAIN_SHADERS.bind();
|
||||
Shaders.MAIN_SHADERS.uniform("camera", Camera.matrix);
|
||||
Matrix4f transform = new Matrix4f();
|
||||
transform.translate(super.x,super.y,0);
|
||||
Shaders.MAIN_SHADERS.uniform("transform", transform);
|
||||
Shaders.MAIN_SHADERS.uniform("projection", DisplayManager.projection);
|
||||
Shaders.MAIN_SHADERS.uniform("color", Color4f.WHITE);
|
||||
|
||||
texture.bind();
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, this.vbo);
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);
|
||||
|
||||
GL11.glDrawArrays(GL11.GL_QUADS, 0, numberOfVertices);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
texture.unbind();
|
||||
Shaders.MAIN_SHADERS.unbind();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,63 +120,8 @@ public class GUILabel extends GUI {
|
|||
*/
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
|
||||
Font f_font = new Font(font, Font.PLAIN, size);
|
||||
|
||||
// to get the width of the text
|
||||
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
FontMetrics fm = img.getGraphics().getFontMetrics(f_font);
|
||||
|
||||
super.width = fm.stringWidth(this.text);
|
||||
super.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(super.width, super.height, BufferedImage.TYPE_INT_ARGB);
|
||||
// makeTransparent(image);
|
||||
|
||||
Graphics g = image.getGraphics();
|
||||
g.setFont(f_font);
|
||||
g.setColor(this.color);
|
||||
g.drawString(this.text, 0, size);
|
||||
g.dispose();
|
||||
|
||||
int[] pixels = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
|
||||
|
||||
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL); //4 for RGBA, 3 for RGB
|
||||
|
||||
for(int y = 0; y < image.getHeight(); y++){
|
||||
for(int x = 0; x < image.getWidth(); x++){
|
||||
int pixel = pixels[y * image.getWidth() + x];
|
||||
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
|
||||
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
|
||||
buffer.put((byte) (pixel & 0xFF)); // Blue component
|
||||
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
|
||||
}
|
||||
}
|
||||
|
||||
buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS
|
||||
|
||||
// You now have a ByteBuffer filled with the color data of each pixel.
|
||||
// Now just create a texture ID and bind it. Then you can load it using
|
||||
// whatever OpenGL method you want, for example:
|
||||
|
||||
int textureID = glGenTextures(); //Generate texture ID
|
||||
glBindTexture(GL_TEXTURE_2D, textureID); //Bind texture ID
|
||||
|
||||
//Setup wrap mode
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
|
||||
//Setup texture scaling filtering
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
//Send texel data to OpenGL
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
this.label = new Image(this.x, this.y, image.getWidth(), image.getHeight(), textureID);
|
||||
if(this.texture != null)this.texture.destroy();
|
||||
this.texture = Texture.loadFont(text,color,font,size);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -203,64 +138,11 @@ public class GUILabel extends GUI {
|
|||
*/
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
|
||||
Font f_font = new Font(font, Font.PLAIN, size);
|
||||
|
||||
// to get the width of the text
|
||||
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
FontMetrics fm = img.getGraphics().getFontMetrics(f_font);
|
||||
|
||||
super.width = fm.stringWidth(this.text);
|
||||
super.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(super.width, super.height, BufferedImage.TYPE_INT_ARGB);
|
||||
// makeTransparent(image);
|
||||
|
||||
Graphics g = image.getGraphics();
|
||||
g.setFont(f_font);
|
||||
g.setColor(this.color);
|
||||
g.drawString(this.text, 0, size);
|
||||
g.dispose();
|
||||
|
||||
int[] pixels = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
|
||||
|
||||
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL); //4 for RGBA, 3 for RGB
|
||||
|
||||
for(int y = 0; y < image.getHeight(); y++){
|
||||
for(int x = 0; x < image.getWidth(); x++){
|
||||
int pixel = pixels[y * image.getWidth() + x];
|
||||
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
|
||||
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
|
||||
buffer.put((byte) (pixel & 0xFF)); // Blue component
|
||||
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
|
||||
}
|
||||
}
|
||||
|
||||
buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS
|
||||
|
||||
// You now have a ByteBuffer filled with the color data of each pixel.
|
||||
// Now just create a texture ID and bind it. Then you can load it using
|
||||
// whatever OpenGL method you want, for example:
|
||||
|
||||
int textureID = glGenTextures(); //Generate texture ID
|
||||
glBindTexture(GL_TEXTURE_2D, textureID); //Bind texture ID
|
||||
|
||||
//Setup wrap mode
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
|
||||
//Setup texture scaling filtering
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
//Send texel data to OpenGL
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
this.label = new Image(this.x, this.y, image.getWidth(), image.getHeight(), textureID);
|
||||
if(this.texture != null)this.texture.destroy();
|
||||
this.texture = Texture.loadFont(text,color,font,size);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return the x coordonnate of the Label (upper left corner)
|
||||
|
@ -276,7 +158,6 @@ public class GUILabel extends GUI {
|
|||
*/
|
||||
public void setX(int x) {
|
||||
super.setX(x);
|
||||
label.setX(x);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,7 +174,6 @@ public class GUILabel extends GUI {
|
|||
*/
|
||||
public void setY(int y) {
|
||||
super.setY(y);
|
||||
label.setY(y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -306,14 +186,6 @@ public class GUILabel extends GUI {
|
|||
this.setY(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Image of the Label
|
||||
* @return label (Image) : the Image of the Label
|
||||
*/
|
||||
public Image getLabel(){
|
||||
return this.label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the witdh of the Label
|
||||
* @return witdh (int) : the width
|
||||
|
@ -329,6 +201,11 @@ public class GUILabel extends GUI {
|
|||
public int getHeight() {
|
||||
return super.height;
|
||||
}
|
||||
|
||||
public void destroy(){
|
||||
GL15.glDeleteBuffers(vbo);
|
||||
texture.destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* make the image transparent
|
||||
|
|
|
@ -7,5 +7,6 @@ public interface IActionGUI {
|
|||
public void enter(float mouseX,float mouseY);
|
||||
public void leave(float mouseX,float mouseY);
|
||||
public void move(float mouseX,float mouseY);
|
||||
public void hover(float mouseX,float mouseY);
|
||||
public void clicked(float mouseX,float mouseY,int buttonKey,int buttonState);
|
||||
}
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
package globalgamejam.gui;
|
||||
|
||||
public class Image {
|
||||
protected float x, y;
|
||||
protected float width, height;
|
||||
protected int angle;
|
||||
protected int textureID;
|
||||
|
||||
public Image(float x, float y, float width, float height, int textureID) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.textureID = textureID;
|
||||
}
|
||||
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param width the width to set
|
||||
*/
|
||||
public void setWidth(float width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param height the height to set
|
||||
*/
|
||||
public void setHeight(float height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getTextureID() {
|
||||
return textureID;
|
||||
}
|
||||
|
||||
/**
|
||||
* IT DOESN'T WORKS
|
||||
* Rotate the image in the counter-clock wise of the specified angle in degrees
|
||||
* @param rotationAngle (int) : the angle to rotate in degrees
|
||||
*/
|
||||
public void rotate(int rotationAngle){
|
||||
this.angle += rotationAngle;
|
||||
this.angle = this.angle % 360;
|
||||
}
|
||||
|
||||
/**
|
||||
* IT DOESN'T WORKS
|
||||
* Set the angle of the Image
|
||||
* @param angle (int) : the angle, between -360 and +360 degrees
|
||||
*/
|
||||
public void rotateTo(int angle){
|
||||
this.angle = angle;
|
||||
this.angle = this.angle % 360;
|
||||
}
|
||||
|
||||
/**
|
||||
* IT DOESN'T WORKS
|
||||
* Return the actuel angle
|
||||
* @return angle (int) : the actual angle
|
||||
*/
|
||||
public int getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public void setPosition(float x, float y){
|
||||
this.setX(x);
|
||||
this.setY(y);
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ public class DisplayManager {
|
|||
public static void preRenderGUI(){
|
||||
projection.loadIdentity();
|
||||
//Permet de centrer la camera au centre de l'ecran
|
||||
projection.Ortho2D(0, Main.WIDTH, 0, Main.HEIGHT, -1, 1);
|
||||
projection.Ortho2D(0, Main.WIDTH, Main.HEIGHT, 0, -1, 1);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_BLEND);
|
||||
|
|
|
@ -2,6 +2,7 @@ package globalgamejam.render;
|
|||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL12.*;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.image.*;
|
||||
import java.io.*;
|
||||
import java.nio.*;
|
||||
|
@ -9,20 +10,82 @@ import java.nio.*;
|
|||
import javax.imageio.*;
|
||||
|
||||
import org.lwjgl.*;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
/**
|
||||
* Class created by MrDev023 (Florian RICHER) on 14/01/2017
|
||||
*/
|
||||
public class Texture {
|
||||
|
||||
int width, height;
|
||||
private static final int BYTES_PER_PIXEL = 4;//3 for RGB, 4 for RGBA
|
||||
public int width, height;
|
||||
int id;
|
||||
|
||||
public Texture(int width,int height,int id){
|
||||
System.out.println("Texture loaded ! " + width + "x" + height + " id:" + id);
|
||||
this.id = id;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public static Texture loadFont(String text, Color color, String font, int size){
|
||||
Font f_font = new Font(font, Font.PLAIN, size);
|
||||
|
||||
// to get the width of the text
|
||||
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
|
||||
FontMetrics fm = img.getGraphics().getFontMetrics(f_font);
|
||||
|
||||
int width = fm.stringWidth(text);
|
||||
int height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
||||
// makeTransparent(image);
|
||||
|
||||
Graphics g = image.getGraphics();
|
||||
g.setFont(f_font);
|
||||
g.setColor(color);
|
||||
g.drawString(text, 0, size);
|
||||
g.dispose();
|
||||
|
||||
int[] pixels = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
|
||||
|
||||
ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * BYTES_PER_PIXEL); //4 for RGBA, 3 for RGB
|
||||
|
||||
for(int y = 0; y < image.getHeight(); y++){
|
||||
for(int x = 0; x < image.getWidth(); x++){
|
||||
int pixel = pixels[y * image.getWidth() + x];
|
||||
buffer.put((byte) ((pixel >> 16) & 0xFF)); // Red component
|
||||
buffer.put((byte) ((pixel >> 8) & 0xFF)); // Green component
|
||||
buffer.put((byte) (pixel & 0xFF)); // Blue component
|
||||
buffer.put((byte) ((pixel >> 24) & 0xFF)); // Alpha component. Only for RGBA
|
||||
}
|
||||
}
|
||||
|
||||
buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS
|
||||
|
||||
// You now have a ByteBuffer filled with the color data of each pixel.
|
||||
// Now just create a texture ID and bind it. Then you can load it using
|
||||
// whatever OpenGL method you want, for example:
|
||||
|
||||
int textureID = glGenTextures(); //Generate texture ID
|
||||
glBindTexture(GL_TEXTURE_2D, textureID); //Bind texture ID
|
||||
|
||||
//Setup wrap mode
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
|
||||
|
||||
//Setup texture scaling filtering
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
//Send texel data to OpenGL
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
return new Texture(image.getWidth(),image.getHeight(),textureID);
|
||||
}
|
||||
|
||||
public static Texture loadTexture(String path){
|
||||
try {
|
||||
|
@ -60,8 +123,6 @@ public class Texture {
|
|||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
System.out.println("Texture loaded ! " + width + "x" + height + " id:" + id);
|
||||
|
||||
return new Texture(width, height, id);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -82,6 +143,7 @@ public class Texture {
|
|||
}
|
||||
|
||||
public void bind(){
|
||||
if(!glIsEnabled(GL_TEXTURE_2D))glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, id);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,13 +44,6 @@ public abstract class Tile {
|
|||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
|
@ -62,10 +55,17 @@ public abstract class Tile {
|
|||
Shaders.MAIN_SHADERS.uniform("projection", DisplayManager.projection);
|
||||
Shaders.MAIN_SHADERS.uniform("color", this.color);
|
||||
|
||||
GL13.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
// GL13.glActiveTexture(GL13.GL_TEXTURE0);
|
||||
texture.bind();
|
||||
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vert"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vert"), 2, GL11.GL_FLOAT, false, (2+2)*4, 0);
|
||||
|
||||
GL20.glEnableVertexAttribArray(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"));
|
||||
GL20.glVertexAttribPointer(Shaders.MAIN_SHADERS.getAttribLocation("vertTexCoord"), 2, GL11.GL_FLOAT, true, (2+2)*4, 2*4);
|
||||
|
||||
GL11.glDrawArrays(GL11.GL_QUADS, 0, size);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
texture.unbind();
|
||||
|
|
Reference in a new issue