Initial commit.
64
.gitignore
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
## Java
|
||||||
|
|
||||||
|
*.class
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
## GWT
|
||||||
|
war/
|
||||||
|
html/war/gwt_bree/
|
||||||
|
html/gwt-unitCache/
|
||||||
|
.apt_generated/
|
||||||
|
html/war/WEB-INF/deploy/
|
||||||
|
html/war/WEB-INF/classes/
|
||||||
|
.gwt/
|
||||||
|
gwt-unitCache/
|
||||||
|
www-test/
|
||||||
|
.gwt-tmp/
|
||||||
|
|
||||||
|
## Android Studio and Intellij and Android in general
|
||||||
|
android/libs/armeabi/
|
||||||
|
android/libs/armeabi-v7a/
|
||||||
|
android/libs/x86/
|
||||||
|
android/gen/
|
||||||
|
.idea/
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
out/
|
||||||
|
com_crashlytics_export_strings.xml
|
||||||
|
|
||||||
|
## Eclipse
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.metadata
|
||||||
|
**/bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.externalToolBuilders/
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
## NetBeans
|
||||||
|
**/nbproject/private/
|
||||||
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
## Gradle
|
||||||
|
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
## OS Specific
|
||||||
|
.DS_Store
|
||||||
|
*~
|
202
LICENSE
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
PouKémon: An affectionate mashup of Pou and Pokémon.
|
||||||
|
========================================================================================
|
||||||
|
|
||||||
|
PouKémon is an absurdly simplified [Pou] [3] clone programmed in Java with the [LibGDX] [4]
|
||||||
|
framework. It is being developed for a game programming course to be taught during the
|
||||||
|
[CEIDEC 2014] [1] week at [Venezuela's Central University] [2].
|
||||||
|
|
||||||
|
PouKémon is libre software licensed under the Apache License version 2.0. Check the LICENSE
|
||||||
|
file for more details.
|
||||||
|
|
||||||
|
[1]: http://www.ceidec.com/
|
||||||
|
[2]: http://www.ucv.ve/
|
||||||
|
[3]: http://www.pou.me/
|
||||||
|
[4]: http://libgdx.badlogicgames.com/
|
26
android/AndroidManifest.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.gamejolt.mikykr5.poukemon.android"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0" >
|
||||||
|
|
||||||
|
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="20" />
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/GdxTheme" >
|
||||||
|
<activity
|
||||||
|
android:name="com.gamejolt.mikykr5.poukemon.android.AndroidLauncher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:screenOrientation="landscape"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
BIN
android/assets/badlogic.jpg
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
android/assets/data/fonts/d-puntillas-B-to-tiptoe.ttf
Normal file
BIN
android/assets/data/gfx/gui/Anonymous_Button_Cyan.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
android/assets/data/gfx/gui/Anonymous_Button_Green.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
android/assets/data/gfx/gui/Anonymous_Button_Red.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
android/assets/data/gfx/gui/Anonymous_Pill_Button_Blue.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
android/assets/data/gfx/gui/Anonymous_Pill_Button_Cyan.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
android/assets/data/gfx/gui/Anonymous_Pill_Button_Yellow.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
android/assets/data/gfx/gui/OUYA_O.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
android/assets/data/gfx/gui/PBCrichton_Flat_Button.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
android/assets/data/gfx/gui/arm.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
android/assets/data/gfx/gui/down_button.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
android/assets/data/gfx/gui/help.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
android/assets/data/gfx/gui/left_button.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
android/assets/data/gfx/gui/orange_glowy_button.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
android/assets/data/gfx/gui/right_button.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
android/assets/data/gfx/gui/slider_black.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
android/assets/data/gfx/gui/up_button.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
android/assets/data/gfx/gui/wheel.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
android/assets/data/gfx/textures/grass.png
Normal file
After Width: | Height: | Size: 156 KiB |
BIN
android/assets/data/gfx/textures/tile_aqua.png
Normal file
After Width: | Height: | Size: 11 KiB |
26
android/assets/shaders/movingBckg/movingBckg_frag.glsl
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
|
||||||
|
varying vec2 v_texCoords;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
gl_FragColor = texture2D(u_texture, v_texCoords);
|
||||||
|
}
|
28
android/assets/shaders/movingBckg/movingBckg_vert.glsl
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
uniform mat4 u_projTrans;
|
||||||
|
uniform float u_displacement;
|
||||||
|
uniform float u_scaling;
|
||||||
|
|
||||||
|
attribute vec4 a_position;
|
||||||
|
attribute vec2 a_texCoord0;
|
||||||
|
|
||||||
|
varying vec2 v_texCoords;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
v_texCoords = (a_texCoord0 + u_displacement) * u_scaling;
|
||||||
|
gl_Position = u_projTrans * a_position;
|
||||||
|
}
|
121
android/build.gradle
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
android {
|
||||||
|
buildToolsVersion "20.0.0"
|
||||||
|
compileSdkVersion 20
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
manifest.srcFile 'AndroidManifest.xml'
|
||||||
|
java.srcDirs = ['src']
|
||||||
|
aidl.srcDirs = ['src']
|
||||||
|
renderscript.srcDirs = ['src']
|
||||||
|
res.srcDirs = ['res']
|
||||||
|
assets.srcDirs = ['assets']
|
||||||
|
}
|
||||||
|
|
||||||
|
instrumentTest.setRoot('tests')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// needed to add JNI shared libraries to APK when compiling on CLI
|
||||||
|
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask ->
|
||||||
|
pkgTask.jniFolders = new HashSet<File>()
|
||||||
|
pkgTask.jniFolders.add(new File(projectDir, 'libs'))
|
||||||
|
}
|
||||||
|
|
||||||
|
// called every time gradle gets executed, takes the native dependencies of
|
||||||
|
// the natives configuration, and extracts them to the proper libs/ folders
|
||||||
|
// so they get packed with the APK.
|
||||||
|
task copyAndroidNatives() {
|
||||||
|
file("libs/armeabi/").mkdirs();
|
||||||
|
file("libs/armeabi-v7a/").mkdirs();
|
||||||
|
file("libs/x86/").mkdirs();
|
||||||
|
|
||||||
|
configurations.natives.files.each { jar ->
|
||||||
|
def outputDir = null
|
||||||
|
if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
|
||||||
|
if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
|
||||||
|
if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
|
||||||
|
if(outputDir != null) {
|
||||||
|
copy {
|
||||||
|
from zipTree(jar)
|
||||||
|
into outputDir
|
||||||
|
include "*.so"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task run(type: Exec) {
|
||||||
|
def path
|
||||||
|
def localProperties = project.file("../local.properties")
|
||||||
|
if (localProperties.exists()) {
|
||||||
|
Properties properties = new Properties()
|
||||||
|
localProperties.withInputStream { instr ->
|
||||||
|
properties.load(instr)
|
||||||
|
}
|
||||||
|
def sdkDir = properties.getProperty('sdk.dir')
|
||||||
|
if (sdkDir) {
|
||||||
|
path = sdkDir
|
||||||
|
} else {
|
||||||
|
path = "$System.env.ANDROID_HOME"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
path = "$System.env.ANDROID_HOME"
|
||||||
|
}
|
||||||
|
|
||||||
|
def adb = path + "/platform-tools/adb"
|
||||||
|
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.gamejolt.mikykr5.poukemon.android/com.gamejolt.mikykr5.poukemon.android.AndroidLauncher'
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets up the Android Eclipse project, using the old Ant based build.
|
||||||
|
eclipse {
|
||||||
|
// need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin
|
||||||
|
// ignores any nodes added in classpath.file.withXml
|
||||||
|
sourceSets {
|
||||||
|
main {
|
||||||
|
java.srcDirs "src", 'gen'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
jdt {
|
||||||
|
sourceCompatibility = 1.6
|
||||||
|
targetCompatibility = 1.6
|
||||||
|
}
|
||||||
|
|
||||||
|
classpath {
|
||||||
|
plusConfigurations += project.configurations.compile
|
||||||
|
containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'
|
||||||
|
}
|
||||||
|
|
||||||
|
project {
|
||||||
|
name = appName + "-android"
|
||||||
|
natures 'com.android.ide.eclipse.adt.AndroidNature'
|
||||||
|
buildCommands.clear();
|
||||||
|
buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
|
||||||
|
buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
|
||||||
|
buildCommand "org.eclipse.jdt.core.javabuilder"
|
||||||
|
buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sets up the Android Idea project, using the old Ant based build.
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
sourceDirs += file("src");
|
||||||
|
scopes = [ COMPILE: [plus:[project.configurations.compile]]]
|
||||||
|
|
||||||
|
iml {
|
||||||
|
withXml {
|
||||||
|
def node = it.asNode()
|
||||||
|
def builder = NodeBuilder.newInstance();
|
||||||
|
builder.current = node;
|
||||||
|
builder.component(name: "FacetManager") {
|
||||||
|
facet(type: "android", name: "Android") {
|
||||||
|
configuration {
|
||||||
|
option(name: "UPDATE_PROPERTY_FILES", value:"true")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
android/ic_launcher-web.png
Normal file
After Width: | Height: | Size: 50 KiB |
42
android/proguard-project.txt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# To enable ProGuard in your project, edit project.properties
|
||||||
|
# to define the proguard.config property as described in that file.
|
||||||
|
#
|
||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# By default, the flags in this file are appended to flags specified
|
||||||
|
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||||
|
# You can edit the include path and order by changing the ProGuard
|
||||||
|
# include property in project.properties.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
-verbose
|
||||||
|
|
||||||
|
-dontwarn android.support.**
|
||||||
|
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
|
||||||
|
-dontwarn com.badlogic.gdx.utils.GdxBuild
|
||||||
|
-dontwarn com.badlogic.gdx.physics.box2d.utils.Box2DBuild
|
||||||
|
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*
|
||||||
|
|
||||||
|
-keepclassmembers class com.badlogic.gdx.backends.android.AndroidInput* {
|
||||||
|
<init>(com.badlogic.gdx.Application, android.content.Context, java.lang.Object, com.badlogic.gdx.backends.android.AndroidApplicationConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
-keepclassmembers class com.badlogic.gdx.physics.box2d.World {
|
||||||
|
boolean contactFilter(long, long);
|
||||||
|
void beginContact(long);
|
||||||
|
void endContact(long);
|
||||||
|
void preSolve(long, long);
|
||||||
|
void postSolve(long, long);
|
||||||
|
boolean reportFixture(long);
|
||||||
|
float reportRayFixture(long, float, float, float, float, float);
|
||||||
|
}
|
14
android/project.properties
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must be checked in Version Control Systems.
|
||||||
|
#
|
||||||
|
# To customize properties used by the Ant build system edit
|
||||||
|
# "ant.properties", and override values to adapt the script to your
|
||||||
|
# project structure.
|
||||||
|
#
|
||||||
|
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||||
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=android-19
|
BIN
android/res/drawable-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
android/res/drawable-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
android/res/drawable-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
android/res/drawable-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 24 KiB |
6
android/res/values/strings.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="app_name">PouKemon</string>
|
||||||
|
|
||||||
|
</resources>
|
12
android/res/values/styles.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="GdxTheme" parent="android:Theme">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||||
|
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
|
<item name="android:windowFullscreen">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
@@ -0,0 +1,16 @@
|
|||||||
|
package com.gamejolt.mikykr5.poukemon.android;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.GameCore;
|
||||||
|
|
||||||
|
public class AndroidLauncher extends AndroidApplication {
|
||||||
|
@Override
|
||||||
|
protected void onCreate (Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
|
||||||
|
initialize(new GameCore(), config);
|
||||||
|
}
|
||||||
|
}
|
74
build.gradle
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:0.10+'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
apply plugin: "eclipse"
|
||||||
|
apply plugin: "idea"
|
||||||
|
|
||||||
|
version = '1.0'
|
||||||
|
ext {
|
||||||
|
appName = 'PouKemon'
|
||||||
|
gdxVersion = '1.3.1'
|
||||||
|
roboVMVersion = '0.0.14'
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||||
|
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":desktop") {
|
||||||
|
apply plugin: "java"
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(":core")
|
||||||
|
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":android") {
|
||||||
|
apply plugin: "android"
|
||||||
|
|
||||||
|
configurations { natives }
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile project(":core")
|
||||||
|
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
|
||||||
|
compile "com.badlogicgames.ashley:ashley:1.1.0"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
|
||||||
|
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
|
||||||
|
compile fileTree(dir: '../libs', include: '*.jar')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(":core") {
|
||||||
|
apply plugin: "java"
|
||||||
|
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
|
||||||
|
compile "com.badlogicgames.ashley:ashley:1.1.0"
|
||||||
|
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
|
||||||
|
compile fileTree(dir: '../libs', include: '*.jar')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.eclipse.doLast {
|
||||||
|
delete ".project"
|
||||||
|
}
|
11
core/build.gradle
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
apply plugin: "java"
|
||||||
|
|
||||||
|
sourceCompatibility = 1.6
|
||||||
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||||
|
|
||||||
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
|
|
||||||
|
eclipse.project {
|
||||||
|
name = appName + "-core"
|
||||||
|
}
|
188
core/src/com/gamejolt/mikykr5/poukemon/GameCore.java
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon;
|
||||||
|
|
||||||
|
import aurelienribon.tweenengine.Tween;
|
||||||
|
import aurelienribon.tweenengine.TweenEquations;
|
||||||
|
import aurelienribon.tweenengine.primitives.MutableFloat;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Application;
|
||||||
|
import com.badlogic.gdx.Game;
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap;
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap.Format;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.states.BaseState;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.states.MainMenuState;
|
||||||
|
|
||||||
|
public class GameCore extends Game {
|
||||||
|
private static final String TAG = "GAME_CORE";
|
||||||
|
private static final String CLASS_NAME = GameCore.class.getSimpleName();
|
||||||
|
|
||||||
|
public enum game_states_t {
|
||||||
|
LOGO_SCREEN(0), MAIN_MENU(1), IN_GAME(2), QUIT(3), LOADING(4);
|
||||||
|
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
private game_states_t(int value){
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getValue(){
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getNumStates(){
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private game_states_t currState;
|
||||||
|
public game_states_t nextState;
|
||||||
|
private BaseState[] states;
|
||||||
|
|
||||||
|
public SpriteBatch batch;
|
||||||
|
private OrthographicCamera pixelPerfectCamera;
|
||||||
|
|
||||||
|
// Fade in/out effect fields.
|
||||||
|
private Texture fadeTexture;
|
||||||
|
private MutableFloat alpha;
|
||||||
|
private Tween fadeOut;
|
||||||
|
private Tween fadeIn;
|
||||||
|
private boolean fading;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create () {
|
||||||
|
// Set up rendering fields and settings.
|
||||||
|
ShaderProgram.pedantic = false;
|
||||||
|
batch = new SpriteBatch();
|
||||||
|
batch.enableBlending();
|
||||||
|
batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
|
||||||
|
// Prepare the fading effect.
|
||||||
|
Pixmap pixmap = new Pixmap(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), Format.RGBA4444);
|
||||||
|
pixmap.setColor(0, 0, 0, 1);
|
||||||
|
pixmap.fill();
|
||||||
|
fadeTexture = new Texture(pixmap);
|
||||||
|
pixmap.dispose();
|
||||||
|
|
||||||
|
alpha = new MutableFloat(0.0f);
|
||||||
|
fadeOut = Tween.to(alpha, 0, 0.5f).target(1.0f).ease(TweenEquations.easeInQuint);
|
||||||
|
fadeIn = Tween.to(alpha, 0, 0.5f).target(0.0f).ease(TweenEquations.easeInQuint);
|
||||||
|
fading = false;
|
||||||
|
|
||||||
|
// Create application states.
|
||||||
|
states = new BaseState[game_states_t.getNumStates()];
|
||||||
|
|
||||||
|
try{
|
||||||
|
states[game_states_t.MAIN_MENU.getValue()] = new MainMenuState(this);
|
||||||
|
}catch(IllegalArgumentException e){
|
||||||
|
Gdx.app.error(TAG, CLASS_NAME + ".create(): Illegal argument caught creating states: ", e);
|
||||||
|
System.exit(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the current and next states.
|
||||||
|
currState = game_states_t.MAIN_MENU;
|
||||||
|
nextState = null;
|
||||||
|
this.setScreen(states[currState.getValue()]);
|
||||||
|
states[currState.getValue()].onStateEnabled();
|
||||||
|
|
||||||
|
// Set initial input handler.
|
||||||
|
Gdx.input.setInputProcessor(states[currState.getValue()]);
|
||||||
|
|
||||||
|
// Set log level
|
||||||
|
if(ProjectConstants.DEBUG){
|
||||||
|
Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
}else{
|
||||||
|
Gdx.app.setLogLevel(Application.LOG_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render () {
|
||||||
|
super.render();
|
||||||
|
|
||||||
|
// If the current state set a value for nextState then switch to that state.
|
||||||
|
if(nextState != null){
|
||||||
|
states[currState.getValue()].onStateDisabled();
|
||||||
|
|
||||||
|
if(!fadeOut.isStarted()){
|
||||||
|
// Start the fade out effect.
|
||||||
|
fadeOut.start();
|
||||||
|
fading = true;
|
||||||
|
}else{
|
||||||
|
// Update the fade out effect.
|
||||||
|
fadeOut.update(Gdx.graphics.getDeltaTime());
|
||||||
|
|
||||||
|
// When the fade out effect finishes, change to the requested state and launch the fade in effect.
|
||||||
|
if(fadeOut.isFinished()){
|
||||||
|
// Change to the requested state.
|
||||||
|
if(nextState != game_states_t.QUIT){
|
||||||
|
currState = nextState;
|
||||||
|
nextState = null;
|
||||||
|
states[currState.getValue()].onStateEnabled();
|
||||||
|
setScreen(states[currState.getValue()]);
|
||||||
|
}else{
|
||||||
|
nextState = null;
|
||||||
|
Gdx.app.exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reset the fade out effect and launch the fade in.
|
||||||
|
fadeOut.free();
|
||||||
|
fadeOut = Tween.to(alpha, 0, 0.5f).target(1.0f).ease(TweenEquations.easeInQuint);
|
||||||
|
fadeIn.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is a fade in effect in progress.
|
||||||
|
if(fadeIn.isStarted()){
|
||||||
|
if(!fadeIn.isFinished()){
|
||||||
|
// Update it until finished.
|
||||||
|
fadeIn.update(Gdx.graphics.getDeltaTime());
|
||||||
|
}else{
|
||||||
|
// Stop and reset it when done.
|
||||||
|
fading = false;
|
||||||
|
fadeIn.free();
|
||||||
|
fadeIn = Tween.to(alpha, 0, 0.5f).target(0.0f).ease(TweenEquations.easeInQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render the fading sprite with alpha blending.
|
||||||
|
if(fading){
|
||||||
|
batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||||
|
batch.begin();{
|
||||||
|
batch.setColor(1, 1, 1, alpha.floatValue());
|
||||||
|
batch.draw(fadeTexture, -(Gdx.graphics.getWidth() / 2), -(Gdx.graphics.getHeight() / 2));
|
||||||
|
batch.setColor(1, 1, 1, 1);
|
||||||
|
}batch.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose(){
|
||||||
|
super.dispose();
|
||||||
|
|
||||||
|
fadeTexture.dispose();
|
||||||
|
}
|
||||||
|
}
|
28
core/src/com/gamejolt/mikykr5/poukemon/ProjectConstants.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon;
|
||||||
|
|
||||||
|
public abstract class ProjectConstants{
|
||||||
|
public static final int EXIT_SUCCESS = 0;
|
||||||
|
public static final int EXIT_FAILURE = 1;
|
||||||
|
|
||||||
|
public static final boolean DEBUG = false;
|
||||||
|
|
||||||
|
public static final int[] POWERS_OF_2 = {64, 128, 256, 512, 1024, 2048};
|
||||||
|
|
||||||
|
public static final int MENU_BUTTON_FONT_SIZE = 40;
|
||||||
|
public static final String FONT_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890:,";
|
||||||
|
}
|
135
core/src/com/gamejolt/mikykr5/poukemon/states/BaseState.java
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon.states;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.InputProcessor;
|
||||||
|
import com.badlogic.gdx.Screen;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.math.Vector2;
|
||||||
|
import com.badlogic.gdx.math.Vector3;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.GameCore;
|
||||||
|
|
||||||
|
public abstract class BaseState implements Screen, InputProcessor{
|
||||||
|
protected GameCore core;
|
||||||
|
protected boolean stateEnabled;
|
||||||
|
protected OrthographicCamera pixelPerfectCamera;
|
||||||
|
protected Vector3 win2world;
|
||||||
|
protected Vector2 touchPointWorldCoords;
|
||||||
|
|
||||||
|
public BaseState(){
|
||||||
|
this.pixelPerfectCamera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
win2world = new Vector3(0.0f, 0.0f, 0.0f);
|
||||||
|
touchPointWorldCoords = new Vector2();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*;;;;;;;;;;;;;;;;;
|
||||||
|
; STATE METHODS ;
|
||||||
|
;;;;;;;;;;;;;;;;;*/
|
||||||
|
|
||||||
|
public void onStateEnabled(){
|
||||||
|
stateEnabled = true;
|
||||||
|
Gdx.input.setInputProcessor(this);
|
||||||
|
Gdx.input.setCatchBackKey(true);
|
||||||
|
Gdx.input.setCatchMenuKey(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStateDisabled(){
|
||||||
|
stateEnabled = false;
|
||||||
|
Gdx.input.setInputProcessor(null);
|
||||||
|
Gdx.input.setCatchBackKey(false);
|
||||||
|
Gdx.input.setCatchMenuKey(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*;;;;;;;;;;;;;;;;;;
|
||||||
|
; SCREEN METHODS ;
|
||||||
|
;;;;;;;;;;;;;;;;;;*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void render(float delta);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public abstract void dispose();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resize(int width, int height){ }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show(){ }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hide(){ }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void pause(){ }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void resume(){ }
|
||||||
|
|
||||||
|
/*;;;;;;;;;;;;;;;;;;
|
||||||
|
; HELPER METHODS ;
|
||||||
|
;;;;;;;;;;;;;;;;;;*/
|
||||||
|
|
||||||
|
protected final void unprojectTouch(int screenX, int screenY){
|
||||||
|
win2world.set(screenX, screenY, 0.0f);
|
||||||
|
pixelPerfectCamera.unproject(win2world);
|
||||||
|
touchPointWorldCoords.set(win2world.x, win2world.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; INPUT PROCESSOR METHODS ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyDown(int keycode){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyUp(int keycode){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyTyped(char character){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchDown(int screenX, int screenY, int pointer, int button){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchUp(int screenX, int screenY, int pointer, int button){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchDragged(int screenX, int screenY, int pointer){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean mouseMoved(int screenX, int screenY){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean scrolled(int amount){
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon.states;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
|
||||||
|
public class LogoScreen extends BaseState {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
264
core/src/com/gamejolt/mikykr5/poukemon/states/MainMenuState.java
Normal file
@@ -0,0 +1,264 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon.states;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Input;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.Texture.TextureFilter;
|
||||||
|
import com.badlogic.gdx.graphics.Texture.TextureWrap;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.NinePatch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Sprite;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||||
|
import com.badlogic.gdx.math.Rectangle;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle;
|
||||||
|
import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.GameCore;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.GameCore.game_states_t;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.ProjectConstants;
|
||||||
|
|
||||||
|
public class MainMenuState extends BaseState{
|
||||||
|
private static final String TAG = "MAIN_MENU";
|
||||||
|
private static final String CLASS_NAME = MainMenuState.class.getSimpleName();
|
||||||
|
private static final String SHADER_PATH = "shaders/movingBckg/movingBckg";
|
||||||
|
|
||||||
|
// Helper fields.
|
||||||
|
private float u_scaling[];
|
||||||
|
private float u_displacement;
|
||||||
|
|
||||||
|
// Buttons and other GUI components.
|
||||||
|
private TextButton startButton;
|
||||||
|
private Rectangle startButtonBBox;
|
||||||
|
private TextButton quitButton;
|
||||||
|
private Rectangle quitButtonBBox;
|
||||||
|
private Sprite background;
|
||||||
|
|
||||||
|
// Graphic data for the start button.
|
||||||
|
private Texture menuButtonEnabledTexture;
|
||||||
|
private Texture menuButtonDisabledTexture;
|
||||||
|
private Texture menuButtonPressedTexture;
|
||||||
|
private NinePatch menuButtonEnabled9p;
|
||||||
|
private NinePatch menuButtonDisabled9p;
|
||||||
|
private NinePatch menuButtonPressed9p;
|
||||||
|
private BitmapFont font;
|
||||||
|
|
||||||
|
// Other graphics.
|
||||||
|
private Texture backgroundTexture;
|
||||||
|
private ShaderProgram backgroundShader;
|
||||||
|
|
||||||
|
// Button touch helper fields.
|
||||||
|
private boolean startButtonTouched;
|
||||||
|
private int startButtonTouchPointer;
|
||||||
|
private boolean quitButtonTouched;
|
||||||
|
private int quitButtonTouchPointer;
|
||||||
|
|
||||||
|
public MainMenuState(final GameCore core) throws IllegalArgumentException{
|
||||||
|
super();
|
||||||
|
|
||||||
|
TextButtonStyle textButtonStyle;
|
||||||
|
FreeTypeFontGenerator fontGenerator;
|
||||||
|
FreeTypeFontParameter fontParameters;
|
||||||
|
|
||||||
|
if(core == null)
|
||||||
|
throw new IllegalArgumentException(CLASS_NAME + ": Core is null.");
|
||||||
|
|
||||||
|
this.core = core;
|
||||||
|
|
||||||
|
// Create the start button background.
|
||||||
|
menuButtonEnabledTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Yellow.png"));
|
||||||
|
menuButtonEnabled9p = new NinePatch(new TextureRegion(menuButtonEnabledTexture, 0, 0, menuButtonEnabledTexture.getWidth(), menuButtonEnabledTexture.getHeight()), 49, 49, 45, 45);
|
||||||
|
menuButtonDisabledTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Cyan.png"));
|
||||||
|
menuButtonDisabled9p = new NinePatch(new TextureRegion(menuButtonDisabledTexture, 0, 0, menuButtonDisabledTexture.getWidth(), menuButtonDisabledTexture.getHeight()), 49, 49, 45, 45);
|
||||||
|
menuButtonPressedTexture = new Texture(Gdx.files.internal("data/gfx/gui/Anonymous_Pill_Button_Blue.png"));
|
||||||
|
menuButtonPressed9p = new NinePatch(new TextureRegion(menuButtonPressedTexture, 0, 0, menuButtonPressedTexture.getWidth(), menuButtonPressedTexture.getHeight()), 49, 49, 45, 45);
|
||||||
|
|
||||||
|
// Create the start button font.
|
||||||
|
fontParameters = new FreeTypeFontParameter();
|
||||||
|
fontParameters.characters = ProjectConstants.FONT_CHARS;
|
||||||
|
fontParameters.size = ProjectConstants.MENU_BUTTON_FONT_SIZE;
|
||||||
|
fontParameters.flip = false;
|
||||||
|
fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("data/fonts/d-puntillas-B-to-tiptoe.ttf"));
|
||||||
|
font = fontGenerator.generateFont(fontParameters);
|
||||||
|
fontGenerator.dispose();
|
||||||
|
|
||||||
|
// Create the buttons.
|
||||||
|
textButtonStyle = new TextButtonStyle();
|
||||||
|
textButtonStyle.font = font;
|
||||||
|
textButtonStyle.up = new NinePatchDrawable(menuButtonEnabled9p);
|
||||||
|
textButtonStyle.checked = new NinePatchDrawable(menuButtonPressed9p);
|
||||||
|
textButtonStyle.disabled = new NinePatchDrawable(menuButtonDisabled9p);
|
||||||
|
textButtonStyle.fontColor = new Color(Color.BLACK);
|
||||||
|
textButtonStyle.downFontColor = new Color(Color.WHITE);
|
||||||
|
textButtonStyle.disabledFontColor = new Color(Color.BLACK);
|
||||||
|
|
||||||
|
startButton = new TextButton("Start game", textButtonStyle);
|
||||||
|
startButton.setText("Start game");
|
||||||
|
startButtonBBox = new Rectangle(0, 0, startButton.getWidth(), startButton.getHeight());
|
||||||
|
|
||||||
|
quitButton = new TextButton("Quit", textButtonStyle);
|
||||||
|
quitButton.setText("quit");
|
||||||
|
quitButtonBBox = new Rectangle(0, 0, quitButton.getWidth(), quitButton.getHeight());
|
||||||
|
|
||||||
|
// Set buttons.
|
||||||
|
startButton.setPosition(-(startButton.getWidth() / 2), -(startButton.getHeight() / 2));
|
||||||
|
startButtonBBox.setPosition(startButton.getX(), startButton.getY());
|
||||||
|
quitButton.setPosition(-(quitButton.getWidth() / 2), (startButton.getY() - startButton.getHeight()) - 10);
|
||||||
|
quitButtonBBox.setPosition(quitButton.getX(), quitButton.getY());
|
||||||
|
|
||||||
|
// Set up the background.
|
||||||
|
backgroundTexture = new Texture(Gdx.files.internal("data/gfx/textures/grass.png"));
|
||||||
|
backgroundTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
|
||||||
|
backgroundTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
|
||||||
|
background = new Sprite(backgroundTexture);
|
||||||
|
background.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||||
|
background.setPosition(-(Gdx.graphics.getWidth() / 2), -(Gdx.graphics.getHeight() / 2));
|
||||||
|
|
||||||
|
backgroundShader = new ShaderProgram(Gdx.files.internal(SHADER_PATH + "_vert.glsl"), Gdx.files.internal(SHADER_PATH + "_frag.glsl"));
|
||||||
|
if(!backgroundShader.isCompiled()){
|
||||||
|
Gdx.app.error(TAG, CLASS_NAME + ".MainMenuStateBase() :: Failed to compile the background shader.");
|
||||||
|
Gdx.app.error(TAG, CLASS_NAME + backgroundShader.getLog());
|
||||||
|
backgroundShader = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
u_scaling = new float[2];
|
||||||
|
u_scaling[0] = Gdx.graphics.getWidth() > Gdx.graphics.getHeight() ? 16.0f : 9.0f;
|
||||||
|
u_scaling[1] = Gdx.graphics.getHeight() > Gdx.graphics.getWidth() ? 16.0f : 9.0f;
|
||||||
|
|
||||||
|
u_displacement = 1.0f;
|
||||||
|
|
||||||
|
startButtonTouched = false;
|
||||||
|
startButtonTouchPointer = -1;
|
||||||
|
quitButtonTouched = false;
|
||||||
|
quitButtonTouchPointer = -1;
|
||||||
|
|
||||||
|
stateEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(float delta){
|
||||||
|
Gdx.gl.glClearColor(1, 1, 1, 1);
|
||||||
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
core.batch.setProjectionMatrix(pixelPerfectCamera.combined);
|
||||||
|
core.batch.begin();{
|
||||||
|
|
||||||
|
// Render background.
|
||||||
|
core.batch.disableBlending();
|
||||||
|
drawBackground(core.batch);
|
||||||
|
core.batch.enableBlending();
|
||||||
|
|
||||||
|
// Render buttons.
|
||||||
|
startButton.draw(core.batch, 1.0f);
|
||||||
|
quitButton.draw(core.batch, 1.0f);
|
||||||
|
|
||||||
|
}core.batch.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose(){
|
||||||
|
menuButtonEnabledTexture.dispose();
|
||||||
|
menuButtonDisabledTexture.dispose();
|
||||||
|
menuButtonPressedTexture.dispose();
|
||||||
|
backgroundTexture.dispose();
|
||||||
|
if(backgroundShader != null) backgroundShader.dispose();
|
||||||
|
font.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawBackground(SpriteBatch batch){
|
||||||
|
if(backgroundShader != null){
|
||||||
|
batch.setShader(backgroundShader);
|
||||||
|
backgroundShader.setUniformf("u_scaling", 2.0f);
|
||||||
|
backgroundShader.setUniformf("u_displacement", u_displacement);
|
||||||
|
}
|
||||||
|
background.draw(batch);
|
||||||
|
if(backgroundShader != null) batch.setShader(null);
|
||||||
|
u_displacement = u_displacement < 0.0f ? 1.0f : u_displacement - 0.0005f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; INPUT LISTENER METHODS ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchDown(int screenX, int screenY, int pointer, int button){
|
||||||
|
unprojectTouch(screenX, screenY);
|
||||||
|
|
||||||
|
if(!startButton.isDisabled() && startButtonBBox.contains(touchPointWorldCoords) && !quitButtonTouched){
|
||||||
|
startButton.setChecked(true);
|
||||||
|
startButtonTouched = true;
|
||||||
|
startButtonTouchPointer = pointer;
|
||||||
|
}else if(!quitButton.isDisabled() && quitButtonBBox.contains(touchPointWorldCoords) && !startButtonTouched){
|
||||||
|
quitButton.setChecked(true);
|
||||||
|
quitButtonTouched = true;
|
||||||
|
quitButtonTouchPointer = pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchUp(int screenX, int screenY, int pointer, int button){
|
||||||
|
unprojectTouch(screenX, screenY);
|
||||||
|
|
||||||
|
if(!startButton.isDisabled() && startButtonBBox.contains(touchPointWorldCoords) && startButtonTouched){
|
||||||
|
startButton.setChecked(false);
|
||||||
|
startButtonTouched = false;
|
||||||
|
startButtonTouchPointer = -1;
|
||||||
|
core.nextState = game_states_t.IN_GAME;
|
||||||
|
}else if(!quitButton.isDisabled() && quitButtonBBox.contains(touchPointWorldCoords) && quitButtonTouched){
|
||||||
|
quitButton.setChecked(false);
|
||||||
|
quitButtonTouched = false;
|
||||||
|
quitButtonTouchPointer = -1;
|
||||||
|
core.nextState = game_states_t.QUIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean touchDragged(int screenX, int screenY, int pointer){
|
||||||
|
unprojectTouch(screenX, screenY);
|
||||||
|
|
||||||
|
if(!startButton.isDisabled() && startButtonTouched && pointer == startButtonTouchPointer && !startButtonBBox.contains(touchPointWorldCoords)){
|
||||||
|
startButtonTouchPointer = -1;
|
||||||
|
startButtonTouched = false;
|
||||||
|
startButton.setChecked(false);
|
||||||
|
}else if(!quitButton.isDisabled() && quitButtonTouched && pointer == quitButtonTouchPointer && !quitButtonBBox.contains(touchPointWorldCoords)){
|
||||||
|
quitButtonTouchPointer = -1;
|
||||||
|
quitButtonTouched = false;
|
||||||
|
quitButton.setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean keyDown(int keycode){
|
||||||
|
if(keycode == Input.Keys.BACK){
|
||||||
|
Gdx.app.exit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
46
desktop/build.gradle
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
apply plugin: "java"
|
||||||
|
|
||||||
|
sourceCompatibility = 1.6
|
||||||
|
sourceSets.main.java.srcDirs = [ "src/" ]
|
||||||
|
|
||||||
|
project.ext.mainClassName = "com.gamejolt.mikykr5.poukemon.desktop.DesktopLauncher"
|
||||||
|
project.ext.assetsDir = new File("../android/assets");
|
||||||
|
|
||||||
|
task run(dependsOn: classes, type: JavaExec) {
|
||||||
|
main = project.mainClassName
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
standardInput = System.in
|
||||||
|
workingDir = project.assetsDir
|
||||||
|
ignoreExitValue = true
|
||||||
|
}
|
||||||
|
|
||||||
|
task dist(type: Jar) {
|
||||||
|
from files(sourceSets.main.output.classesDir)
|
||||||
|
from files(sourceSets.main.output.resourcesDir)
|
||||||
|
from {configurations.compile.collect {zipTree(it)}}
|
||||||
|
from files(project.assetsDir);
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes 'Main-Class': project.mainClassName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dist.dependsOn classes
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
project {
|
||||||
|
name = appName + "-desktop"
|
||||||
|
linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
|
||||||
|
doLast {
|
||||||
|
def classpath = new XmlParser().parse(file(".classpath"))
|
||||||
|
new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ]);
|
||||||
|
def writer = new FileWriter(file(".classpath"))
|
||||||
|
def printer = new XmlNodePrinter(new PrintWriter(writer))
|
||||||
|
printer.setPreserveWhitespace(true)
|
||||||
|
printer.print(classpath)
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package com.gamejolt.mikykr5.poukemon.desktop;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
|
||||||
|
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
|
||||||
|
import com.gamejolt.mikykr5.poukemon.GameCore;
|
||||||
|
|
||||||
|
public class DesktopLauncher {
|
||||||
|
public static void main (String[] arg) {
|
||||||
|
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
|
||||||
|
|
||||||
|
config.width = 1024;
|
||||||
|
config.height = 768;
|
||||||
|
config.resizable = false;
|
||||||
|
config.title = "PouKémon";
|
||||||
|
|
||||||
|
new LwjglApplication(new GameCore(), config);
|
||||||
|
}
|
||||||
|
}
|
3
gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
org.gradle.daemon=true
|
||||||
|
org.gradle.jvmargs=-Xms128m -Xmx512m
|
||||||
|
org.gradle.configureondemand=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#Sat Sep 21 13:08:26 CEST 2013
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip
|
164
gradlew
vendored
Executable file
@@ -0,0 +1,164 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn ( ) {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die ( ) {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
BIN
libs/tween-engine-api-sources.jar
Normal file
BIN
libs/tween-engine-api.jar
Normal file
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include 'desktop', 'android', 'core'
|