Add Event GUI
This commit is contained in:
parent
e3e472f30b
commit
ea77974d42
7 changed files with 689 additions and 488 deletions
|
@ -2,10 +2,13 @@
|
|||
<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/gui/GUI.java" />
|
||||
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/IActionGUI.java" />
|
||||
<change type="MOVED" beforePath="$PROJECT_DIR$/src/globalgamejam/gui/Label.java" afterPath="$PROJECT_DIR$/src/globalgamejam/gui/GUILabel.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/input/Input.java" afterPath="$PROJECT_DIR$/src/globalgamejam/input/Input.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" afterPath="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java" afterPath="$PROJECT_DIR$/src/globalgamejam/math/Vector3f.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" afterPath="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" afterPath="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
|
@ -21,25 +24,13 @@
|
|||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="Tile.java" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java">
|
||||
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="1360">
|
||||
<caret line="80" column="26" lean-forward="false" selection-start-line="80" selection-start-column="26" selection-end-line="80" selection-end-column="26" />
|
||||
<state relative-caret-position="-340">
|
||||
<caret line="49" column="52" lean-forward="true" selection-start-line="49" selection-start-column="52" selection-end-line="49" selection-end-column="52" />
|
||||
<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>
|
||||
|
@ -58,12 +49,95 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="Matrix4f.java" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="325">
|
||||
<caret line="181" column="5" lean-forward="true" selection-start-line="181" selection-start-column="5" selection-end-line="181" selection-end-column="5" />
|
||||
<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">
|
||||
<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>
|
||||
</file>
|
||||
<file leaf-file-name="GUI.java" pinned="false" current-in-tab="true">
|
||||
<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" />
|
||||
<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" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<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">
|
||||
<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>
|
||||
</file>
|
||||
<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" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="IActionGUI.java" pinned="false" current-in-tab="false">
|
||||
<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" />
|
||||
<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">
|
||||
<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" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
<option value="Interface" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -88,7 +162,6 @@
|
|||
<option value="$PROJECT_DIR$/src/globalgamejam/render/gui/GUIComponent.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/audio/Audio.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/audio/Sound3D.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/input/Input.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/input/IO.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Color4f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Mathf.java" />
|
||||
|
@ -100,7 +173,6 @@
|
|||
<option value="$PROJECT_DIR$/../BasicLighting-master/src/Main.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java" />
|
||||
<option value="$PROJECT_DIR$/res/shaders/main.vert" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java" />
|
||||
<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" />
|
||||
|
@ -113,8 +185,14 @@
|
|||
<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/math/Matrix4f.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/tiles/Tile.java" />
|
||||
<option value="$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.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" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -187,7 +265,73 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="tiles" />
|
||||
<option name="myItemId" value="render" />
|
||||
<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="math" />
|
||||
<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="input" />
|
||||
<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="gui" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
|
@ -239,7 +383,7 @@
|
|||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="" />
|
||||
<module name="Global-Gam-Jam-2017" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
|
@ -455,13 +599,13 @@
|
|||
<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="false" show_stripe_button="true" weight="0.32980973" 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="true" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="7" 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="true" show_stripe_button="true" weight="0.32921347" sideWeight="0.5" order="2" 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="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" />
|
||||
|
@ -494,53 +638,6 @@
|
|||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.vert">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="221">
|
||||
<caret line="13" column="7" lean-forward="false" selection-start-line="13" selection-start-column="7" selection-end-line="13" selection-end-column="49" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/res/shaders/main.frag">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="17">
|
||||
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
|
||||
<folding />
|
||||
</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="204">
|
||||
<caret line="17" column="31" lean-forward="true" selection-start-line="17" selection-start-column="31" selection-end-line="17" selection-end-column="31" />
|
||||
<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/game/Game.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="102">
|
||||
<caret line="8" column="3" lean-forward="false" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" 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="340">
|
||||
|
@ -593,8 +690,6 @@
|
|||
<caret line="105" column="24" lean-forward="false" selection-start-line="105" selection-start-column="24" selection-end-line="105" selection-end-column="24" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1383#1582#0" expanded="true" />
|
||||
<element signature="e#1581#1582#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -744,16 +839,6 @@
|
|||
</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="-1981">
|
||||
<caret line="15" column="3" lean-forward="false" selection-start-line="15" selection-start-column="3" selection-end-line="15" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/../BasicLighting-master/src/shader.frag" />
|
||||
<entry file="file://$PROJECT_DIR$/../BasicLighting-master/src/Main.java" />
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/tiles/TestTile.java">
|
||||
|
@ -782,16 +867,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/render/DisplayManager.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="247">
|
||||
<caret line="30" column="65" lean-forward="false" selection-start-line="30" selection-start-column="65" selection-end-line="30" selection-end-column="65" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="false" />
|
||||
</folding>
|
||||
</state>
|
||||
</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">
|
||||
|
@ -881,18 +956,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="119">
|
||||
<caret line="49" column="52" lean-forward="true" selection-start-line="49" selection-start-column="52" selection-end-line="49" selection-end-column="52" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
<element signature="e#1383#1582#0" expanded="true" />
|
||||
<element signature="e#1581#1582#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/audio/Audio.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-459">
|
||||
|
@ -901,29 +964,10 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="189">
|
||||
<caret line="84" column="30" lean-forward="false" selection-start-line="84" selection-start-column="30" selection-end-line="84" selection-end-column="53" />
|
||||
<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">
|
||||
<caret line="28" column="26" lean-forward="false" selection-start-line="28" selection-start-column="26" selection-end-line="28" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="e#465#466#0" expanded="true" />
|
||||
<element signature="e#495#496#0" expanded="true" />
|
||||
</folding>
|
||||
</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="1360">
|
||||
<caret line="80" column="26" lean-forward="false" selection-start-line="80" selection-start-column="26" selection-end-line="80" selection-end-column="26" />
|
||||
<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" />
|
||||
|
@ -942,6 +986,95 @@
|
|||
</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">
|
||||
<caret line="28" column="26" lean-forward="false" selection-start-line="28" selection-start-column="26" selection-end-line="28" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="e#465#466#0" expanded="true" />
|
||||
<element signature="e#495#496#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/math/Matrix4f.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="325">
|
||||
<caret line="181" column="5" lean-forward="true" selection-start-line="181" selection-start-column="5" selection-end-line="181" selection-end-column="5" />
|
||||
<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="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" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<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" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/globalgamejam/Main.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-340">
|
||||
<caret line="49" column="52" lean-forward="true" selection-start-line="49" selection-start-column="52" selection-end-line="49" selection-end-column="52" />
|
||||
<folding>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<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" />
|
||||
<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">
|
||||
<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">
|
||||
<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" />
|
||||
<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" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</component>
|
||||
<component name="masterDetails">
|
||||
<states>
|
||||
|
|
62
src/globalgamejam/gui/GUI.java
Normal file
62
src/globalgamejam/gui/GUI.java
Normal file
|
@ -0,0 +1,62 @@
|
|||
package globalgamejam.gui;
|
||||
|
||||
import globalgamejam.input.Input;
|
||||
|
||||
/**
|
||||
* Created by trexr on 20/01/2017.
|
||||
*/
|
||||
public abstract class GUI {
|
||||
private int mouseInGUI = 0;//0 = En dehors, 1 = entrer, 2 = deplacer
|
||||
|
||||
protected int x, y;
|
||||
protected int width,height;
|
||||
|
||||
protected IActionGUI action;
|
||||
|
||||
public GUI(int x,int y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = 0;
|
||||
this.height = 0;
|
||||
}
|
||||
|
||||
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){
|
||||
for(int i = 0;i < Input.NBRE_BUTTON;i++){
|
||||
if(Input.isButton(i)){
|
||||
action.clicked(mouseX,mouseY,i,Input.getButtonState(i));
|
||||
}
|
||||
}
|
||||
if(mouseInGUI == 0){
|
||||
mouseInGUI = 1;
|
||||
action.enter(mouseX,mouseY);
|
||||
}else if(mouseInGUI == 1 && mouseInGUI == 2){
|
||||
mouseInGUI = 2;
|
||||
action.move(mouseX,mouseY);
|
||||
}
|
||||
}else{
|
||||
if(mouseInGUI == 1 && mouseInGUI == 2){
|
||||
mouseInGUI = 0;
|
||||
action.leave(mouseX,mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
}
|
|
@ -1,356 +1,352 @@
|
|||
package globalgamejam.gui;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
/**
|
||||
* usefull to print 2D text in openGL LWJGL application
|
||||
* @author Jean-Baptiste Pommeret (Fiesta)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class Label {
|
||||
|
||||
private static final int BYTES_PER_PIXEL = 4;//3 for RGB, 4 for RGBA
|
||||
|
||||
private Image label;
|
||||
private float x, y;
|
||||
private String text;
|
||||
private Color color;
|
||||
private int size;
|
||||
private int witdh, height;
|
||||
|
||||
private String font;
|
||||
|
||||
/**
|
||||
* Full constructor of a Label
|
||||
* @param text (String) : the text to print
|
||||
* @param xC (float) : the x coordonnate of the frame where start printing the Label (upper left corner)
|
||||
* @param yC (float) : the y coordonnate of the frame where start printing the Label (upper left corner)
|
||||
* @param color (java.awt.Color) : the Color you wish for the text
|
||||
* @param font (String) : the font (i.e. "Arial" or "Times new roman")
|
||||
* @param size (int) : the font size
|
||||
*/
|
||||
public Label(String text, float xC, float yC, Color color, String font, int size){
|
||||
this.text = text;
|
||||
this.x = xC;
|
||||
this.y = yC;
|
||||
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);
|
||||
|
||||
this.witdh = fm.stringWidth(this.text);
|
||||
this.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(this.witdh, 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor of a Label. Call the full constructor -> Label("", 100, 100, Color.white, "Arial", 30)
|
||||
*/
|
||||
public Label(){
|
||||
this("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a Label from the text param and default statement.
|
||||
* Call the full constructor -> Label(text, 100, 100, Color.white, "Arial", 30)
|
||||
* @param text (String) : the text to print
|
||||
*/
|
||||
public Label(String text){
|
||||
this(text, 100, 100, Color.white, "Arial", 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual Color of the Label
|
||||
* @return color (java.awt.Color) : the Color of the Label
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Color of the Label. Automaticaly update the Label to use the new Color
|
||||
* @param color (java.awt.Color) : the new Color of the Label
|
||||
*/
|
||||
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);
|
||||
|
||||
this.witdh = fm.stringWidth(this.text);
|
||||
this.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(this.witdh, 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(this.x, this.y, image.getWidth(), image.getHeight(), textureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text of the Label
|
||||
* @return text (String) : the text of the Label
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text of the Label. Automaticaly update the Label to use the new text
|
||||
* @param text (String) : the new text to display
|
||||
*/
|
||||
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);
|
||||
|
||||
this.witdh = fm.stringWidth(this.text);
|
||||
this.height = fm.getHeight();
|
||||
|
||||
final BufferedImage image = new BufferedImage(this.witdh, 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(this.x, this.y, image.getWidth(), image.getHeight(), textureID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the x coordonnate of the Label (upper left corner)
|
||||
* @return x (float) : the x coordonnate of the Label
|
||||
*/
|
||||
public float getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the x coordonnate of the Label (upper left corner)
|
||||
* @param x (float) : the new x coordonnate of the Label
|
||||
*/
|
||||
public void setX(float x) {
|
||||
this.x = x;
|
||||
label.setX(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the y coordonnate of the Label (upper left corner)
|
||||
* @return y (float) : the y coordonnate of the Label
|
||||
*/
|
||||
public float getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the y coordonnate of the Label (upper left corner)
|
||||
* @param y (float) : the new y coordonnate of the Label
|
||||
*/
|
||||
public void setY(float y) {
|
||||
this.y = y;
|
||||
label.setY(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set both x and y coordonnate of the Label
|
||||
* @param x (float) : the new x coordonnate of the Label
|
||||
* @param y (float) : the new y coordonnate of the Label
|
||||
*/
|
||||
public void setPosition(float x, float y){
|
||||
this.setX(x);
|
||||
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
|
||||
*/
|
||||
public int getWitdh() {
|
||||
return witdh;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the height of the Label
|
||||
* @return height (int) : the height
|
||||
*/
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
/**
|
||||
* make the image transparent
|
||||
* @param obj_img (BufferedImage) : the BufferedImage to make transparent
|
||||
*/
|
||||
/* private void makeTransparent(BufferedImage obj_img){
|
||||
byte alpha = (byte)255;
|
||||
alpha %= 0xff;
|
||||
for (int cx=0;cx<obj_img.getWidth();cx++) {
|
||||
for (int cy=0;cy<obj_img.getHeight();cy++) {
|
||||
int color = obj_img.getRGB(cx, cy);
|
||||
|
||||
int mc = (alpha << 24) | 0x00ffffff;
|
||||
int newcolor = color & mc;
|
||||
obj_img.setRGB(cx, cy, newcolor);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
||||
package globalgamejam.gui;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
/**
|
||||
* usefull to print 2D text in openGL LWJGL application
|
||||
* @author Jean-Baptiste Pommeret (Fiesta)
|
||||
* @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 String text;
|
||||
private Color color;
|
||||
private int size;
|
||||
private String font;
|
||||
|
||||
/**
|
||||
* Full constructor of a Label
|
||||
* @param text (String) : the text to print
|
||||
* @param xC (float) : the x coordonnate of the frame where start printing the Label (upper left corner)
|
||||
* @param yC (float) : the y coordonnate of the frame where start printing the Label (upper left corner)
|
||||
* @param color (java.awt.Color) : the Color you wish for the text
|
||||
* @param font (String) : the font (i.e. "Arial" or "Times new roman")
|
||||
* @param size (int) : the font size
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor of a Label. Call the full constructor -> Label("", 100, 100, Color.white, "Arial", 30)
|
||||
*/
|
||||
public GUILabel(){
|
||||
this("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a Label from the text param and default statement.
|
||||
* Call the full constructor -> Label(text, 100, 100, Color.white, "Arial", 30)
|
||||
* @param text (String) : the text to print
|
||||
*/
|
||||
public GUILabel(String text){
|
||||
this(text, 100, 100, Color.white, "Arial", 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual Color of the Label
|
||||
* @return color (java.awt.Color) : the Color of the Label
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Color of the Label. Automaticaly update the Label to use the new Color
|
||||
* @param color (java.awt.Color) : the new Color of the Label
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the text of the Label
|
||||
* @return text (String) : the text of the Label
|
||||
*/
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the text of the Label. Automaticaly update the Label to use the new text
|
||||
* @param text (String) : the new text to display
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the x coordonnate of the Label (upper left corner)
|
||||
* @return x (float) : the x coordonnate of the Label
|
||||
*/
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the x coordonnate of the Label (upper left corner)
|
||||
* @param x (float) : the new x coordonnate of the Label
|
||||
*/
|
||||
public void setX(int x) {
|
||||
super.setX(x);
|
||||
label.setX(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the y coordonnate of the Label (upper left corner)
|
||||
* @return y (float) : the y coordonnate of the Label
|
||||
*/
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the y coordonnate of the Label (upper left corner)
|
||||
* @param y (float) : the new y coordonnate of the Label
|
||||
*/
|
||||
public void setY(int y) {
|
||||
super.setY(y);
|
||||
label.setY(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set both x and y coordonnate of the Label
|
||||
* @param x (float) : the new x coordonnate of the Label
|
||||
* @param y (float) : the new y coordonnate of the Label
|
||||
*/
|
||||
public void setPosition(int x, int y){
|
||||
this.setX(x);
|
||||
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
|
||||
*/
|
||||
public int getWitdh() {
|
||||
return super.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the height of the Label
|
||||
* @return height (int) : the height
|
||||
*/
|
||||
public int getHeight() {
|
||||
return super.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* make the image transparent
|
||||
* @param obj_img (BufferedImage) : the BufferedImage to make transparent
|
||||
*/
|
||||
/* private void makeTransparent(BufferedImage obj_img){
|
||||
byte alpha = (byte)255;
|
||||
alpha %= 0xff;
|
||||
for (int cx=0;cx<obj_img.getWidth();cx++) {
|
||||
for (int cy=0;cy<obj_img.getHeight();cy++) {
|
||||
int color = obj_img.getRGB(cx, cy);
|
||||
|
||||
int mc = (alpha << 24) | 0x00ffffff;
|
||||
int newcolor = color & mc;
|
||||
obj_img.setRGB(cx, cy, newcolor);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}*/
|
||||
}
|
11
src/globalgamejam/gui/IActionGUI.java
Normal file
11
src/globalgamejam/gui/IActionGUI.java
Normal file
|
@ -0,0 +1,11 @@
|
|||
package globalgamejam.gui;
|
||||
|
||||
/**
|
||||
* Created by trexr on 20/01/2017.
|
||||
*/
|
||||
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 clicked(float mouseX,float mouseY,int buttonKey,int buttonState);
|
||||
}
|
|
@ -123,7 +123,7 @@ public class Input{
|
|||
return state.get(button + MOUSE_OFFSET) == PRESSED || state.get(button + MOUSE_OFFSET) == REPEATED;
|
||||
}
|
||||
|
||||
public static int isButtonState(int button){
|
||||
public static int getButtonState(int button){
|
||||
return state.get(button + MOUSE_OFFSET);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public class Input{
|
|||
return state.get(key) == PRESSED || state.get(key) == REPEATED;
|
||||
}
|
||||
|
||||
public static int isKeyState(int key){
|
||||
public static int getKeyState(int key){
|
||||
return state.get(key);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,6 @@ public class Matrix4f {
|
|||
});
|
||||
return mat;
|
||||
}
|
||||
|
||||
public Matrix4f translate(float x,float y,float z){
|
||||
|
||||
public Matrix4f translate(float x,float y,float z){
|
||||
Matrix4f mat = new Matrix4f(new float[][]{
|
||||
|
|
|
@ -18,7 +18,8 @@ public class DisplayManager {
|
|||
|
||||
public static void preRender2D(){
|
||||
projection.loadIdentity();
|
||||
projection.Ortho2D(-Main.WIDTH/2.0f, Main.WIDTH/2.0f, -Main.HEIGHT/2.0f, Main.HEIGHT/2.0f, -1, 1);
|
||||
// projection.Ortho2D(-Main.WIDTH/2.0f, Main.WIDTH/2.0f, -Main.HEIGHT/2.0f, Main.HEIGHT/2.0f, -1, 1);
|
||||
projection.Ortho2D(0, Main.WIDTH, 0, Main.HEIGHT, -1, 1);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LESS);
|
||||
glEnable(GL_BLEND);
|
||||
|
|
Reference in a new issue