commit 81b3332747bbb6ad735b23071df3f7d1f579cfc8 Author: Gnarly Narwhal Date: Sun Mar 10 22:44:34 2019 -0700 Entire project diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ae9f34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.settings/ +bin/ +extraRes/ +.classpath +.project +*.jar +*.zip + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e129676 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +Mit License + +Copyright (c) 2018 Gnarly Narwhal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f57d924 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# Ludum Dare 42 + +## Getting Started + +### Prerequisites +Must have [Java](http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html) installed +* NOTE: I run Java 10 so I cannot guarantee that it will work on earlier version, but I don't believe I've used anything preventing it from running on some older versions. Click [here](http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html) to download Java 10. + +Graphics driver must have support for OpenGL 3.3 Core or later + +### What's this all about? +This project is my game for Ludum Dare 42. If you don't know what [Ludum Dare](https://ldjam.com/about) is and you're into making games then definitely check it out [here](https://ldjam.com/about). + +### So what's the game? +You are the Java Garbage Collecter and the JVM is running out of heap space. Can you stop it in time? + +### Can I play it? +Of course! Here's how: + +Click [here](https://drive.google.com/open?id=1XMUZP49DxGE8KB5OEtUxoEArjhHcM4Ju) to download the game. Once you've downloaded it extract the zip file and run the jar file. + +Of course you can always download the source and compile it yourself. You are going to need [LWJGL 3](https://www.lwjgl.org/download). Make sure to include JOML under **Addons** diff --git a/res/default/img/1080p/a.png b/res/default/img/1080p/a.png new file mode 100644 index 0000000..416d0ef Binary files /dev/null and b/res/default/img/1080p/a.png differ diff --git a/res/default/img/1080p/b.png b/res/default/img/1080p/b.png new file mode 100644 index 0000000..36eeefc Binary files /dev/null and b/res/default/img/1080p/b.png differ diff --git a/res/default/img/1080p/backone.png b/res/default/img/1080p/backone.png new file mode 100644 index 0000000..7126d75 Binary files /dev/null and b/res/default/img/1080p/backone.png differ diff --git a/res/default/img/1080p/backthree.png b/res/default/img/1080p/backthree.png new file mode 100644 index 0000000..2a34785 Binary files /dev/null and b/res/default/img/1080p/backthree.png differ diff --git a/res/default/img/1080p/backtwo.png b/res/default/img/1080p/backtwo.png new file mode 100644 index 0000000..e97ca0b Binary files /dev/null and b/res/default/img/1080p/backtwo.png differ diff --git a/res/default/img/1080p/c.png b/res/default/img/1080p/c.png new file mode 100644 index 0000000..af645b3 Binary files /dev/null and b/res/default/img/1080p/c.png differ diff --git a/res/default/img/1080p/closed.png b/res/default/img/1080p/closed.png new file mode 100644 index 0000000..641c754 Binary files /dev/null and b/res/default/img/1080p/closed.png differ diff --git a/res/default/img/1080p/d.png b/res/default/img/1080p/d.png new file mode 100644 index 0000000..6df77e0 Binary files /dev/null and b/res/default/img/1080p/d.png differ diff --git a/res/default/img/1080p/e.png b/res/default/img/1080p/e.png new file mode 100644 index 0000000..d605912 Binary files /dev/null and b/res/default/img/1080p/e.png differ diff --git a/res/default/img/1080p/easyone.png b/res/default/img/1080p/easyone.png new file mode 100644 index 0000000..bc0f34b Binary files /dev/null and b/res/default/img/1080p/easyone.png differ diff --git a/res/default/img/1080p/easythree.png b/res/default/img/1080p/easythree.png new file mode 100644 index 0000000..8b954af Binary files /dev/null and b/res/default/img/1080p/easythree.png differ diff --git a/res/default/img/1080p/easytwo.png b/res/default/img/1080p/easytwo.png new file mode 100644 index 0000000..e231637 Binary files /dev/null and b/res/default/img/1080p/easytwo.png differ diff --git a/res/default/img/1080p/eight.png b/res/default/img/1080p/eight.png new file mode 100644 index 0000000..6f11f5c Binary files /dev/null and b/res/default/img/1080p/eight.png differ diff --git a/res/default/img/1080p/f.png b/res/default/img/1080p/f.png new file mode 100644 index 0000000..d0e66f3 Binary files /dev/null and b/res/default/img/1080p/f.png differ diff --git a/res/default/img/1080p/five.png b/res/default/img/1080p/five.png new file mode 100644 index 0000000..ff56601 Binary files /dev/null and b/res/default/img/1080p/five.png differ diff --git a/res/default/img/1080p/four.png b/res/default/img/1080p/four.png new file mode 100644 index 0000000..f6bd9b4 Binary files /dev/null and b/res/default/img/1080p/four.png differ diff --git a/res/default/img/1080p/g.png b/res/default/img/1080p/g.png new file mode 100644 index 0000000..4fa15cd Binary files /dev/null and b/res/default/img/1080p/g.png differ diff --git a/res/default/img/1080p/gameover.png b/res/default/img/1080p/gameover.png new file mode 100644 index 0000000..ffb6ec8 Binary files /dev/null and b/res/default/img/1080p/gameover.png differ diff --git a/res/default/img/1080p/groups.png b/res/default/img/1080p/groups.png new file mode 100644 index 0000000..5c9c5b5 Binary files /dev/null and b/res/default/img/1080p/groups.png differ diff --git a/res/default/img/1080p/groupsize.png b/res/default/img/1080p/groupsize.png new file mode 100644 index 0000000..ef1fe2b Binary files /dev/null and b/res/default/img/1080p/groupsize.png differ diff --git a/res/default/img/1080p/h.png b/res/default/img/1080p/h.png new file mode 100644 index 0000000..9dee416 Binary files /dev/null and b/res/default/img/1080p/h.png differ diff --git a/res/default/img/1080p/hardone.png b/res/default/img/1080p/hardone.png new file mode 100644 index 0000000..a86dcc8 Binary files /dev/null and b/res/default/img/1080p/hardone.png differ diff --git a/res/default/img/1080p/hardthree.png b/res/default/img/1080p/hardthree.png new file mode 100644 index 0000000..dc72b78 Binary files /dev/null and b/res/default/img/1080p/hardthree.png differ diff --git a/res/default/img/1080p/hardtwo.png b/res/default/img/1080p/hardtwo.png new file mode 100644 index 0000000..00c1710 Binary files /dev/null and b/res/default/img/1080p/hardtwo.png differ diff --git a/res/default/img/1080p/helpone.png b/res/default/img/1080p/helpone.png new file mode 100644 index 0000000..6ae5c66 Binary files /dev/null and b/res/default/img/1080p/helpone.png differ diff --git a/res/default/img/1080p/helpthree.png b/res/default/img/1080p/helpthree.png new file mode 100644 index 0000000..bd45296 Binary files /dev/null and b/res/default/img/1080p/helpthree.png differ diff --git a/res/default/img/1080p/helptwo.png b/res/default/img/1080p/helptwo.png new file mode 100644 index 0000000..24a76c1 Binary files /dev/null and b/res/default/img/1080p/helptwo.png differ diff --git a/res/default/img/1080p/highscore.png b/res/default/img/1080p/highscore.png new file mode 100644 index 0000000..9479d32 Binary files /dev/null and b/res/default/img/1080p/highscore.png differ diff --git a/res/default/img/1080p/i.png b/res/default/img/1080p/i.png new file mode 100644 index 0000000..45e0312 Binary files /dev/null and b/res/default/img/1080p/i.png differ diff --git a/res/default/img/1080p/j.png b/res/default/img/1080p/j.png new file mode 100644 index 0000000..e7818a1 Binary files /dev/null and b/res/default/img/1080p/j.png differ diff --git a/res/default/img/1080p/k.png b/res/default/img/1080p/k.png new file mode 100644 index 0000000..3ff6898 Binary files /dev/null and b/res/default/img/1080p/k.png differ diff --git a/res/default/img/1080p/l.png b/res/default/img/1080p/l.png new file mode 100644 index 0000000..025e298 Binary files /dev/null and b/res/default/img/1080p/l.png differ diff --git a/res/default/img/1080p/logo.png b/res/default/img/1080p/logo.png new file mode 100644 index 0000000..7486df0 Binary files /dev/null and b/res/default/img/1080p/logo.png differ diff --git a/res/default/img/1080p/m.png b/res/default/img/1080p/m.png new file mode 100644 index 0000000..870043f Binary files /dev/null and b/res/default/img/1080p/m.png differ diff --git a/res/default/img/1080p/medone.png b/res/default/img/1080p/medone.png new file mode 100644 index 0000000..bddb03d Binary files /dev/null and b/res/default/img/1080p/medone.png differ diff --git a/res/default/img/1080p/medthree.png b/res/default/img/1080p/medthree.png new file mode 100644 index 0000000..8a0036b Binary files /dev/null and b/res/default/img/1080p/medthree.png differ diff --git a/res/default/img/1080p/medtwo.png b/res/default/img/1080p/medtwo.png new file mode 100644 index 0000000..0d90f45 Binary files /dev/null and b/res/default/img/1080p/medtwo.png differ diff --git a/res/default/img/1080p/n.png b/res/default/img/1080p/n.png new file mode 100644 index 0000000..12b728a Binary files /dev/null and b/res/default/img/1080p/n.png differ diff --git a/res/default/img/1080p/nextone.png b/res/default/img/1080p/nextone.png new file mode 100644 index 0000000..025c5a2 Binary files /dev/null and b/res/default/img/1080p/nextone.png differ diff --git a/res/default/img/1080p/nextthree.png b/res/default/img/1080p/nextthree.png new file mode 100644 index 0000000..3d6d04f Binary files /dev/null and b/res/default/img/1080p/nextthree.png differ diff --git a/res/default/img/1080p/nexttwo.png b/res/default/img/1080p/nexttwo.png new file mode 100644 index 0000000..2ff1464 Binary files /dev/null and b/res/default/img/1080p/nexttwo.png differ diff --git a/res/default/img/1080p/nine.png b/res/default/img/1080p/nine.png new file mode 100644 index 0000000..bb3ecd9 Binary files /dev/null and b/res/default/img/1080p/nine.png differ diff --git a/res/default/img/1080p/o.png b/res/default/img/1080p/o.png new file mode 100644 index 0000000..b865201 Binary files /dev/null and b/res/default/img/1080p/o.png differ diff --git a/res/default/img/1080p/one.png b/res/default/img/1080p/one.png new file mode 100644 index 0000000..9cbff67 Binary files /dev/null and b/res/default/img/1080p/one.png differ diff --git a/res/default/img/1080p/open.png b/res/default/img/1080p/open.png new file mode 100644 index 0000000..e47cb10 Binary files /dev/null and b/res/default/img/1080p/open.png differ diff --git a/res/default/img/1080p/p.png b/res/default/img/1080p/p.png new file mode 100644 index 0000000..3b297ab Binary files /dev/null and b/res/default/img/1080p/p.png differ diff --git a/res/default/img/1080p/playicon.png b/res/default/img/1080p/playicon.png new file mode 100644 index 0000000..2b4c41e Binary files /dev/null and b/res/default/img/1080p/playicon.png differ diff --git a/res/default/img/1080p/prevone.png b/res/default/img/1080p/prevone.png new file mode 100644 index 0000000..3756b87 Binary files /dev/null and b/res/default/img/1080p/prevone.png differ diff --git a/res/default/img/1080p/prevthree.png b/res/default/img/1080p/prevthree.png new file mode 100644 index 0000000..833381f Binary files /dev/null and b/res/default/img/1080p/prevthree.png differ diff --git a/res/default/img/1080p/prevtwo.png b/res/default/img/1080p/prevtwo.png new file mode 100644 index 0000000..63910b8 Binary files /dev/null and b/res/default/img/1080p/prevtwo.png differ diff --git a/res/default/img/1080p/q.png b/res/default/img/1080p/q.png new file mode 100644 index 0000000..6d7a625 Binary files /dev/null and b/res/default/img/1080p/q.png differ diff --git a/res/default/img/1080p/r.png b/res/default/img/1080p/r.png new file mode 100644 index 0000000..1870af6 Binary files /dev/null and b/res/default/img/1080p/r.png differ diff --git a/res/default/img/1080p/s.png b/res/default/img/1080p/s.png new file mode 100644 index 0000000..c687448 Binary files /dev/null and b/res/default/img/1080p/s.png differ diff --git a/res/default/img/1080p/score.png b/res/default/img/1080p/score.png new file mode 100644 index 0000000..3b649af Binary files /dev/null and b/res/default/img/1080p/score.png differ diff --git a/res/default/img/1080p/seven.png b/res/default/img/1080p/seven.png new file mode 100644 index 0000000..4e657a7 Binary files /dev/null and b/res/default/img/1080p/seven.png differ diff --git a/res/default/img/1080p/six.png b/res/default/img/1080p/six.png new file mode 100644 index 0000000..a73d896 Binary files /dev/null and b/res/default/img/1080p/six.png differ diff --git a/res/default/img/1080p/space.png b/res/default/img/1080p/space.png new file mode 100644 index 0000000..94eee1a Binary files /dev/null and b/res/default/img/1080p/space.png differ diff --git a/res/default/img/1080p/stack.png b/res/default/img/1080p/stack.png new file mode 100644 index 0000000..fa46d43 Binary files /dev/null and b/res/default/img/1080p/stack.png differ diff --git a/res/default/img/1080p/t.png b/res/default/img/1080p/t.png new file mode 100644 index 0000000..b3b9f18 Binary files /dev/null and b/res/default/img/1080p/t.png differ diff --git a/res/default/img/1080p/three.png b/res/default/img/1080p/three.png new file mode 100644 index 0000000..b9b33ac Binary files /dev/null and b/res/default/img/1080p/three.png differ diff --git a/res/default/img/1080p/time.png b/res/default/img/1080p/time.png new file mode 100644 index 0000000..41440df Binary files /dev/null and b/res/default/img/1080p/time.png differ diff --git a/res/default/img/1080p/tracka.png b/res/default/img/1080p/tracka.png new file mode 100644 index 0000000..4bb2cec Binary files /dev/null and b/res/default/img/1080p/tracka.png differ diff --git a/res/default/img/1080p/trackd.png b/res/default/img/1080p/trackd.png new file mode 100644 index 0000000..a30fbee Binary files /dev/null and b/res/default/img/1080p/trackd.png differ diff --git a/res/default/img/1080p/tracks.png b/res/default/img/1080p/tracks.png new file mode 100644 index 0000000..84c79e0 Binary files /dev/null and b/res/default/img/1080p/tracks.png differ diff --git a/res/default/img/1080p/trackw.png b/res/default/img/1080p/trackw.png new file mode 100644 index 0000000..2dc50b6 Binary files /dev/null and b/res/default/img/1080p/trackw.png differ diff --git a/res/default/img/1080p/two.png b/res/default/img/1080p/two.png new file mode 100644 index 0000000..da914f3 Binary files /dev/null and b/res/default/img/1080p/two.png differ diff --git a/res/default/img/1080p/u.png b/res/default/img/1080p/u.png new file mode 100644 index 0000000..b879bf9 Binary files /dev/null and b/res/default/img/1080p/u.png differ diff --git a/res/default/img/1080p/v.png b/res/default/img/1080p/v.png new file mode 100644 index 0000000..2613d75 Binary files /dev/null and b/res/default/img/1080p/v.png differ diff --git a/res/default/img/1080p/w.png b/res/default/img/1080p/w.png new file mode 100644 index 0000000..26aaabd Binary files /dev/null and b/res/default/img/1080p/w.png differ diff --git a/res/default/img/1080p/x.png b/res/default/img/1080p/x.png new file mode 100644 index 0000000..0a67e8e Binary files /dev/null and b/res/default/img/1080p/x.png differ diff --git a/res/default/img/1080p/y.png b/res/default/img/1080p/y.png new file mode 100644 index 0000000..fa77594 Binary files /dev/null and b/res/default/img/1080p/y.png differ diff --git a/res/default/img/1080p/z.png b/res/default/img/1080p/z.png new file mode 100644 index 0000000..b8cb43f Binary files /dev/null and b/res/default/img/1080p/z.png differ diff --git a/res/default/img/1080p/zero.png b/res/default/img/1080p/zero.png new file mode 100644 index 0000000..a6df5b1 Binary files /dev/null and b/res/default/img/1080p/zero.png differ diff --git a/res/default/img/1440p/a.png b/res/default/img/1440p/a.png new file mode 100644 index 0000000..d08dcc2 Binary files /dev/null and b/res/default/img/1440p/a.png differ diff --git a/res/default/img/1440p/b.png b/res/default/img/1440p/b.png new file mode 100644 index 0000000..cddf3a3 Binary files /dev/null and b/res/default/img/1440p/b.png differ diff --git a/res/default/img/1440p/backone.png b/res/default/img/1440p/backone.png new file mode 100644 index 0000000..612439f Binary files /dev/null and b/res/default/img/1440p/backone.png differ diff --git a/res/default/img/1440p/backthree.png b/res/default/img/1440p/backthree.png new file mode 100644 index 0000000..af9452f Binary files /dev/null and b/res/default/img/1440p/backthree.png differ diff --git a/res/default/img/1440p/backtwo.png b/res/default/img/1440p/backtwo.png new file mode 100644 index 0000000..1421df2 Binary files /dev/null and b/res/default/img/1440p/backtwo.png differ diff --git a/res/default/img/1440p/c.png b/res/default/img/1440p/c.png new file mode 100644 index 0000000..52bf8ac Binary files /dev/null and b/res/default/img/1440p/c.png differ diff --git a/res/default/img/1440p/closed.png b/res/default/img/1440p/closed.png new file mode 100644 index 0000000..a5530e4 Binary files /dev/null and b/res/default/img/1440p/closed.png differ diff --git a/res/default/img/1440p/d.png b/res/default/img/1440p/d.png new file mode 100644 index 0000000..3bea110 Binary files /dev/null and b/res/default/img/1440p/d.png differ diff --git a/res/default/img/1440p/e.png b/res/default/img/1440p/e.png new file mode 100644 index 0000000..9f5db8e Binary files /dev/null and b/res/default/img/1440p/e.png differ diff --git a/res/default/img/1440p/easyone.png b/res/default/img/1440p/easyone.png new file mode 100644 index 0000000..28c3c2d Binary files /dev/null and b/res/default/img/1440p/easyone.png differ diff --git a/res/default/img/1440p/easythree.png b/res/default/img/1440p/easythree.png new file mode 100644 index 0000000..11d054a Binary files /dev/null and b/res/default/img/1440p/easythree.png differ diff --git a/res/default/img/1440p/easytwo.png b/res/default/img/1440p/easytwo.png new file mode 100644 index 0000000..ee32dc6 Binary files /dev/null and b/res/default/img/1440p/easytwo.png differ diff --git a/res/default/img/1440p/eight.png b/res/default/img/1440p/eight.png new file mode 100644 index 0000000..377be3b Binary files /dev/null and b/res/default/img/1440p/eight.png differ diff --git a/res/default/img/1440p/f.png b/res/default/img/1440p/f.png new file mode 100644 index 0000000..a6d5f28 Binary files /dev/null and b/res/default/img/1440p/f.png differ diff --git a/res/default/img/1440p/five.png b/res/default/img/1440p/five.png new file mode 100644 index 0000000..3a23942 Binary files /dev/null and b/res/default/img/1440p/five.png differ diff --git a/res/default/img/1440p/four.png b/res/default/img/1440p/four.png new file mode 100644 index 0000000..236b98c Binary files /dev/null and b/res/default/img/1440p/four.png differ diff --git a/res/default/img/1440p/g.png b/res/default/img/1440p/g.png new file mode 100644 index 0000000..7c3742d Binary files /dev/null and b/res/default/img/1440p/g.png differ diff --git a/res/default/img/1440p/gameover.png b/res/default/img/1440p/gameover.png new file mode 100644 index 0000000..5924fea Binary files /dev/null and b/res/default/img/1440p/gameover.png differ diff --git a/res/default/img/1440p/groups.png b/res/default/img/1440p/groups.png new file mode 100644 index 0000000..1e36b88 Binary files /dev/null and b/res/default/img/1440p/groups.png differ diff --git a/res/default/img/1440p/groupsize.png b/res/default/img/1440p/groupsize.png new file mode 100644 index 0000000..bf68c80 Binary files /dev/null and b/res/default/img/1440p/groupsize.png differ diff --git a/res/default/img/1440p/h.png b/res/default/img/1440p/h.png new file mode 100644 index 0000000..d178d60 Binary files /dev/null and b/res/default/img/1440p/h.png differ diff --git a/res/default/img/1440p/hardone.png b/res/default/img/1440p/hardone.png new file mode 100644 index 0000000..4a11529 Binary files /dev/null and b/res/default/img/1440p/hardone.png differ diff --git a/res/default/img/1440p/hardthree.png b/res/default/img/1440p/hardthree.png new file mode 100644 index 0000000..7af7766 Binary files /dev/null and b/res/default/img/1440p/hardthree.png differ diff --git a/res/default/img/1440p/hardtwo.png b/res/default/img/1440p/hardtwo.png new file mode 100644 index 0000000..7bede19 Binary files /dev/null and b/res/default/img/1440p/hardtwo.png differ diff --git a/res/default/img/1440p/helpone.png b/res/default/img/1440p/helpone.png new file mode 100644 index 0000000..70c7ff8 Binary files /dev/null and b/res/default/img/1440p/helpone.png differ diff --git a/res/default/img/1440p/helpthree.png b/res/default/img/1440p/helpthree.png new file mode 100644 index 0000000..059dcff Binary files /dev/null and b/res/default/img/1440p/helpthree.png differ diff --git a/res/default/img/1440p/helptwo.png b/res/default/img/1440p/helptwo.png new file mode 100644 index 0000000..baceb37 Binary files /dev/null and b/res/default/img/1440p/helptwo.png differ diff --git a/res/default/img/1440p/highscore.png b/res/default/img/1440p/highscore.png new file mode 100644 index 0000000..868eabd Binary files /dev/null and b/res/default/img/1440p/highscore.png differ diff --git a/res/default/img/1440p/i.png b/res/default/img/1440p/i.png new file mode 100644 index 0000000..c4603da Binary files /dev/null and b/res/default/img/1440p/i.png differ diff --git a/res/default/img/1440p/j.png b/res/default/img/1440p/j.png new file mode 100644 index 0000000..0e84006 Binary files /dev/null and b/res/default/img/1440p/j.png differ diff --git a/res/default/img/1440p/k.png b/res/default/img/1440p/k.png new file mode 100644 index 0000000..c19e735 Binary files /dev/null and b/res/default/img/1440p/k.png differ diff --git a/res/default/img/1440p/l.png b/res/default/img/1440p/l.png new file mode 100644 index 0000000..673e302 Binary files /dev/null and b/res/default/img/1440p/l.png differ diff --git a/res/default/img/1440p/logo.png b/res/default/img/1440p/logo.png new file mode 100644 index 0000000..3fa5c6e Binary files /dev/null and b/res/default/img/1440p/logo.png differ diff --git a/res/default/img/1440p/m.png b/res/default/img/1440p/m.png new file mode 100644 index 0000000..24ca8a8 Binary files /dev/null and b/res/default/img/1440p/m.png differ diff --git a/res/default/img/1440p/medone.png b/res/default/img/1440p/medone.png new file mode 100644 index 0000000..934f905 Binary files /dev/null and b/res/default/img/1440p/medone.png differ diff --git a/res/default/img/1440p/medthree.png b/res/default/img/1440p/medthree.png new file mode 100644 index 0000000..5737823 Binary files /dev/null and b/res/default/img/1440p/medthree.png differ diff --git a/res/default/img/1440p/medtwo.png b/res/default/img/1440p/medtwo.png new file mode 100644 index 0000000..e5b881e Binary files /dev/null and b/res/default/img/1440p/medtwo.png differ diff --git a/res/default/img/1440p/n.png b/res/default/img/1440p/n.png new file mode 100644 index 0000000..1b42156 Binary files /dev/null and b/res/default/img/1440p/n.png differ diff --git a/res/default/img/1440p/nextone.png b/res/default/img/1440p/nextone.png new file mode 100644 index 0000000..4a2256f Binary files /dev/null and b/res/default/img/1440p/nextone.png differ diff --git a/res/default/img/1440p/nextthree.png b/res/default/img/1440p/nextthree.png new file mode 100644 index 0000000..b08698b Binary files /dev/null and b/res/default/img/1440p/nextthree.png differ diff --git a/res/default/img/1440p/nexttwo.png b/res/default/img/1440p/nexttwo.png new file mode 100644 index 0000000..9b3bf58 Binary files /dev/null and b/res/default/img/1440p/nexttwo.png differ diff --git a/res/default/img/1440p/nine.png b/res/default/img/1440p/nine.png new file mode 100644 index 0000000..a30c6e9 Binary files /dev/null and b/res/default/img/1440p/nine.png differ diff --git a/res/default/img/1440p/o.png b/res/default/img/1440p/o.png new file mode 100644 index 0000000..beb1a9c Binary files /dev/null and b/res/default/img/1440p/o.png differ diff --git a/res/default/img/1440p/one.png b/res/default/img/1440p/one.png new file mode 100644 index 0000000..695c6cb Binary files /dev/null and b/res/default/img/1440p/one.png differ diff --git a/res/default/img/1440p/open.png b/res/default/img/1440p/open.png new file mode 100644 index 0000000..b94e805 Binary files /dev/null and b/res/default/img/1440p/open.png differ diff --git a/res/default/img/1440p/p.png b/res/default/img/1440p/p.png new file mode 100644 index 0000000..814a204 Binary files /dev/null and b/res/default/img/1440p/p.png differ diff --git a/res/default/img/1440p/playicon.png b/res/default/img/1440p/playicon.png new file mode 100644 index 0000000..e5f6993 Binary files /dev/null and b/res/default/img/1440p/playicon.png differ diff --git a/res/default/img/1440p/prevone.png b/res/default/img/1440p/prevone.png new file mode 100644 index 0000000..082e55c Binary files /dev/null and b/res/default/img/1440p/prevone.png differ diff --git a/res/default/img/1440p/prevthree.png b/res/default/img/1440p/prevthree.png new file mode 100644 index 0000000..f7f24f9 Binary files /dev/null and b/res/default/img/1440p/prevthree.png differ diff --git a/res/default/img/1440p/prevtwo.png b/res/default/img/1440p/prevtwo.png new file mode 100644 index 0000000..7ecf642 Binary files /dev/null and b/res/default/img/1440p/prevtwo.png differ diff --git a/res/default/img/1440p/q.png b/res/default/img/1440p/q.png new file mode 100644 index 0000000..d7e83c2 Binary files /dev/null and b/res/default/img/1440p/q.png differ diff --git a/res/default/img/1440p/r.png b/res/default/img/1440p/r.png new file mode 100644 index 0000000..387a35d Binary files /dev/null and b/res/default/img/1440p/r.png differ diff --git a/res/default/img/1440p/s.png b/res/default/img/1440p/s.png new file mode 100644 index 0000000..6ebc231 Binary files /dev/null and b/res/default/img/1440p/s.png differ diff --git a/res/default/img/1440p/score.png b/res/default/img/1440p/score.png new file mode 100644 index 0000000..8d9ba62 Binary files /dev/null and b/res/default/img/1440p/score.png differ diff --git a/res/default/img/1440p/seven.png b/res/default/img/1440p/seven.png new file mode 100644 index 0000000..be715a5 Binary files /dev/null and b/res/default/img/1440p/seven.png differ diff --git a/res/default/img/1440p/six.png b/res/default/img/1440p/six.png new file mode 100644 index 0000000..86b88a4 Binary files /dev/null and b/res/default/img/1440p/six.png differ diff --git a/res/default/img/1440p/space.png b/res/default/img/1440p/space.png new file mode 100644 index 0000000..138a040 Binary files /dev/null and b/res/default/img/1440p/space.png differ diff --git a/res/default/img/1440p/stack.png b/res/default/img/1440p/stack.png new file mode 100644 index 0000000..d6a98ff Binary files /dev/null and b/res/default/img/1440p/stack.png differ diff --git a/res/default/img/1440p/t.png b/res/default/img/1440p/t.png new file mode 100644 index 0000000..afcc03d Binary files /dev/null and b/res/default/img/1440p/t.png differ diff --git a/res/default/img/1440p/three.png b/res/default/img/1440p/three.png new file mode 100644 index 0000000..d2b2541 Binary files /dev/null and b/res/default/img/1440p/three.png differ diff --git a/res/default/img/1440p/time.png b/res/default/img/1440p/time.png new file mode 100644 index 0000000..e898392 Binary files /dev/null and b/res/default/img/1440p/time.png differ diff --git a/res/default/img/1440p/tracka.png b/res/default/img/1440p/tracka.png new file mode 100644 index 0000000..bc53b24 Binary files /dev/null and b/res/default/img/1440p/tracka.png differ diff --git a/res/default/img/1440p/trackd.png b/res/default/img/1440p/trackd.png new file mode 100644 index 0000000..204ead7 Binary files /dev/null and b/res/default/img/1440p/trackd.png differ diff --git a/res/default/img/1440p/tracks.png b/res/default/img/1440p/tracks.png new file mode 100644 index 0000000..1d5f5e3 Binary files /dev/null and b/res/default/img/1440p/tracks.png differ diff --git a/res/default/img/1440p/trackw.png b/res/default/img/1440p/trackw.png new file mode 100644 index 0000000..c2c181f Binary files /dev/null and b/res/default/img/1440p/trackw.png differ diff --git a/res/default/img/1440p/two.png b/res/default/img/1440p/two.png new file mode 100644 index 0000000..01410b8 Binary files /dev/null and b/res/default/img/1440p/two.png differ diff --git a/res/default/img/1440p/u.png b/res/default/img/1440p/u.png new file mode 100644 index 0000000..93f23ae Binary files /dev/null and b/res/default/img/1440p/u.png differ diff --git a/res/default/img/1440p/v.png b/res/default/img/1440p/v.png new file mode 100644 index 0000000..c129054 Binary files /dev/null and b/res/default/img/1440p/v.png differ diff --git a/res/default/img/1440p/w.png b/res/default/img/1440p/w.png new file mode 100644 index 0000000..c38cb5b Binary files /dev/null and b/res/default/img/1440p/w.png differ diff --git a/res/default/img/1440p/x.png b/res/default/img/1440p/x.png new file mode 100644 index 0000000..758e64a Binary files /dev/null and b/res/default/img/1440p/x.png differ diff --git a/res/default/img/1440p/y.png b/res/default/img/1440p/y.png new file mode 100644 index 0000000..20100d8 Binary files /dev/null and b/res/default/img/1440p/y.png differ diff --git a/res/default/img/1440p/z.png b/res/default/img/1440p/z.png new file mode 100644 index 0000000..fff4a8e Binary files /dev/null and b/res/default/img/1440p/z.png differ diff --git a/res/default/img/1440p/zero.png b/res/default/img/1440p/zero.png new file mode 100644 index 0000000..a3b2b0f Binary files /dev/null and b/res/default/img/1440p/zero.png differ diff --git a/res/default/img/4k/a.png b/res/default/img/4k/a.png new file mode 100644 index 0000000..e5561e1 Binary files /dev/null and b/res/default/img/4k/a.png differ diff --git a/res/default/img/4k/b.png b/res/default/img/4k/b.png new file mode 100644 index 0000000..b707385 Binary files /dev/null and b/res/default/img/4k/b.png differ diff --git a/res/default/img/4k/backone.png b/res/default/img/4k/backone.png new file mode 100644 index 0000000..0a893a2 Binary files /dev/null and b/res/default/img/4k/backone.png differ diff --git a/res/default/img/4k/backthree.png b/res/default/img/4k/backthree.png new file mode 100644 index 0000000..b587bcd Binary files /dev/null and b/res/default/img/4k/backthree.png differ diff --git a/res/default/img/4k/backtwo.png b/res/default/img/4k/backtwo.png new file mode 100644 index 0000000..e4ecf71 Binary files /dev/null and b/res/default/img/4k/backtwo.png differ diff --git a/res/default/img/4k/c.png b/res/default/img/4k/c.png new file mode 100644 index 0000000..8319716 Binary files /dev/null and b/res/default/img/4k/c.png differ diff --git a/res/default/img/4k/closed.png b/res/default/img/4k/closed.png new file mode 100644 index 0000000..aec7bd0 Binary files /dev/null and b/res/default/img/4k/closed.png differ diff --git a/res/default/img/4k/d.png b/res/default/img/4k/d.png new file mode 100644 index 0000000..4a75422 Binary files /dev/null and b/res/default/img/4k/d.png differ diff --git a/res/default/img/4k/e.png b/res/default/img/4k/e.png new file mode 100644 index 0000000..13d8336 Binary files /dev/null and b/res/default/img/4k/e.png differ diff --git a/res/default/img/4k/easyone.png b/res/default/img/4k/easyone.png new file mode 100644 index 0000000..2f2e42c Binary files /dev/null and b/res/default/img/4k/easyone.png differ diff --git a/res/default/img/4k/easythree.png b/res/default/img/4k/easythree.png new file mode 100644 index 0000000..f033f1e Binary files /dev/null and b/res/default/img/4k/easythree.png differ diff --git a/res/default/img/4k/easytwo.png b/res/default/img/4k/easytwo.png new file mode 100644 index 0000000..e2cfaa1 Binary files /dev/null and b/res/default/img/4k/easytwo.png differ diff --git a/res/default/img/4k/eight.png b/res/default/img/4k/eight.png new file mode 100644 index 0000000..ee2dd56 Binary files /dev/null and b/res/default/img/4k/eight.png differ diff --git a/res/default/img/4k/f.png b/res/default/img/4k/f.png new file mode 100644 index 0000000..01a0a9c Binary files /dev/null and b/res/default/img/4k/f.png differ diff --git a/res/default/img/4k/five.png b/res/default/img/4k/five.png new file mode 100644 index 0000000..a903876 Binary files /dev/null and b/res/default/img/4k/five.png differ diff --git a/res/default/img/4k/four.png b/res/default/img/4k/four.png new file mode 100644 index 0000000..46de326 Binary files /dev/null and b/res/default/img/4k/four.png differ diff --git a/res/default/img/4k/g.png b/res/default/img/4k/g.png new file mode 100644 index 0000000..36f90d5 Binary files /dev/null and b/res/default/img/4k/g.png differ diff --git a/res/default/img/4k/gameover.png b/res/default/img/4k/gameover.png new file mode 100644 index 0000000..8476a81 Binary files /dev/null and b/res/default/img/4k/gameover.png differ diff --git a/res/default/img/4k/groups.png b/res/default/img/4k/groups.png new file mode 100644 index 0000000..525f2fc Binary files /dev/null and b/res/default/img/4k/groups.png differ diff --git a/res/default/img/4k/groupsize.png b/res/default/img/4k/groupsize.png new file mode 100644 index 0000000..81dff24 Binary files /dev/null and b/res/default/img/4k/groupsize.png differ diff --git a/res/default/img/4k/h.png b/res/default/img/4k/h.png new file mode 100644 index 0000000..86e252d Binary files /dev/null and b/res/default/img/4k/h.png differ diff --git a/res/default/img/4k/hardone.png b/res/default/img/4k/hardone.png new file mode 100644 index 0000000..d5bc2fd Binary files /dev/null and b/res/default/img/4k/hardone.png differ diff --git a/res/default/img/4k/hardthree.png b/res/default/img/4k/hardthree.png new file mode 100644 index 0000000..3831344 Binary files /dev/null and b/res/default/img/4k/hardthree.png differ diff --git a/res/default/img/4k/hardtwo.png b/res/default/img/4k/hardtwo.png new file mode 100644 index 0000000..aa4075a Binary files /dev/null and b/res/default/img/4k/hardtwo.png differ diff --git a/res/default/img/4k/helpone.png b/res/default/img/4k/helpone.png new file mode 100644 index 0000000..3c3ee65 Binary files /dev/null and b/res/default/img/4k/helpone.png differ diff --git a/res/default/img/4k/helpthree.png b/res/default/img/4k/helpthree.png new file mode 100644 index 0000000..18168d2 Binary files /dev/null and b/res/default/img/4k/helpthree.png differ diff --git a/res/default/img/4k/helptwo.png b/res/default/img/4k/helptwo.png new file mode 100644 index 0000000..14ba255 Binary files /dev/null and b/res/default/img/4k/helptwo.png differ diff --git a/res/default/img/4k/highscore.png b/res/default/img/4k/highscore.png new file mode 100644 index 0000000..2c15643 Binary files /dev/null and b/res/default/img/4k/highscore.png differ diff --git a/res/default/img/4k/i.png b/res/default/img/4k/i.png new file mode 100644 index 0000000..a4191d0 Binary files /dev/null and b/res/default/img/4k/i.png differ diff --git a/res/default/img/4k/j.png b/res/default/img/4k/j.png new file mode 100644 index 0000000..718b6cc Binary files /dev/null and b/res/default/img/4k/j.png differ diff --git a/res/default/img/4k/k.png b/res/default/img/4k/k.png new file mode 100644 index 0000000..2370bec Binary files /dev/null and b/res/default/img/4k/k.png differ diff --git a/res/default/img/4k/l.png b/res/default/img/4k/l.png new file mode 100644 index 0000000..17610a1 Binary files /dev/null and b/res/default/img/4k/l.png differ diff --git a/res/default/img/4k/logo.png b/res/default/img/4k/logo.png new file mode 100644 index 0000000..fcda497 Binary files /dev/null and b/res/default/img/4k/logo.png differ diff --git a/res/default/img/4k/m.png b/res/default/img/4k/m.png new file mode 100644 index 0000000..8d8a1fc Binary files /dev/null and b/res/default/img/4k/m.png differ diff --git a/res/default/img/4k/medone.png b/res/default/img/4k/medone.png new file mode 100644 index 0000000..6323b5f Binary files /dev/null and b/res/default/img/4k/medone.png differ diff --git a/res/default/img/4k/medthree.png b/res/default/img/4k/medthree.png new file mode 100644 index 0000000..5653d99 Binary files /dev/null and b/res/default/img/4k/medthree.png differ diff --git a/res/default/img/4k/medtwo.png b/res/default/img/4k/medtwo.png new file mode 100644 index 0000000..466cf2a Binary files /dev/null and b/res/default/img/4k/medtwo.png differ diff --git a/res/default/img/4k/n.png b/res/default/img/4k/n.png new file mode 100644 index 0000000..c04f197 Binary files /dev/null and b/res/default/img/4k/n.png differ diff --git a/res/default/img/4k/nextone.png b/res/default/img/4k/nextone.png new file mode 100644 index 0000000..34f0dd8 Binary files /dev/null and b/res/default/img/4k/nextone.png differ diff --git a/res/default/img/4k/nextthree.png b/res/default/img/4k/nextthree.png new file mode 100644 index 0000000..1a185b5 Binary files /dev/null and b/res/default/img/4k/nextthree.png differ diff --git a/res/default/img/4k/nexttwo.png b/res/default/img/4k/nexttwo.png new file mode 100644 index 0000000..1849e1c Binary files /dev/null and b/res/default/img/4k/nexttwo.png differ diff --git a/res/default/img/4k/nine.png b/res/default/img/4k/nine.png new file mode 100644 index 0000000..4ae8eb0 Binary files /dev/null and b/res/default/img/4k/nine.png differ diff --git a/res/default/img/4k/o.png b/res/default/img/4k/o.png new file mode 100644 index 0000000..7a19eaa Binary files /dev/null and b/res/default/img/4k/o.png differ diff --git a/res/default/img/4k/one.png b/res/default/img/4k/one.png new file mode 100644 index 0000000..b09382e Binary files /dev/null and b/res/default/img/4k/one.png differ diff --git a/res/default/img/4k/open.png b/res/default/img/4k/open.png new file mode 100644 index 0000000..b84c86b Binary files /dev/null and b/res/default/img/4k/open.png differ diff --git a/res/default/img/4k/p.png b/res/default/img/4k/p.png new file mode 100644 index 0000000..68f954a Binary files /dev/null and b/res/default/img/4k/p.png differ diff --git a/res/default/img/4k/playicon.png b/res/default/img/4k/playicon.png new file mode 100644 index 0000000..22a00c7 Binary files /dev/null and b/res/default/img/4k/playicon.png differ diff --git a/res/default/img/4k/prevone.png b/res/default/img/4k/prevone.png new file mode 100644 index 0000000..f3c7947 Binary files /dev/null and b/res/default/img/4k/prevone.png differ diff --git a/res/default/img/4k/prevthree.png b/res/default/img/4k/prevthree.png new file mode 100644 index 0000000..7232aa3 Binary files /dev/null and b/res/default/img/4k/prevthree.png differ diff --git a/res/default/img/4k/prevtwo.png b/res/default/img/4k/prevtwo.png new file mode 100644 index 0000000..a0df307 Binary files /dev/null and b/res/default/img/4k/prevtwo.png differ diff --git a/res/default/img/4k/q.png b/res/default/img/4k/q.png new file mode 100644 index 0000000..ab8e92a Binary files /dev/null and b/res/default/img/4k/q.png differ diff --git a/res/default/img/4k/r.png b/res/default/img/4k/r.png new file mode 100644 index 0000000..e48f065 Binary files /dev/null and b/res/default/img/4k/r.png differ diff --git a/res/default/img/4k/s.png b/res/default/img/4k/s.png new file mode 100644 index 0000000..a6bc51e Binary files /dev/null and b/res/default/img/4k/s.png differ diff --git a/res/default/img/4k/score.png b/res/default/img/4k/score.png new file mode 100644 index 0000000..bc29378 Binary files /dev/null and b/res/default/img/4k/score.png differ diff --git a/res/default/img/4k/seven.png b/res/default/img/4k/seven.png new file mode 100644 index 0000000..29d0b38 Binary files /dev/null and b/res/default/img/4k/seven.png differ diff --git a/res/default/img/4k/six.png b/res/default/img/4k/six.png new file mode 100644 index 0000000..decd3f6 Binary files /dev/null and b/res/default/img/4k/six.png differ diff --git a/res/default/img/4k/space.png b/res/default/img/4k/space.png new file mode 100644 index 0000000..3c3d429 Binary files /dev/null and b/res/default/img/4k/space.png differ diff --git a/res/default/img/4k/stack.png b/res/default/img/4k/stack.png new file mode 100644 index 0000000..0af1c7e Binary files /dev/null and b/res/default/img/4k/stack.png differ diff --git a/res/default/img/4k/t.png b/res/default/img/4k/t.png new file mode 100644 index 0000000..09e3161 Binary files /dev/null and b/res/default/img/4k/t.png differ diff --git a/res/default/img/4k/three.png b/res/default/img/4k/three.png new file mode 100644 index 0000000..0222b90 Binary files /dev/null and b/res/default/img/4k/three.png differ diff --git a/res/default/img/4k/time.png b/res/default/img/4k/time.png new file mode 100644 index 0000000..6602acf Binary files /dev/null and b/res/default/img/4k/time.png differ diff --git a/res/default/img/4k/tracka.png b/res/default/img/4k/tracka.png new file mode 100644 index 0000000..351e759 Binary files /dev/null and b/res/default/img/4k/tracka.png differ diff --git a/res/default/img/4k/trackd.png b/res/default/img/4k/trackd.png new file mode 100644 index 0000000..9d61063 Binary files /dev/null and b/res/default/img/4k/trackd.png differ diff --git a/res/default/img/4k/tracks.png b/res/default/img/4k/tracks.png new file mode 100644 index 0000000..cce9608 Binary files /dev/null and b/res/default/img/4k/tracks.png differ diff --git a/res/default/img/4k/trackw.png b/res/default/img/4k/trackw.png new file mode 100644 index 0000000..b0dcbd9 Binary files /dev/null and b/res/default/img/4k/trackw.png differ diff --git a/res/default/img/4k/two.png b/res/default/img/4k/two.png new file mode 100644 index 0000000..41785dc Binary files /dev/null and b/res/default/img/4k/two.png differ diff --git a/res/default/img/4k/u.png b/res/default/img/4k/u.png new file mode 100644 index 0000000..ab1e8f2 Binary files /dev/null and b/res/default/img/4k/u.png differ diff --git a/res/default/img/4k/v.png b/res/default/img/4k/v.png new file mode 100644 index 0000000..a82945b Binary files /dev/null and b/res/default/img/4k/v.png differ diff --git a/res/default/img/4k/w.png b/res/default/img/4k/w.png new file mode 100644 index 0000000..2ed4097 Binary files /dev/null and b/res/default/img/4k/w.png differ diff --git a/res/default/img/4k/x.png b/res/default/img/4k/x.png new file mode 100644 index 0000000..a4195bd Binary files /dev/null and b/res/default/img/4k/x.png differ diff --git a/res/default/img/4k/y.png b/res/default/img/4k/y.png new file mode 100644 index 0000000..a134711 Binary files /dev/null and b/res/default/img/4k/y.png differ diff --git a/res/default/img/4k/z.png b/res/default/img/4k/z.png new file mode 100644 index 0000000..4205a33 Binary files /dev/null and b/res/default/img/4k/z.png differ diff --git a/res/default/img/4k/zero.png b/res/default/img/4k/zero.png new file mode 100644 index 0000000..8aa5413 Binary files /dev/null and b/res/default/img/4k/zero.png differ diff --git a/res/default/img/720p/a.png b/res/default/img/720p/a.png new file mode 100644 index 0000000..f966d7a Binary files /dev/null and b/res/default/img/720p/a.png differ diff --git a/res/default/img/720p/b.png b/res/default/img/720p/b.png new file mode 100644 index 0000000..f3d1329 Binary files /dev/null and b/res/default/img/720p/b.png differ diff --git a/res/default/img/720p/backone.png b/res/default/img/720p/backone.png new file mode 100644 index 0000000..054d1fc Binary files /dev/null and b/res/default/img/720p/backone.png differ diff --git a/res/default/img/720p/backthree.png b/res/default/img/720p/backthree.png new file mode 100644 index 0000000..777eb41 Binary files /dev/null and b/res/default/img/720p/backthree.png differ diff --git a/res/default/img/720p/backtwo.png b/res/default/img/720p/backtwo.png new file mode 100644 index 0000000..195476a Binary files /dev/null and b/res/default/img/720p/backtwo.png differ diff --git a/res/default/img/720p/c.png b/res/default/img/720p/c.png new file mode 100644 index 0000000..3cb0bb7 Binary files /dev/null and b/res/default/img/720p/c.png differ diff --git a/res/default/img/720p/closed.png b/res/default/img/720p/closed.png new file mode 100644 index 0000000..d539288 Binary files /dev/null and b/res/default/img/720p/closed.png differ diff --git a/res/default/img/720p/d.png b/res/default/img/720p/d.png new file mode 100644 index 0000000..b8b4c15 Binary files /dev/null and b/res/default/img/720p/d.png differ diff --git a/res/default/img/720p/e.png b/res/default/img/720p/e.png new file mode 100644 index 0000000..062d9b7 Binary files /dev/null and b/res/default/img/720p/e.png differ diff --git a/res/default/img/720p/easyone.png b/res/default/img/720p/easyone.png new file mode 100644 index 0000000..a430810 Binary files /dev/null and b/res/default/img/720p/easyone.png differ diff --git a/res/default/img/720p/easythree.png b/res/default/img/720p/easythree.png new file mode 100644 index 0000000..8591647 Binary files /dev/null and b/res/default/img/720p/easythree.png differ diff --git a/res/default/img/720p/easytwo.png b/res/default/img/720p/easytwo.png new file mode 100644 index 0000000..778f50d Binary files /dev/null and b/res/default/img/720p/easytwo.png differ diff --git a/res/default/img/720p/eight.png b/res/default/img/720p/eight.png new file mode 100644 index 0000000..157e870 Binary files /dev/null and b/res/default/img/720p/eight.png differ diff --git a/res/default/img/720p/f.png b/res/default/img/720p/f.png new file mode 100644 index 0000000..5514b20 Binary files /dev/null and b/res/default/img/720p/f.png differ diff --git a/res/default/img/720p/five.png b/res/default/img/720p/five.png new file mode 100644 index 0000000..2c75232 Binary files /dev/null and b/res/default/img/720p/five.png differ diff --git a/res/default/img/720p/four.png b/res/default/img/720p/four.png new file mode 100644 index 0000000..6afd434 Binary files /dev/null and b/res/default/img/720p/four.png differ diff --git a/res/default/img/720p/g.png b/res/default/img/720p/g.png new file mode 100644 index 0000000..5164451 Binary files /dev/null and b/res/default/img/720p/g.png differ diff --git a/res/default/img/720p/gameover.png b/res/default/img/720p/gameover.png new file mode 100644 index 0000000..e458732 Binary files /dev/null and b/res/default/img/720p/gameover.png differ diff --git a/res/default/img/720p/groups.png b/res/default/img/720p/groups.png new file mode 100644 index 0000000..1b65534 Binary files /dev/null and b/res/default/img/720p/groups.png differ diff --git a/res/default/img/720p/groupsize.png b/res/default/img/720p/groupsize.png new file mode 100644 index 0000000..0ff4853 Binary files /dev/null and b/res/default/img/720p/groupsize.png differ diff --git a/res/default/img/720p/h.png b/res/default/img/720p/h.png new file mode 100644 index 0000000..8b675ef Binary files /dev/null and b/res/default/img/720p/h.png differ diff --git a/res/default/img/720p/hardone.png b/res/default/img/720p/hardone.png new file mode 100644 index 0000000..ffa9da6 Binary files /dev/null and b/res/default/img/720p/hardone.png differ diff --git a/res/default/img/720p/hardthree.png b/res/default/img/720p/hardthree.png new file mode 100644 index 0000000..99737f4 Binary files /dev/null and b/res/default/img/720p/hardthree.png differ diff --git a/res/default/img/720p/hardtwo.png b/res/default/img/720p/hardtwo.png new file mode 100644 index 0000000..eabac14 Binary files /dev/null and b/res/default/img/720p/hardtwo.png differ diff --git a/res/default/img/720p/helpone.png b/res/default/img/720p/helpone.png new file mode 100644 index 0000000..7de9fc3 Binary files /dev/null and b/res/default/img/720p/helpone.png differ diff --git a/res/default/img/720p/helpthree.png b/res/default/img/720p/helpthree.png new file mode 100644 index 0000000..6e29abd Binary files /dev/null and b/res/default/img/720p/helpthree.png differ diff --git a/res/default/img/720p/helptwo.png b/res/default/img/720p/helptwo.png new file mode 100644 index 0000000..5b5b670 Binary files /dev/null and b/res/default/img/720p/helptwo.png differ diff --git a/res/default/img/720p/highscore.png b/res/default/img/720p/highscore.png new file mode 100644 index 0000000..b94d45c Binary files /dev/null and b/res/default/img/720p/highscore.png differ diff --git a/res/default/img/720p/i.png b/res/default/img/720p/i.png new file mode 100644 index 0000000..3b0010e Binary files /dev/null and b/res/default/img/720p/i.png differ diff --git a/res/default/img/720p/j.png b/res/default/img/720p/j.png new file mode 100644 index 0000000..54e3b45 Binary files /dev/null and b/res/default/img/720p/j.png differ diff --git a/res/default/img/720p/k.png b/res/default/img/720p/k.png new file mode 100644 index 0000000..8343560 Binary files /dev/null and b/res/default/img/720p/k.png differ diff --git a/res/default/img/720p/l.png b/res/default/img/720p/l.png new file mode 100644 index 0000000..8a690dc Binary files /dev/null and b/res/default/img/720p/l.png differ diff --git a/res/default/img/720p/logo.png b/res/default/img/720p/logo.png new file mode 100644 index 0000000..1275f3a Binary files /dev/null and b/res/default/img/720p/logo.png differ diff --git a/res/default/img/720p/m.png b/res/default/img/720p/m.png new file mode 100644 index 0000000..d19431b Binary files /dev/null and b/res/default/img/720p/m.png differ diff --git a/res/default/img/720p/medone.png b/res/default/img/720p/medone.png new file mode 100644 index 0000000..c9fcf0b Binary files /dev/null and b/res/default/img/720p/medone.png differ diff --git a/res/default/img/720p/medthree.png b/res/default/img/720p/medthree.png new file mode 100644 index 0000000..7174526 Binary files /dev/null and b/res/default/img/720p/medthree.png differ diff --git a/res/default/img/720p/medtwo.png b/res/default/img/720p/medtwo.png new file mode 100644 index 0000000..ad3f86b Binary files /dev/null and b/res/default/img/720p/medtwo.png differ diff --git a/res/default/img/720p/n.png b/res/default/img/720p/n.png new file mode 100644 index 0000000..193cd90 Binary files /dev/null and b/res/default/img/720p/n.png differ diff --git a/res/default/img/720p/nextone.png b/res/default/img/720p/nextone.png new file mode 100644 index 0000000..779ee85 Binary files /dev/null and b/res/default/img/720p/nextone.png differ diff --git a/res/default/img/720p/nextthree.png b/res/default/img/720p/nextthree.png new file mode 100644 index 0000000..4ae20fe Binary files /dev/null and b/res/default/img/720p/nextthree.png differ diff --git a/res/default/img/720p/nexttwo.png b/res/default/img/720p/nexttwo.png new file mode 100644 index 0000000..297d02b Binary files /dev/null and b/res/default/img/720p/nexttwo.png differ diff --git a/res/default/img/720p/nine.png b/res/default/img/720p/nine.png new file mode 100644 index 0000000..a94f8d7 Binary files /dev/null and b/res/default/img/720p/nine.png differ diff --git a/res/default/img/720p/o.png b/res/default/img/720p/o.png new file mode 100644 index 0000000..8ddacbc Binary files /dev/null and b/res/default/img/720p/o.png differ diff --git a/res/default/img/720p/one.png b/res/default/img/720p/one.png new file mode 100644 index 0000000..004e490 Binary files /dev/null and b/res/default/img/720p/one.png differ diff --git a/res/default/img/720p/open.png b/res/default/img/720p/open.png new file mode 100644 index 0000000..060cab3 Binary files /dev/null and b/res/default/img/720p/open.png differ diff --git a/res/default/img/720p/p.png b/res/default/img/720p/p.png new file mode 100644 index 0000000..26be717 Binary files /dev/null and b/res/default/img/720p/p.png differ diff --git a/res/default/img/720p/playicon.png b/res/default/img/720p/playicon.png new file mode 100644 index 0000000..696a404 Binary files /dev/null and b/res/default/img/720p/playicon.png differ diff --git a/res/default/img/720p/prevone.png b/res/default/img/720p/prevone.png new file mode 100644 index 0000000..da7f841 Binary files /dev/null and b/res/default/img/720p/prevone.png differ diff --git a/res/default/img/720p/prevthree.png b/res/default/img/720p/prevthree.png new file mode 100644 index 0000000..21a7ec5 Binary files /dev/null and b/res/default/img/720p/prevthree.png differ diff --git a/res/default/img/720p/prevtwo.png b/res/default/img/720p/prevtwo.png new file mode 100644 index 0000000..3dd58ef Binary files /dev/null and b/res/default/img/720p/prevtwo.png differ diff --git a/res/default/img/720p/q.png b/res/default/img/720p/q.png new file mode 100644 index 0000000..c5c6b49 Binary files /dev/null and b/res/default/img/720p/q.png differ diff --git a/res/default/img/720p/r.png b/res/default/img/720p/r.png new file mode 100644 index 0000000..a4199a9 Binary files /dev/null and b/res/default/img/720p/r.png differ diff --git a/res/default/img/720p/s.png b/res/default/img/720p/s.png new file mode 100644 index 0000000..6484e85 Binary files /dev/null and b/res/default/img/720p/s.png differ diff --git a/res/default/img/720p/score.png b/res/default/img/720p/score.png new file mode 100644 index 0000000..63ca257 Binary files /dev/null and b/res/default/img/720p/score.png differ diff --git a/res/default/img/720p/seven.png b/res/default/img/720p/seven.png new file mode 100644 index 0000000..8711ecb Binary files /dev/null and b/res/default/img/720p/seven.png differ diff --git a/res/default/img/720p/six.png b/res/default/img/720p/six.png new file mode 100644 index 0000000..953b4a5 Binary files /dev/null and b/res/default/img/720p/six.png differ diff --git a/res/default/img/720p/space.png b/res/default/img/720p/space.png new file mode 100644 index 0000000..989d981 Binary files /dev/null and b/res/default/img/720p/space.png differ diff --git a/res/default/img/720p/stack.png b/res/default/img/720p/stack.png new file mode 100644 index 0000000..38887fa Binary files /dev/null and b/res/default/img/720p/stack.png differ diff --git a/res/default/img/720p/t.png b/res/default/img/720p/t.png new file mode 100644 index 0000000..2a9f607 Binary files /dev/null and b/res/default/img/720p/t.png differ diff --git a/res/default/img/720p/three.png b/res/default/img/720p/three.png new file mode 100644 index 0000000..e6b368b Binary files /dev/null and b/res/default/img/720p/three.png differ diff --git a/res/default/img/720p/time.png b/res/default/img/720p/time.png new file mode 100644 index 0000000..e85f206 Binary files /dev/null and b/res/default/img/720p/time.png differ diff --git a/res/default/img/720p/tracka.png b/res/default/img/720p/tracka.png new file mode 100644 index 0000000..9db45e7 Binary files /dev/null and b/res/default/img/720p/tracka.png differ diff --git a/res/default/img/720p/trackd.png b/res/default/img/720p/trackd.png new file mode 100644 index 0000000..06f4d82 Binary files /dev/null and b/res/default/img/720p/trackd.png differ diff --git a/res/default/img/720p/tracks.png b/res/default/img/720p/tracks.png new file mode 100644 index 0000000..78863f4 Binary files /dev/null and b/res/default/img/720p/tracks.png differ diff --git a/res/default/img/720p/trackw.png b/res/default/img/720p/trackw.png new file mode 100644 index 0000000..1142bac Binary files /dev/null and b/res/default/img/720p/trackw.png differ diff --git a/res/default/img/720p/two.png b/res/default/img/720p/two.png new file mode 100644 index 0000000..1b8a9f5 Binary files /dev/null and b/res/default/img/720p/two.png differ diff --git a/res/default/img/720p/u.png b/res/default/img/720p/u.png new file mode 100644 index 0000000..ab89ca9 Binary files /dev/null and b/res/default/img/720p/u.png differ diff --git a/res/default/img/720p/v.png b/res/default/img/720p/v.png new file mode 100644 index 0000000..12b9c7b Binary files /dev/null and b/res/default/img/720p/v.png differ diff --git a/res/default/img/720p/w.png b/res/default/img/720p/w.png new file mode 100644 index 0000000..935765b Binary files /dev/null and b/res/default/img/720p/w.png differ diff --git a/res/default/img/720p/x.png b/res/default/img/720p/x.png new file mode 100644 index 0000000..c04128f Binary files /dev/null and b/res/default/img/720p/x.png differ diff --git a/res/default/img/720p/y.png b/res/default/img/720p/y.png new file mode 100644 index 0000000..3b45919 Binary files /dev/null and b/res/default/img/720p/y.png differ diff --git a/res/default/img/720p/z.png b/res/default/img/720p/z.png new file mode 100644 index 0000000..3060985 Binary files /dev/null and b/res/default/img/720p/z.png differ diff --git a/res/default/img/720p/zero.png b/res/default/img/720p/zero.png new file mode 100644 index 0000000..7f9492b Binary files /dev/null and b/res/default/img/720p/zero.png differ diff --git a/res/default/img/8k/a.png b/res/default/img/8k/a.png new file mode 100644 index 0000000..f128608 Binary files /dev/null and b/res/default/img/8k/a.png differ diff --git a/res/default/img/8k/b.png b/res/default/img/8k/b.png new file mode 100644 index 0000000..425ea32 Binary files /dev/null and b/res/default/img/8k/b.png differ diff --git a/res/default/img/8k/backone.png b/res/default/img/8k/backone.png new file mode 100644 index 0000000..aaafedb Binary files /dev/null and b/res/default/img/8k/backone.png differ diff --git a/res/default/img/8k/backthree.png b/res/default/img/8k/backthree.png new file mode 100644 index 0000000..7f07186 Binary files /dev/null and b/res/default/img/8k/backthree.png differ diff --git a/res/default/img/8k/backtwo.png b/res/default/img/8k/backtwo.png new file mode 100644 index 0000000..d712125 Binary files /dev/null and b/res/default/img/8k/backtwo.png differ diff --git a/res/default/img/8k/c.png b/res/default/img/8k/c.png new file mode 100644 index 0000000..be05e26 Binary files /dev/null and b/res/default/img/8k/c.png differ diff --git a/res/default/img/8k/closed.png b/res/default/img/8k/closed.png new file mode 100644 index 0000000..080893e Binary files /dev/null and b/res/default/img/8k/closed.png differ diff --git a/res/default/img/8k/d.png b/res/default/img/8k/d.png new file mode 100644 index 0000000..a9a5208 Binary files /dev/null and b/res/default/img/8k/d.png differ diff --git a/res/default/img/8k/e.png b/res/default/img/8k/e.png new file mode 100644 index 0000000..9d5550b Binary files /dev/null and b/res/default/img/8k/e.png differ diff --git a/res/default/img/8k/easyone.png b/res/default/img/8k/easyone.png new file mode 100644 index 0000000..c4ba1c6 Binary files /dev/null and b/res/default/img/8k/easyone.png differ diff --git a/res/default/img/8k/easythree.png b/res/default/img/8k/easythree.png new file mode 100644 index 0000000..02bfeee Binary files /dev/null and b/res/default/img/8k/easythree.png differ diff --git a/res/default/img/8k/easytwo.png b/res/default/img/8k/easytwo.png new file mode 100644 index 0000000..7bd9148 Binary files /dev/null and b/res/default/img/8k/easytwo.png differ diff --git a/res/default/img/8k/eight.png b/res/default/img/8k/eight.png new file mode 100644 index 0000000..b9e6d6d Binary files /dev/null and b/res/default/img/8k/eight.png differ diff --git a/res/default/img/8k/f.png b/res/default/img/8k/f.png new file mode 100644 index 0000000..c1d8a7d Binary files /dev/null and b/res/default/img/8k/f.png differ diff --git a/res/default/img/8k/five.png b/res/default/img/8k/five.png new file mode 100644 index 0000000..87c64a7 Binary files /dev/null and b/res/default/img/8k/five.png differ diff --git a/res/default/img/8k/four.png b/res/default/img/8k/four.png new file mode 100644 index 0000000..e310d75 Binary files /dev/null and b/res/default/img/8k/four.png differ diff --git a/res/default/img/8k/g.png b/res/default/img/8k/g.png new file mode 100644 index 0000000..3e66663 Binary files /dev/null and b/res/default/img/8k/g.png differ diff --git a/res/default/img/8k/gameover.png b/res/default/img/8k/gameover.png new file mode 100644 index 0000000..a71bd15 Binary files /dev/null and b/res/default/img/8k/gameover.png differ diff --git a/res/default/img/8k/groups.png b/res/default/img/8k/groups.png new file mode 100644 index 0000000..3293c19 Binary files /dev/null and b/res/default/img/8k/groups.png differ diff --git a/res/default/img/8k/groupsize.png b/res/default/img/8k/groupsize.png new file mode 100644 index 0000000..3da1acc Binary files /dev/null and b/res/default/img/8k/groupsize.png differ diff --git a/res/default/img/8k/h.png b/res/default/img/8k/h.png new file mode 100644 index 0000000..f91bbbc Binary files /dev/null and b/res/default/img/8k/h.png differ diff --git a/res/default/img/8k/hardone.png b/res/default/img/8k/hardone.png new file mode 100644 index 0000000..d303d65 Binary files /dev/null and b/res/default/img/8k/hardone.png differ diff --git a/res/default/img/8k/hardthree.png b/res/default/img/8k/hardthree.png new file mode 100644 index 0000000..081b33c Binary files /dev/null and b/res/default/img/8k/hardthree.png differ diff --git a/res/default/img/8k/hardtwo.png b/res/default/img/8k/hardtwo.png new file mode 100644 index 0000000..c6aa1ad Binary files /dev/null and b/res/default/img/8k/hardtwo.png differ diff --git a/res/default/img/8k/helpone.png b/res/default/img/8k/helpone.png new file mode 100644 index 0000000..13edd6e Binary files /dev/null and b/res/default/img/8k/helpone.png differ diff --git a/res/default/img/8k/helpthree.png b/res/default/img/8k/helpthree.png new file mode 100644 index 0000000..8c40fa1 Binary files /dev/null and b/res/default/img/8k/helpthree.png differ diff --git a/res/default/img/8k/helptwo.png b/res/default/img/8k/helptwo.png new file mode 100644 index 0000000..784bbe2 Binary files /dev/null and b/res/default/img/8k/helptwo.png differ diff --git a/res/default/img/8k/highscore.png b/res/default/img/8k/highscore.png new file mode 100644 index 0000000..ca885d6 Binary files /dev/null and b/res/default/img/8k/highscore.png differ diff --git a/res/default/img/8k/i.png b/res/default/img/8k/i.png new file mode 100644 index 0000000..850e60a Binary files /dev/null and b/res/default/img/8k/i.png differ diff --git a/res/default/img/8k/j.png b/res/default/img/8k/j.png new file mode 100644 index 0000000..19d952b Binary files /dev/null and b/res/default/img/8k/j.png differ diff --git a/res/default/img/8k/k.png b/res/default/img/8k/k.png new file mode 100644 index 0000000..9395439 Binary files /dev/null and b/res/default/img/8k/k.png differ diff --git a/res/default/img/8k/l.png b/res/default/img/8k/l.png new file mode 100644 index 0000000..68206dd Binary files /dev/null and b/res/default/img/8k/l.png differ diff --git a/res/default/img/8k/logo.png b/res/default/img/8k/logo.png new file mode 100644 index 0000000..0e51b64 Binary files /dev/null and b/res/default/img/8k/logo.png differ diff --git a/res/default/img/8k/m.png b/res/default/img/8k/m.png new file mode 100644 index 0000000..426ed31 Binary files /dev/null and b/res/default/img/8k/m.png differ diff --git a/res/default/img/8k/medone.png b/res/default/img/8k/medone.png new file mode 100644 index 0000000..a8fe9dc Binary files /dev/null and b/res/default/img/8k/medone.png differ diff --git a/res/default/img/8k/medthree.png b/res/default/img/8k/medthree.png new file mode 100644 index 0000000..080e990 Binary files /dev/null and b/res/default/img/8k/medthree.png differ diff --git a/res/default/img/8k/medtwo.png b/res/default/img/8k/medtwo.png new file mode 100644 index 0000000..1f21a02 Binary files /dev/null and b/res/default/img/8k/medtwo.png differ diff --git a/res/default/img/8k/n.png b/res/default/img/8k/n.png new file mode 100644 index 0000000..1efcfc1 Binary files /dev/null and b/res/default/img/8k/n.png differ diff --git a/res/default/img/8k/nextone.png b/res/default/img/8k/nextone.png new file mode 100644 index 0000000..fc53246 Binary files /dev/null and b/res/default/img/8k/nextone.png differ diff --git a/res/default/img/8k/nextthree.png b/res/default/img/8k/nextthree.png new file mode 100644 index 0000000..4eafbc3 Binary files /dev/null and b/res/default/img/8k/nextthree.png differ diff --git a/res/default/img/8k/nexttwo.png b/res/default/img/8k/nexttwo.png new file mode 100644 index 0000000..65a8e79 Binary files /dev/null and b/res/default/img/8k/nexttwo.png differ diff --git a/res/default/img/8k/nine.png b/res/default/img/8k/nine.png new file mode 100644 index 0000000..8af8776 Binary files /dev/null and b/res/default/img/8k/nine.png differ diff --git a/res/default/img/8k/o.png b/res/default/img/8k/o.png new file mode 100644 index 0000000..839a7c8 Binary files /dev/null and b/res/default/img/8k/o.png differ diff --git a/res/default/img/8k/one.png b/res/default/img/8k/one.png new file mode 100644 index 0000000..8706443 Binary files /dev/null and b/res/default/img/8k/one.png differ diff --git a/res/default/img/8k/open.png b/res/default/img/8k/open.png new file mode 100644 index 0000000..f3af15e Binary files /dev/null and b/res/default/img/8k/open.png differ diff --git a/res/default/img/8k/p.png b/res/default/img/8k/p.png new file mode 100644 index 0000000..3cd3d60 Binary files /dev/null and b/res/default/img/8k/p.png differ diff --git a/res/default/img/8k/playicon.png b/res/default/img/8k/playicon.png new file mode 100644 index 0000000..36717c8 Binary files /dev/null and b/res/default/img/8k/playicon.png differ diff --git a/res/default/img/8k/prevone.png b/res/default/img/8k/prevone.png new file mode 100644 index 0000000..a105b2b Binary files /dev/null and b/res/default/img/8k/prevone.png differ diff --git a/res/default/img/8k/prevthree.png b/res/default/img/8k/prevthree.png new file mode 100644 index 0000000..7e0e32a Binary files /dev/null and b/res/default/img/8k/prevthree.png differ diff --git a/res/default/img/8k/prevtwo.png b/res/default/img/8k/prevtwo.png new file mode 100644 index 0000000..3391239 Binary files /dev/null and b/res/default/img/8k/prevtwo.png differ diff --git a/res/default/img/8k/q.png b/res/default/img/8k/q.png new file mode 100644 index 0000000..d5b4f83 Binary files /dev/null and b/res/default/img/8k/q.png differ diff --git a/res/default/img/8k/r.png b/res/default/img/8k/r.png new file mode 100644 index 0000000..8a24f88 Binary files /dev/null and b/res/default/img/8k/r.png differ diff --git a/res/default/img/8k/s.png b/res/default/img/8k/s.png new file mode 100644 index 0000000..027607d Binary files /dev/null and b/res/default/img/8k/s.png differ diff --git a/res/default/img/8k/score.png b/res/default/img/8k/score.png new file mode 100644 index 0000000..9898dd6 Binary files /dev/null and b/res/default/img/8k/score.png differ diff --git a/res/default/img/8k/seven.png b/res/default/img/8k/seven.png new file mode 100644 index 0000000..7b2e96c Binary files /dev/null and b/res/default/img/8k/seven.png differ diff --git a/res/default/img/8k/six.png b/res/default/img/8k/six.png new file mode 100644 index 0000000..2d7bfbf Binary files /dev/null and b/res/default/img/8k/six.png differ diff --git a/res/default/img/8k/space.png b/res/default/img/8k/space.png new file mode 100644 index 0000000..4f37217 Binary files /dev/null and b/res/default/img/8k/space.png differ diff --git a/res/default/img/8k/stack.png b/res/default/img/8k/stack.png new file mode 100644 index 0000000..92c8b7f Binary files /dev/null and b/res/default/img/8k/stack.png differ diff --git a/res/default/img/8k/t.png b/res/default/img/8k/t.png new file mode 100644 index 0000000..55c9f0d Binary files /dev/null and b/res/default/img/8k/t.png differ diff --git a/res/default/img/8k/three.png b/res/default/img/8k/three.png new file mode 100644 index 0000000..d7e0fcf Binary files /dev/null and b/res/default/img/8k/three.png differ diff --git a/res/default/img/8k/time.png b/res/default/img/8k/time.png new file mode 100644 index 0000000..e1a181e Binary files /dev/null and b/res/default/img/8k/time.png differ diff --git a/res/default/img/8k/tracka.png b/res/default/img/8k/tracka.png new file mode 100644 index 0000000..8994fb5 Binary files /dev/null and b/res/default/img/8k/tracka.png differ diff --git a/res/default/img/8k/trackd.png b/res/default/img/8k/trackd.png new file mode 100644 index 0000000..90e6b03 Binary files /dev/null and b/res/default/img/8k/trackd.png differ diff --git a/res/default/img/8k/tracks.png b/res/default/img/8k/tracks.png new file mode 100644 index 0000000..4069da0 Binary files /dev/null and b/res/default/img/8k/tracks.png differ diff --git a/res/default/img/8k/trackw.png b/res/default/img/8k/trackw.png new file mode 100644 index 0000000..850ec3f Binary files /dev/null and b/res/default/img/8k/trackw.png differ diff --git a/res/default/img/8k/two.png b/res/default/img/8k/two.png new file mode 100644 index 0000000..73ee489 Binary files /dev/null and b/res/default/img/8k/two.png differ diff --git a/res/default/img/8k/u.png b/res/default/img/8k/u.png new file mode 100644 index 0000000..f8b8713 Binary files /dev/null and b/res/default/img/8k/u.png differ diff --git a/res/default/img/8k/v.png b/res/default/img/8k/v.png new file mode 100644 index 0000000..67a0664 Binary files /dev/null and b/res/default/img/8k/v.png differ diff --git a/res/default/img/8k/w.png b/res/default/img/8k/w.png new file mode 100644 index 0000000..7c19b46 Binary files /dev/null and b/res/default/img/8k/w.png differ diff --git a/res/default/img/8k/x.png b/res/default/img/8k/x.png new file mode 100644 index 0000000..1137ff3 Binary files /dev/null and b/res/default/img/8k/x.png differ diff --git a/res/default/img/8k/y.png b/res/default/img/8k/y.png new file mode 100644 index 0000000..ab0d95e Binary files /dev/null and b/res/default/img/8k/y.png differ diff --git a/res/default/img/8k/z.png b/res/default/img/8k/z.png new file mode 100644 index 0000000..a689f88 Binary files /dev/null and b/res/default/img/8k/z.png differ diff --git a/res/default/img/8k/zero.png b/res/default/img/8k/zero.png new file mode 100644 index 0000000..a800258 Binary files /dev/null and b/res/default/img/8k/zero.png differ diff --git a/res/default/img/const/help/controls.png b/res/default/img/const/help/controls.png new file mode 100644 index 0000000..a8c900f Binary files /dev/null and b/res/default/img/const/help/controls.png differ diff --git a/res/default/img/const/help/difficulty.png b/res/default/img/const/help/difficulty.png new file mode 100644 index 0000000..159717f Binary files /dev/null and b/res/default/img/const/help/difficulty.png differ diff --git a/res/default/img/const/help/groups.png b/res/default/img/const/help/groups.png new file mode 100644 index 0000000..d1f992f Binary files /dev/null and b/res/default/img/const/help/groups.png differ diff --git a/res/default/img/const/help/interface.png b/res/default/img/const/help/interface.png new file mode 100644 index 0000000..2b0af3e Binary files /dev/null and b/res/default/img/const/help/interface.png differ diff --git a/res/default/img/const/help/overview.png b/res/default/img/const/help/overview.png new file mode 100644 index 0000000..046ddc6 Binary files /dev/null and b/res/default/img/const/help/overview.png differ diff --git a/res/default/img/const/help/premise.png b/res/default/img/const/help/premise.png new file mode 100644 index 0000000..e1db1e0 Binary files /dev/null and b/res/default/img/const/help/premise.png differ diff --git a/res/default/img/const/help/swapping.png b/res/default/img/const/help/swapping.png new file mode 100644 index 0000000..af95dad Binary files /dev/null and b/res/default/img/const/help/swapping.png differ diff --git a/res/default/img/const/help/thebyte.png b/res/default/img/const/help/thebyte.png new file mode 100644 index 0000000..0d53a33 Binary files /dev/null and b/res/default/img/const/help/thebyte.png differ diff --git a/res/default/img/const/mapBorder.png b/res/default/img/const/mapBorder.png new file mode 100644 index 0000000..1e69d76 Binary files /dev/null and b/res/default/img/const/mapBorder.png differ diff --git a/res/high.sco b/res/high.sco new file mode 100644 index 0000000..2edeafb --- /dev/null +++ b/res/high.sco @@ -0,0 +1 @@ +20 \ No newline at end of file diff --git a/res/options.prop b/res/options.prop new file mode 100644 index 0000000..afa87c2 --- /dev/null +++ b/res/options.prop @@ -0,0 +1,6 @@ +// Sets the game theme to use. Currently can only be default unless you added your own themes +theme: default +// Sets the texture resolution to use +// Default themes support 720p, 1080p, 1440p, 4k, 8k +// Setting it to dynamic will determine scale dynamically based on resolution of the monitor +texRes: dynamic \ No newline at end of file diff --git a/res/shaders/s2c/frag.gls b/res/shaders/s2c/frag.gls new file mode 100644 index 0000000..1481224 --- /dev/null +++ b/res/shaders/s2c/frag.gls @@ -0,0 +1,9 @@ +#version 330 core + +uniform vec4 iColor = vec4(0, 0.6, 0.9, 1); + +out vec4 color; + +void main() { + color = iColor; +} \ No newline at end of file diff --git a/res/shaders/s2c/vert.gls b/res/shaders/s2c/vert.gls new file mode 100644 index 0000000..f404630 --- /dev/null +++ b/res/shaders/s2c/vert.gls @@ -0,0 +1,9 @@ +#version 330 core + +uniform mat4 mvp; + +layout (location = 0) in vec3 vertices; + +void main() { + gl_Position = mvp * vec4(vertices, 1); +} \ No newline at end of file diff --git a/res/shaders/s2ft/frag.gls b/res/shaders/s2ft/frag.gls new file mode 100644 index 0000000..af8712f --- /dev/null +++ b/res/shaders/s2ft/frag.gls @@ -0,0 +1,15 @@ +#version 330 core + +uniform vec4 iColor = vec4(0, 0.6, 0.9, 1); + +uniform sampler2D sampler; + +in vec2 texCoords; + +out vec4 color; + +void main() { + color = texture(sampler, texCoords) * iColor; + if(color.a == 0) + discard; +} \ No newline at end of file diff --git a/res/shaders/s2ft/vert.gls b/res/shaders/s2ft/vert.gls new file mode 100644 index 0000000..6c3699d --- /dev/null +++ b/res/shaders/s2ft/vert.gls @@ -0,0 +1,13 @@ +#version 330 core + +uniform mat4 mvp; + +layout (location = 0) in vec3 vertices; +layout (location = 1) in vec2 itexCoords; + +out vec2 texCoords; + +void main() { + texCoords = itexCoords; + gl_Position = mvp * vec4(vertices, 1); +} \ No newline at end of file diff --git a/res/shaders/s2t/frag.gls b/res/shaders/s2t/frag.gls new file mode 100644 index 0000000..1bee287 --- /dev/null +++ b/res/shaders/s2t/frag.gls @@ -0,0 +1,13 @@ +#version 330 core + +uniform sampler2D sampler; + +in vec2 texCoords; + +out vec4 color; + +void main() { + color = texture(sampler, texCoords); + if(color.a == 0) + discard; +} \ No newline at end of file diff --git a/res/shaders/s2t/vert.gls b/res/shaders/s2t/vert.gls new file mode 100644 index 0000000..6c3699d --- /dev/null +++ b/res/shaders/s2t/vert.gls @@ -0,0 +1,13 @@ +#version 330 core + +uniform mat4 mvp; + +layout (location = 0) in vec3 vertices; +layout (location = 1) in vec2 itexCoords; + +out vec2 texCoords; + +void main() { + texCoords = itexCoords; + gl_Position = mvp * vec4(vertices, 1); +} \ No newline at end of file diff --git a/src/com/gnarly/engine/audio/ALManagement.java b/src/com/gnarly/engine/audio/ALManagement.java new file mode 100644 index 0000000..00c854b --- /dev/null +++ b/src/com/gnarly/engine/audio/ALManagement.java @@ -0,0 +1,39 @@ +package com.gnarly.engine.audio; + +import static org.lwjgl.openal.ALC10.alcCreateContext; +import static org.lwjgl.openal.ALC10.alcMakeContextCurrent; +import static org.lwjgl.openal.ALC10.alcOpenDevice; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import org.lwjgl.openal.AL; +import org.lwjgl.openal.ALC; +import org.lwjgl.openal.ALC10; +import org.lwjgl.openal.ALCCapabilities; + +public class ALManagement { + + private long device, context; + private ALCCapabilities deviceCaps; + + public ALManagement() { + device = alcOpenDevice((ByteBuffer) null); + if (device == 0) + throw new IllegalStateException("Failed to open the default device."); + + deviceCaps = ALC.createCapabilities(device); + + context = alcCreateContext(device, (IntBuffer) null); + if (context == 0) + throw new IllegalStateException("Failed to create an OpenAL context."); + + alcMakeContextCurrent(context); + AL.createCapabilities(deviceCaps); + } + + public void destroy() { + ALC10.alcDestroyContext(context); + ALC10.alcCloseDevice(device); + } +} diff --git a/src/com/gnarly/engine/audio/Sound.java b/src/com/gnarly/engine/audio/Sound.java new file mode 100644 index 0000000..2e88ca3 --- /dev/null +++ b/src/com/gnarly/engine/audio/Sound.java @@ -0,0 +1,38 @@ +package com.gnarly.engine.audio; + +import org.lwjgl.openal.AL10; + +public class Sound { + + private int buffer; + private int sourceId; + + public Sound(String path) { + sourceId = AL10.alGenSources(); + buffer = AL10.alGenBuffers(); + WaveData waveData = WaveData.create(path); + AL10.alBufferData(buffer, waveData.format, waveData.data, waveData.samplerate); + AL10.alSourcei(sourceId, AL10.AL_BUFFER, buffer); + AL10.alSourcef(sourceId, AL10.AL_GAIN, 1); + AL10.alSourcef(sourceId, AL10.AL_PITCH, 1); + } + + public void play(boolean loop) { + AL10.alSourcei(sourceId, AL10.AL_LOOPING, loop ? 1 : 0); + AL10.alSource3f(sourceId, AL10.AL_POSITION, 0, 0, 0); + AL10.alSourcePlay(sourceId); + } + + public void stop() { + AL10.alSourceStop(sourceId); + } + + public void setVolume(float volume) { + AL10.alSourcef(sourceId, AL10.AL_GAIN, volume); + } + + public void destroy() { + AL10.alDeleteBuffers(buffer); + AL10.alDeleteSources(sourceId); + } +} diff --git a/src/com/gnarly/engine/audio/WaveData.java b/src/com/gnarly/engine/audio/WaveData.java new file mode 100644 index 0000000..3205142 --- /dev/null +++ b/src/com/gnarly/engine/audio/WaveData.java @@ -0,0 +1,88 @@ +package com.gnarly.engine.audio; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.ByteBuffer; + +import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioInputStream; +import javax.sound.sampled.AudioSystem; +import javax.sound.sampled.UnsupportedAudioFileException; + +import org.lwjgl.BufferUtils; +import org.lwjgl.openal.AL10; + +public class WaveData { + + final int format; + final int samplerate; + final int totalBytes; + final int bytesPerFrame; + final ByteBuffer data; + + private final AudioInputStream audioStream; + private final byte[] dataArray; + + private WaveData(AudioInputStream stream) { + this.audioStream = stream; + AudioFormat audioFormat = stream.getFormat(); + format = getOpenAlFormat(audioFormat.getChannels(), audioFormat.getSampleSizeInBits()); + this.samplerate = (int) audioFormat.getSampleRate(); + this.bytesPerFrame = audioFormat.getFrameSize(); + this.totalBytes = (int) (stream.getFrameLength() * bytesPerFrame); + this.data = BufferUtils.createByteBuffer(totalBytes); + this.dataArray = new byte[totalBytes]; + loadData(); + } + + protected void dispose() { + try { + audioStream.close(); + data.clear(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private ByteBuffer loadData() { + try { + int bytesRead = audioStream.read(dataArray, 0, totalBytes); + data.clear(); + data.put(dataArray, 0, bytesRead); + data.flip(); + } catch (IOException e) { + e.printStackTrace(); + System.err.println("Couldn't read bytes from audio stream!"); + } + return data; + } + + public static WaveData create(String file) { + WaveData wavStream = null; + try { + InputStream stream = new FileInputStream(new File(file)); + InputStream bufferedInput = new BufferedInputStream(stream); + AudioInputStream audioStream = null; + audioStream = AudioSystem.getAudioInputStream(bufferedInput); + wavStream = new WaveData(audioStream); + } catch (UnsupportedAudioFileException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return wavStream; + } + + + private static int getOpenAlFormat(int channels, int bitsPerSample) { + if (channels == 1) { + return bitsPerSample == 8 ? AL10.AL_FORMAT_MONO8 : AL10.AL_FORMAT_MONO16; + } else { + return bitsPerSample == 8 ? AL10.AL_FORMAT_STEREO8 : AL10.AL_FORMAT_STEREO16; + } + } + +} diff --git a/src/com/gnarly/engine/display/Camera.java b/src/com/gnarly/engine/display/Camera.java new file mode 100644 index 0000000..6812b49 --- /dev/null +++ b/src/com/gnarly/engine/display/Camera.java @@ -0,0 +1,100 @@ +package com.gnarly.engine.display; + +import org.joml.Matrix4f; +import org.joml.Vector3f; + +public class Camera { + + private Matrix4f projection, projView; + + private float width, height; + private Vector3f position; + private float rotation; + + public Camera(float width, float height) { + setDims(width, height); + position = new Vector3f(); + rotation = 0; + projView = new Matrix4f(); + } + + public void setDims(float width, float height) { + this.width = width; + this.height = height; + projection = new Matrix4f().setOrtho(0, width, height, 0, 0, 1); + } + + public void update() { + projection.translate(position.negate(new Vector3f()), projView).rotateZ(-rotation); + } + + public Matrix4f getProjection() { + return new Matrix4f(projection); + } + + public Matrix4f getMatrix() { + return new Matrix4f(projView); + } + + public float getX() { + return position.x; + } + + public float getY() { + return position.y; + } + + public Vector3f getPosition() { + return new Vector3f(position); + } + + public float getWidth() { + return width; + } + + public float getHeight() { + return height; + } + + public void setX(float x) { + position.x = x; + } + + public void setY(float y) { + position.y = y; + } + + public void setPosition(float x, float y) { + position.set(x, y, position.z); + } + + public void setPosition(Vector3f position) { + this.position.x = position.x; + this.position.y = position.y; + } + + public void setCenter(float x, float y) { + position.set(x - width / 2, y - height / 2, position.z); + } + + public void setCenter(Vector3f position) { + this.position.x = position.x - width / 2; + this.position.y = position.y - height / 2; + } + + public void translate(float x, float y, float z) { + position.add(x, y, z); + } + + public void translate(Vector3f transform) { + position.add(transform); + } + + public void setRotation(float angle) { + rotation = angle; + } + + public void rotate(float angle) { + rotation += angle; + } +} diff --git a/src/com/gnarly/engine/display/Framebuffer.java b/src/com/gnarly/engine/display/Framebuffer.java new file mode 100644 index 0000000..ea02641 --- /dev/null +++ b/src/com/gnarly/engine/display/Framebuffer.java @@ -0,0 +1,119 @@ +package com.gnarly.engine.display; + +import static org.lwjgl.opengl.GL11.GL_CLAMP; +import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.GL_DEPTH_COMPONENT; +import static org.lwjgl.opengl.GL11.GL_NEAREST; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_MAG_FILTER; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_S; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_T; +import static org.lwjgl.opengl.GL11.glBindTexture; +import static org.lwjgl.opengl.GL11.glClear; +import static org.lwjgl.opengl.GL11.glClearColor; +import static org.lwjgl.opengl.GL11.glDrawBuffer; +import static org.lwjgl.opengl.GL11.glGenTextures; +import static org.lwjgl.opengl.GL11.glTexParameterf; +import static org.lwjgl.opengl.GL11.glViewport; +import static org.lwjgl.opengl.GL30.GL_COLOR_ATTACHMENT0; +import static org.lwjgl.opengl.GL30.GL_DEPTH_ATTACHMENT; +import static org.lwjgl.opengl.GL30.GL_FRAMEBUFFER; +import static org.lwjgl.opengl.GL30.GL_RENDERBUFFER; +import static org.lwjgl.opengl.GL30.glBindFramebuffer; +import static org.lwjgl.opengl.GL30.glBindRenderbuffer; +import static org.lwjgl.opengl.GL30.glDeleteFramebuffers; +import static org.lwjgl.opengl.GL30.glDeleteRenderbuffers; +import static org.lwjgl.opengl.GL30.glFramebufferRenderbuffer; +import static org.lwjgl.opengl.GL30.glGenFramebuffers; +import static org.lwjgl.opengl.GL30.glGenRenderbuffers; +import static org.lwjgl.opengl.GL30.glRenderbufferStorage; +import static org.lwjgl.opengl.GL32.glFramebufferTexture; + +import com.gnarly.engine.texture.Texture; + +public class Framebuffer { + + int fbo, rbo, width, height; + int colorBuf, depthTex; + float r, g, b, a; + + Framebuffer(int width, int height, float r, float g, float b, float a) { + this.width = width; + this.height = height; + + this.r = r; + this.g = g; + this.b = b; + this.a = a; + + fbo = glGenFramebuffers(); + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glDrawBuffer(GL_COLOR_ATTACHMENT0); + + rbo = 0; + colorBuf = 0; + depthTex = 0; + } + + Framebuffer addColorAttachment(Texture texture) { + if (colorBuf == 0) { + int id = glGenTextures(); + glBindTexture(GL_TEXTURE_2D, id); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + texture = new Texture(id, width, height); + colorBuf = 1; + } + return this; + } + + Framebuffer addDepthTextureAttachment(Texture texture) { + if (depthTex == 0) { + int id = glGenTextures(); + glBindTexture(GL_TEXTURE_2D, id); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, id, 0); + texture = new Texture(id, width, height); + depthTex = 1; + } + return this; + } + + Framebuffer addDepthBufferAttachment() { + if (rbo == 0) { + rbo = glGenRenderbuffers(); + glBindRenderbuffer(GL_RENDERBUFFER, rbo); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo); + } + return this; + } + + void bind() { + glBindTexture(GL_TEXTURE_2D, 0); + glBindFramebuffer(GL_FRAMEBUFFER, fbo); + glViewport(0, 0, width, height); + + glClearColor(r, g, b, a); + } + + void unbind(Window window) { + glBindFramebuffer(GL_FRAMEBUFFER, 0); + glViewport(0, 0, window.getWidth(), window.getHeight()); + window.activateClearColor(); + } + + void clear() { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } + + public void cleanup() { + if (rbo != 0) + glDeleteRenderbuffers(rbo); + glDeleteFramebuffers(fbo); + } +} diff --git a/src/com/gnarly/engine/display/Window.java b/src/com/gnarly/engine/display/Window.java new file mode 100644 index 0000000..afc7f1c --- /dev/null +++ b/src/com/gnarly/engine/display/Window.java @@ -0,0 +1,235 @@ +package com.gnarly.engine.display; + +import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MAJOR; +import static org.lwjgl.glfw.GLFW.GLFW_CONTEXT_VERSION_MINOR; +import static org.lwjgl.glfw.GLFW.GLFW_DECORATED; +import static org.lwjgl.glfw.GLFW.GLFW_FALSE; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_LAST; +import static org.lwjgl.glfw.GLFW.GLFW_MAXIMIZED; +import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_LAST; +import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_CORE_PROFILE; +import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_FORWARD_COMPAT; +import static org.lwjgl.glfw.GLFW.GLFW_OPENGL_PROFILE; +import static org.lwjgl.glfw.GLFW.GLFW_PRESS; +import static org.lwjgl.glfw.GLFW.GLFW_RELEASE; +import static org.lwjgl.glfw.GLFW.GLFW_REPEAT; +import static org.lwjgl.glfw.GLFW.GLFW_RESIZABLE; +import static org.lwjgl.glfw.GLFW.GLFW_SAMPLES; +import static org.lwjgl.glfw.GLFW.GLFW_TRUE; +import static org.lwjgl.glfw.GLFW.glfwCreateWindow; +import static org.lwjgl.glfw.GLFW.glfwGetCursorPos; +import static org.lwjgl.glfw.GLFW.glfwGetPrimaryMonitor; +import static org.lwjgl.glfw.GLFW.glfwGetVideoMode; +import static org.lwjgl.glfw.GLFW.glfwGetWindowSize; +import static org.lwjgl.glfw.GLFW.glfwInit; +import static org.lwjgl.glfw.GLFW.glfwMakeContextCurrent; +import static org.lwjgl.glfw.GLFW.glfwPollEvents; +import static org.lwjgl.glfw.GLFW.glfwSetErrorCallback; +import static org.lwjgl.glfw.GLFW.glfwSetKeyCallback; +import static org.lwjgl.glfw.GLFW.glfwSetMouseButtonCallback; +import static org.lwjgl.glfw.GLFW.glfwSetWindowShouldClose; +import static org.lwjgl.glfw.GLFW.glfwSetWindowSizeCallback; +import static org.lwjgl.glfw.GLFW.glfwSwapBuffers; +import static org.lwjgl.glfw.GLFW.glfwSwapInterval; +import static org.lwjgl.glfw.GLFW.glfwTerminate; +import static org.lwjgl.glfw.GLFW.glfwWindowHint; +import static org.lwjgl.glfw.GLFW.glfwWindowShouldClose; +import static org.lwjgl.opengl.GL.createCapabilities; +import static org.lwjgl.opengl.GL11.GL_BLEND; +import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT; +import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST; +import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; +import static org.lwjgl.opengl.GL11.GL_TRUE; +import static org.lwjgl.opengl.GL11.glBlendFunc; +import static org.lwjgl.opengl.GL11.glClear; +import static org.lwjgl.opengl.GL11.glClearColor; +import static org.lwjgl.opengl.GL11.glEnable; +import static org.lwjgl.opengl.GL11.glViewport; +import static org.lwjgl.opengl.GL13.GL_MULTISAMPLE; + +import org.joml.Vector3f; +import org.lwjgl.glfw.GLFWErrorCallback; +import org.lwjgl.glfw.GLFWVidMode; + +public class Window { + + public static int + SCREEN_WIDTH, + SCREEN_HEIGHT; + + public static final int + BUTTON_RELEASED = 0, + BUTTON_UNPRESSED = 1, + BUTTON_PRESSED = 2, + BUTTON_HELD = 3, + BUTTON_REPEAT = 4; + + public static float SCALE; + + private long window; + private int width, height; + private boolean resized; + + private int[] mouseButtons = new int[GLFW_MOUSE_BUTTON_LAST + 1]; + private int[] keys = new int[GLFW_KEY_LAST + 1]; + + public Window(String title, boolean vSync) { + init(0, 0, title, vSync, false, false, false); + } + + public Window(String title, boolean vSync, boolean resizable, boolean decorated) { + init(800, 500, title, vSync, resizable, decorated, true); + } + + public Window(int width, int height, String title, boolean vSync, boolean resizable, boolean decorated) { + init(width, height, title, vSync, resizable, decorated, false); + } + + public void init(int lwidth, int lheight, String title, boolean vSync, boolean resizable, boolean decorated, boolean maximized) { + glfwSetErrorCallback(GLFWErrorCallback.createPrint(System.err)); + + for (int i = 0; i < mouseButtons.length; i++) + mouseButtons[i] = 0; + + if(!glfwInit()) { + System.err.println("GLFW failed to initialize!"); + System.exit(-1); + } + + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + + glfwWindowHint(GLFW_SAMPLES, 8); + glfwWindowHint(GLFW_RESIZABLE, resizable ? GLFW_TRUE : GLFW_FALSE); + glfwWindowHint(GLFW_DECORATED, decorated ? GLFW_TRUE : GLFW_FALSE); + glfwWindowHint(GLFW_MAXIMIZED, maximized ? GLFW_TRUE : GLFW_FALSE); + + GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); + SCREEN_WIDTH = vidMode.width(); + SCREEN_HEIGHT = vidMode.height(); + SCALE = SCREEN_HEIGHT / 1080f; + if(lwidth == 0 || lheight == 0) { + width = vidMode.width(); + height = vidMode.height(); + window = glfwCreateWindow(width, height, title, glfwGetPrimaryMonitor(), 0); + } + else { + this.width = lwidth; + this.height = lheight; + window = glfwCreateWindow(width, height, title, 0, 0); + } + + glfwMakeContextCurrent(window); + createCapabilities(); + + glfwSwapInterval(vSync ? 1 : 0); + + glfwSetWindowSizeCallback(window, (long window, int w, int h) -> { + width = w; + height = h; + resized = true; + glViewport(0, 0, width, height); + }); + + glfwSetMouseButtonCallback(window, (long window, int button, int action, int mods) -> { + if(action == GLFW_RELEASE) + mouseButtons[button] = BUTTON_RELEASED; + if(action == GLFW_PRESS) + mouseButtons[button] = BUTTON_PRESSED; + if(action == GLFW_REPEAT) + mouseButtons[button] = BUTTON_REPEAT; + }); + + glfwSetKeyCallback(window, (long window, int key, int scancode, int action, int mods) -> { + if(action == GLFW_RELEASE) + keys[key] = BUTTON_RELEASED; + if(action == GLFW_PRESS) + keys[key] = BUTTON_PRESSED; + if(action == GLFW_REPEAT) + keys[key] = BUTTON_REPEAT; + }); + + activateClearColor(); + + glEnable(GL_TEXTURE_2D); + + glEnable(GL_DEPTH_TEST); + + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glEnable(GL_MULTISAMPLE); + + int[] awidth = new int[1], aheight = new int[1]; + glfwGetWindowSize(window, awidth, aheight); + width = awidth[0]; + height = aheight[0]; + } + + public void update() { + for (int i = 0; i < mouseButtons.length; i++) + if (mouseButtons[i] == BUTTON_RELEASED || mouseButtons[i] == BUTTON_PRESSED) + ++mouseButtons[i]; + for (int i = 0; i < keys.length; i++) + if (keys[i] == BUTTON_RELEASED || keys[i] == BUTTON_PRESSED) + ++keys[i]; + resized = false; + glfwPollEvents(); + } + + public void activateClearColor() { + glClearColor(0, 0, 0, 1); + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + public void clear() { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + } + + public void swap() { + glfwSwapBuffers(window); + } + + public void close() { + glfwSetWindowShouldClose(window, true); + } + + public static void terminate() { + glfwTerminate(); + } + + public boolean shouldClose() { + return glfwWindowShouldClose(window); + } + + public int keyPressed(int keyCode) { + return keys[keyCode]; + } + + public Vector3f getMouseCoords(Camera camera) { + double[] x = new double[1], y = new double[1]; + glfwGetCursorPos(window, x, y); + Vector3f ret = new Vector3f((float) x[0], (float) y[0], 0); + return ret.mul(camera.getWidth() / this.width, camera.getHeight() / this.height, 1); + } + + public int mousePressed(int button) { + return mouseButtons[button]; + } + + public boolean wasResized() { + return resized; + } +} diff --git a/src/com/gnarly/engine/model/Circle.java b/src/com/gnarly/engine/model/Circle.java new file mode 100644 index 0000000..87f249b --- /dev/null +++ b/src/com/gnarly/engine/model/Circle.java @@ -0,0 +1,121 @@ +package com.gnarly.engine.model; + +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.shaders.Shader2c; + +public class Circle { + + private static Vao vao; + + private Camera camera; + private Shader2c shader; + private Vector3f position; + private float radius; + private float r, g, b, a; + + public Circle(Camera camera, float x, float y, float z, float radius) { + this.camera = camera; + position = new Vector3f(x, y, z); + this.radius = radius; + shader = Shader.SHADER2C; + r = 1; + g = 0; + b = 0; + a = 1; + if(vao == null) + initVao(); + } + + private void initVao() { + final int NUM_POINTS = 30; + float[] cVertices = new float[NUM_POINTS * 3]; + int[] cIndices = new int[(NUM_POINTS - 2) * 3]; + for (int i = 0; i < cVertices.length; i += 3) { + double angle = Math.PI * 2 * i / (NUM_POINTS * 3); + cVertices[i ] = (float) Math.cos(angle); + cVertices[i + 1] = (float) Math.sin(angle); + cVertices[i + 2] = 0; + } + for (int i = 0; i < cIndices.length; i += 3) { + cIndices[i ] = 0; + cIndices[i + 1] = i / 3 + 1; + cIndices[i + 2] = i / 3 + 2; + } + vao = new Vao(cVertices, cIndices); + } + + public void render() { + shader.enable(); + shader.setMVP(camera.getMatrix().translate(position).scale(radius)); + shader.setColor(r, g, b, a); + vao.render(); + } + + public Vector3f getPosition() { + return position; + } + + public void setX(float x) { + position.x = x; + } + + public void setY(float y) { + position.y = y; + } + + public void setZ(float z) { + position.z = z; + } + + public void setPosition(float x, float y) { + position.x = x; + position.y = y; + } + + public void setPosition(float x, float y, float z) { + position.x = x; + position.y = y; + position.z = z; + } + + public void setPosition(Vector3f position) { + this.position.set(position); + } + + public void translate(float x, float y) { + position.x += x; + position.y += y; + } + + public void translate(float x, float y, float z) { + position.x += x; + position.y += y; + position.z += z; + } + + public void translate(Vector3f position) { + this.position.add(position); + } + + public void setRadius(float radius) { + this.radius = radius; + } + + public void setDiameter(float diameter) { + this.radius = diameter / 2; + } + + public void setColor(float r, float g, float b, float a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + public boolean contains(Vector3f vector) { + return (position.sub(vector, new Vector3f()).lengthSquared() < radius * radius); + } +} diff --git a/src/com/gnarly/engine/model/ColRect.java b/src/com/gnarly/engine/model/ColRect.java new file mode 100644 index 0000000..e9977e1 --- /dev/null +++ b/src/com/gnarly/engine/model/ColRect.java @@ -0,0 +1,50 @@ +package com.gnarly.engine.model; + +import org.joml.Matrix4f; +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.shaders.Shader2c; + +public class ColRect extends Rect { + + private Shader2c shader; + + protected float r, g, b, a; + + public ColRect(Camera camera, float x, float y, float z, float width, float height, float r, float g, float b, float a, boolean gui) { + super(camera, x, y, z, width, height, 0, gui); + shader = Shader.SHADER2C; + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + public void render() { + shader.enable(); + shader.setColor(r, g, b, a); + Matrix4f cmat = gui ? camera.getProjection() : camera.getMatrix(); + shader.setMVP(cmat.translate(position.add(width * scale / 2, height * scale / 2, 0, new Vector3f())).rotateZ(rotation * 3.1415927f / 180).scale(width * scale, height * scale, 1).translate(-0.5f, -0.5f, 0)); + vao.render(); + shader.disable(); + } + + public void setColor(float r, float g, float b) { + this.r = r; + this.g = g; + this.b = b; + } + + public void setColor(float r, float g, float b, float a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } + + public void setOpacity(float opacity) { + a = opacity; + } +} diff --git a/src/com/gnarly/engine/model/FadeRect.java b/src/com/gnarly/engine/model/FadeRect.java new file mode 100644 index 0000000..82ab33d --- /dev/null +++ b/src/com/gnarly/engine/model/FadeRect.java @@ -0,0 +1,117 @@ +package com.gnarly.engine.model; + +import org.joml.Matrix4f; +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.shaders.Shader2c; +import com.gnarly.engine.texture.Texture; +import com.gnarly.game.Main; + +public class FadeRect extends Rect { + + protected Shader2c shader = Shader.SHADER2C; + + private float r, g, b, a, dr, dg, db, da; + private double time; + + private boolean paused; + + public FadeRect(Camera camera, float x, float y, float z, float width, float height, float r, float g, float b, float a, boolean gui) { + super(camera, x, y, z, width, height, 0, gui); + this.r = r; + this.g = g; + this.b = b; + this.a = a; + this.dr = 0; + this.dg = 0; + this.db = 0; + this.da = 0; + paused = false; + time = 0; + } + + public void update() { + if(!paused) { + double delta = Main.dtime; + if (delta > time) + delta = time; + + r += dr * delta; + g += dg * delta; + b += db * delta; + a += da * delta; + clamp(); + time -= delta; + } + } + + public void render() { + shader.enable(); + shader.setColor(r, g, b, a); + Matrix4f cmat = gui ? camera.getProjection() : camera.getMatrix(); + shader.setMVP(cmat.translate(position.add(width * scale / 2, height * scale / 2, 0, new Vector3f())).rotateZ(rotation * 3.1415927f / 180).scale(width * scale, height * scale, 1).translate(-0.5f, -0.5f, 0)); + vao.render(); + shader.disable(); + } + + public void fadeFromTo(float r, float g, float b, float a, float tr, float tg, float tb, float ta, double time) { + setColor(r, g, b, a); + fadeTo(tr, tg, tb, ta, time); + } + + public void fadeTo(float r, float g, float b, float a, double time) { + this.time = time; + dr = (float) ((r - this.r) / time); + dg = (float) ((g - this.g) / time); + db = (float) ((b - this.b) / time); + da = (float) ((a - this.a) / time); + } + + public void setColor(float r, float g, float b) { + this.r = r; + this.g = g; + this.b = b; + stopFade(); + clamp(); + } + + public void setColor(float r, float g, float b, float a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + stopFade(); + clamp(); + } + + public void setOpacity(float opacity) { + a = opacity; + stopFade(); + clamp(); + } + + public void pause() { + paused = true; + } + + public void resume() { + paused = false; + } + + private void stopFade() { + dr = 0; + dg = 0; + db = 0; + da = 0; + time = 0; + } + + private void clamp() { + r = Math.min(Math.max(r, 0), 1); + g = Math.min(Math.max(g, 0), 1); + b = Math.min(Math.max(b, 0), 1); + a = Math.min(Math.max(a, 0), 1); + } +} \ No newline at end of file diff --git a/src/com/gnarly/engine/model/FadeTexRect.java b/src/com/gnarly/engine/model/FadeTexRect.java new file mode 100644 index 0000000..95b38a1 --- /dev/null +++ b/src/com/gnarly/engine/model/FadeTexRect.java @@ -0,0 +1,148 @@ +package com.gnarly.engine.model; + +import java.io.IOException; + +import org.joml.Matrix4f; +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.texture.Texture; +import com.gnarly.game.Main; + +public class FadeTexRect extends FadeRect { + + private Texture texture; + + private float r, g, b, a, dr, dg, db, da; + private double time; + + private boolean paused; + + public FadeTexRect(Camera camera, String path, float x, float y, float z, float width, float height, float r, float g, float b, float a, boolean gui) { + super(camera, x, y, z, width, height, r, g, b, a, gui); + shader = Shader.SHADER2FT; + texture = new Texture(path); + this.r = r; + this.g = g; + this.b = b; + this.a = a; + this.dr = 0; + this.dg = 0; + this.db = 0; + this.da = 0; + paused = false; + time = 0; + } + + public FadeTexRect(Camera camera, Texture texture, float x, float y, float z, float width, float height, float r, float g, float b, float a, boolean gui) { + super(camera, x, y, z, width, height, r, g, b, a, gui); + shader = Shader.SHADER2FT; + this.texture = texture; + this.r = r; + this.g = g; + this.b = b; + this.a = a; + this.dr = 0; + this.dg = 0; + this.db = 0; + this.da = 0; + paused = false; + time = 0; + } + + public void update() { + if(!paused) { + double delta = Main.dtime; + if (delta > time) + delta = time; + r += dr * delta; + g += dg * delta; + b += db * delta; + a += da * delta; + clamp(); + time -= delta; + } + } + + public void render() { + texture.bind(); + shader.enable(); + shader.setColor(r, g, b, a); + Matrix4f cmat = gui ? camera.getProjection() : camera.getMatrix(); + shader.setMVP(cmat.translate(position.add(width * scale / 2, height * scale / 2, 0, new Vector3f())).rotateZ(rotation * 3.1415927f / 180).scale(width * scale, height * scale, 1).translate(-0.5f, -0.5f, 0)); + vao.render(); + shader.disable(); + texture.unbind(); + } + + public void setTexture(Texture texture) { + this.texture = texture; + } + + public void fadeFromTo(float r, float g, float b, float a, float tr, float tg, float tb, float ta, double time) { + this.time = time; + this.r = r; + this.g = g; + this.b = b; + this.a = a; + dr = (float) ((r - this.r) / time); + dg = (float) ((g - this.g) / time); + db = (float) ((b - this.b) / time); + da = (float) ((a - this.a) / time); + } + + public void fadeTo(float r, float g, float b, float a, double time) { + this.time = time; + dr = (float) ((r - this.r) / time); + dg = (float) ((g - this.g) / time); + db = (float) ((b - this.b) / time); + da = (float) ((a - this.a) / time); + } + + public void setColor(float r, float g, float b) { + this.r = r; + this.g = g; + this.b = b; + stopFade(); + clamp(); + } + + public void setColor(float r, float g, float b, float a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + stopFade(); + clamp(); + } + + public void setOpacity(float opacity) { + a = opacity; + stopFade(); + clamp(); + } + + public void pause() { + paused = true; + } + + public void resume() { + paused = false; + } + + private void stopFade() { + dr = 0; + dg = 0; + db = 0; + da = 0; + time = 0; + } + + private void clamp() { + r = Math.min(Math.max(r, 0), 1); + g = Math.min(Math.max(g, 0), 1); + b = Math.min(Math.max(b, 0), 1); + a = Math.min(Math.max(a, 0), 1); + } +} \ No newline at end of file diff --git a/src/com/gnarly/engine/model/Line.java b/src/com/gnarly/engine/model/Line.java new file mode 100644 index 0000000..a78b6b1 --- /dev/null +++ b/src/com/gnarly/engine/model/Line.java @@ -0,0 +1,118 @@ +package com.gnarly.engine.model; + +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.shaders.Shader2c; + +public class Line { + + private static Vao cap, rect; + + private Camera camera; + private Shader2c shader; + + private Vector3f position; + private float angle, length, thickness; + private float r, g, b, a; + + public Line(Camera camera, float x1, float y1, float x2, float y2, float depth, float thickness) { + this.camera = camera; + shader = Shader.SHADER2C; + if(cap == null) + initVaos(); + this.thickness = thickness; + position = new Vector3f(x1, y1, depth); + setPoints(x1, y1, x2, y2); + r = 1; + g = 1; + b = 1; + a = 1; + } + + private void initVaos() { + float[] rVertices = { + 0, 0.5f, 0, + 0, -0.5f, 0, + 1, -0.5f, 0, + 1, 0.5f, 0 + }; + int rIndices[] = { + 0, 1, 3, + 1, 2, 3 + }; + rect = new Vao(rVertices, rIndices); + final int NUM_POINTS = 10; + float[] cVertices = new float[NUM_POINTS * 3]; + int[] cIndices = new int[(NUM_POINTS - 2) * 3]; + for (int i = 0; i < cVertices.length; i += 3) { + double angle = Math.PI * i / (NUM_POINTS * 3 - 3) + Math.PI / 2; + cVertices[i ] = (float) Math.cos(angle) / 2; + cVertices[i + 1] = (float) Math.sin(angle) / 2; + cVertices[i + 2] = 0; + } + for (int i = 0; i < cIndices.length; i += 3) { + cIndices[i ] = 0; + cIndices[i + 1] = i / 3 + 1; + cIndices[i + 2] = i / 3 + 2; + } + cap = new Vao(cVertices, cIndices); + } + + public void render() { + shader.enable(); + shader.setColor(r, g, b, a); + shader.setMVP(camera.getMatrix().translate(position).rotateZ(angle).scale(thickness)); + cap.render(); + shader.setMVP(camera.getMatrix().translate(position).rotateZ(angle).scale(length, thickness, 1)); + rect.render(); + shader.setMVP(camera.getMatrix().translate(position.add((float) (Math.cos(angle) * length), (float) (-Math.sin(Math.PI + angle) * length), 0, new Vector3f())).rotateZ((float) Math.PI).rotateZ(angle).scale(thickness)); + cap.render(); + shader.disable(); + } + + public void setAngle(float x, float y, float angle, float length) { + position.x = x; + position.y = y; + this.angle = angle; + this.length = length; + } + + public void setPoints(float x1, float y1, float x2, float y2) { + float xl = x2 - x1; + float yl = y2 - y1; + length = (float) Math.sqrt(xl * xl + yl * yl); + if(x1 != x2) { + angle = (float) Math.atan(yl / xl); + if(xl < 0) + angle += Math.PI; + setAngle(x1, y1, angle, length); + } + else if(y1 > y2) + setAngle(x1, y1, (float) Math.PI * 1.5f, length); + else if(y1 < y2) + setAngle(x1, y1, (float) Math.PI * 0.5f, length); + else + setAngle(x1, y1, 0, 0); + } + + public void setPoints(Vector3f p1, Vector3f p2) { + setPoints(p1.x, p1.y, p2.x, p2.y); + } + + public void setThickness(float thickness) { + this.thickness = thickness; + } + + public void setDepth(float z) { + position.z = z; + } + + public void setColor(float r, float g, float b, float a) { + this.r = r; + this.g = g; + this.b = b; + this.a = a; + } +} diff --git a/src/com/gnarly/engine/model/Rect.java b/src/com/gnarly/engine/model/Rect.java new file mode 100644 index 0000000..00cc5f4 --- /dev/null +++ b/src/com/gnarly/engine/model/Rect.java @@ -0,0 +1,126 @@ +package com.gnarly.engine.model; + +import org.joml.Vector2f; +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; + +public class Rect { + + protected static Vao vao; + + protected Camera camera; + + protected float width, height; + protected Vector3f position; + protected float rotation, scale; + protected boolean gui; + + protected Rect(Camera camera, float x, float y, float z, float width, float height, float rotation, boolean gui) { + this.camera = camera; + this.width = width; + this.height = height; + position = new Vector3f(x, y, z); + scale = 1; + this.rotation = rotation; + this.gui = gui; + if(vao == null) { + float vertices[] = { + 1, 0, 0, // Top left + 1, 1, 0, // Bottom left + 0, 1, 0, // Bottom right + 0, 0, 0 // Top right + }; + int indices[] = { + 0, 1, 3, + 1, 2, 3 + }; + float[] texCoords = { + 1, 0, + 1, 1, + 0, 1, + 0, 0 + }; + vao = new Vao(vertices, indices); + vao.addAttrib(texCoords, 2); + } + } + + public float getX() { + return position.x; + } + + public float getY() { + return position.y; + } + + public float getWidth() { + return width; + } + + public float getHeight() { + return height; + } + + public void setX(float x) { + position.x = x; + } + + public void setY(float y) { + position.y = y; + } + + public void set(float x, float y, float width, float height) { + position.x = x; + position.y = y; + this.width = width; + this.height = height; + } + + public void setWidth(float width) { + this.width = width; + } + + public void setHeight(float height) { + this.height = height; + } + + public void setPosition(float x, float y) { + position.set(x, y, position.z); + } + + public void setPosition(float x, float y, float z) { + position.set(x, y, z); + } + + public void setPosition(Vector3f position) { + this.position.x = position.x; + this.position.y = position.y; + this.position.z = position.z; + } + + public void setPosition(Vector2f position) { + this.position.x = position.x; + this.position.y = position.y; + } + + public void translate(Vector3f vector) { + position.add(vector); + } + + public void translate(float x, float y, float z) { + position.add(x, y, z); + } + + public void setRotation(float angle) { + rotation = angle; + } + + public void rotate(float angle) { + rotation += angle; + } + + public void setScale(float scale) { + this.scale = scale; + } +} diff --git a/src/com/gnarly/engine/model/TexRect.java b/src/com/gnarly/engine/model/TexRect.java new file mode 100644 index 0000000..7d5b696 --- /dev/null +++ b/src/com/gnarly/engine/model/TexRect.java @@ -0,0 +1,41 @@ +package com.gnarly.engine.model; + +import java.io.IOException; + +import org.joml.Matrix4f; +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.shaders.Shader; +import com.gnarly.engine.shaders.Shader2t; +import com.gnarly.engine.texture.Texture; + +public class TexRect extends Rect { + + private Texture texture; + private Shader2t shader = Shader.SHADER2T; + + public TexRect(Camera camera, String path, float x, float y, float z, float width, float height, float rotation, boolean gui) { + super(camera, x, y, z, width, height, rotation, gui); + texture = new Texture(path); + } + + public TexRect(Camera camera, Texture texture, float x, float y, float z, float width, float height, float rotation, boolean gui) { + super(camera, x, y, z, width, height, rotation, gui); + this.texture = texture; + } + + public void render() { + texture.bind(); + shader.enable(); + Matrix4f cmat = gui ? camera.getProjection() : camera.getMatrix(); + shader.setMVP(cmat.translate(position.add(width * scale / 2, height * scale / 2, 0, new Vector3f())).rotateZ(rotation * 3.1415927f / 180).scale(width * scale, height * scale, 1).translate(-0.5f, -0.5f, 0)); + vao.render(); + shader.disable(); + texture.unbind(); + } + + public void setTexture(Texture texture) { + this.texture = texture; + } +} diff --git a/src/com/gnarly/engine/model/Vao.java b/src/com/gnarly/engine/model/Vao.java new file mode 100644 index 0000000..da101be --- /dev/null +++ b/src/com/gnarly/engine/model/Vao.java @@ -0,0 +1,63 @@ +package com.gnarly.engine.model; + +import static org.lwjgl.opengl.GL11.GL_FLOAT; +import static org.lwjgl.opengl.GL11.GL_TRIANGLES; +import static org.lwjgl.opengl.GL11.GL_UNSIGNED_INT; +import static org.lwjgl.opengl.GL11.glDrawElements; +import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER; +import static org.lwjgl.opengl.GL15.GL_ELEMENT_ARRAY_BUFFER; +import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW; +import static org.lwjgl.opengl.GL15.glBindBuffer; +import static org.lwjgl.opengl.GL15.glBufferData; +import static org.lwjgl.opengl.GL15.glDeleteBuffers; +import static org.lwjgl.opengl.GL15.glGenBuffers; +import static org.lwjgl.opengl.GL20.glDisableVertexAttribArray; +import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray; +import static org.lwjgl.opengl.GL20.glVertexAttribPointer; +import static org.lwjgl.opengl.GL30.glBindVertexArray; +import static org.lwjgl.opengl.GL30.glDeleteVertexArrays; +import static org.lwjgl.opengl.GL30.glGenVertexArrays; + +public class Vao { + + private int numAttribs = 0; + + private int vao, ibo, count; + + private int[] vbos = new int[15]; + + public Vao(float[] vertices, int[] indices) { + vao = glGenVertexArrays(); + glBindVertexArray(vao); + addAttrib(vertices, 3); + ibo = glGenBuffers(); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices, GL_STATIC_DRAW); + count = indices.length; + } + + public void addAttrib(float[] data, int size) { + int vbo = glGenBuffers(); + vbos[numAttribs] = vbo; + glBindBuffer(GL_ARRAY_BUFFER, vbo); + glBufferData(GL_ARRAY_BUFFER, data, GL_STATIC_DRAW); + glVertexAttribPointer(numAttribs, size, GL_FLOAT, false, 0, 0); + ++numAttribs; + } + + public void render() { + glBindVertexArray(vao); + for(int i = 0; i < numAttribs; ++i) + glEnableVertexAttribArray(i); + glDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_INT, 0); + for(int i = 0; i < numAttribs; ++i) + glDisableVertexAttribArray(i); + } + + public void destroy() { + for(int vbo : vbos) + glDeleteBuffers(vbo); + glDeleteBuffers(ibo); + glDeleteVertexArrays(vao); + } +} diff --git a/src/com/gnarly/engine/properties/ImproperFormattingException.java b/src/com/gnarly/engine/properties/ImproperFormattingException.java new file mode 100644 index 0000000..202410e --- /dev/null +++ b/src/com/gnarly/engine/properties/ImproperFormattingException.java @@ -0,0 +1,8 @@ +package com.gnarly.engine.properties; + +public class ImproperFormattingException extends RuntimeException { + + public ImproperFormattingException(String message) { + super(message); + } +} diff --git a/src/com/gnarly/engine/properties/Properties.java b/src/com/gnarly/engine/properties/Properties.java new file mode 100644 index 0000000..9006add --- /dev/null +++ b/src/com/gnarly/engine/properties/Properties.java @@ -0,0 +1,104 @@ +package com.gnarly.engine.properties; + +public class Properties { + + private String name; + private PropNode head, cur; + + public Properties(String name) { + this.name = new String(name); + } + + public void add(PropNode node) { + if(head == null) { + head = node; + cur = node; + } + else { + cur.next = node; + cur = cur.next; + } + } + + private PropNode get(String key) throws UndeclaredPropertyException { + String[] keys = key.split("\\."); + PropNode mobile = head; + while (mobile != null) { + if(mobile.key.equals(keys[0])) { + if(keys.length > 1 && mobile instanceof BlockNode) + return ((BlockNode) mobile).data.get(key.substring(keys[0].length() + 1)); + else + return mobile; + } + mobile = mobile.next; + } + throw new UndeclaredPropertyException("Property '" + key + "' in properties '" + name + "' was not found!"); + } + + public String getAsString(String key) throws UndeclaredPropertyException { + return ((StringNode) get(key)).data; + } + + public int getAsInt(String key) throws UndeclaredPropertyException { + return ((IntNode) get(key)).data; + } + + public int[] getAsIntArray(String key) throws UndeclaredPropertyException { + PropNode node = get(key); + if(node instanceof IntNode) + return new int[] { ((IntNode) node).data }; + return ((IntArrayNode) get(key)).data; + } + + public double getAsDouble(String key) throws UndeclaredPropertyException { + PropNode node = get(key); + if(node instanceof IntNode) + return (double) ((IntNode) node).data; + return ((DoubleNode) get(key)).data; + } + + public double[] getAsDoubleArray(String key) throws UndeclaredPropertyException { + PropNode node = get(key); + if(node instanceof DoubleNode) + return new double[] { ((DoubleNode) node).data }; + if(node instanceof IntNode) + return new double[] { ((IntNode) node).data }; + if(node instanceof IntArrayNode) { + int[] ints = getAsIntArray(key); + double[] ret = new double[ints.length]; + for (int i = 0; i < ints.length; ++i) + ret[i] = ints[i]; + return ret; + } + return ((DoubleArrayNode) get(key)).data; + } + + public static class PropNode { + public String key; + public PropNode next; + } + + public static class BlockNode extends PropNode { + public Properties data; + } + + public static class StringNode extends PropNode { + public String data; + } + + public static class IntNode extends PropNode { + public int data; + } + + public static class IntArrayNode extends PropNode { + public int[] data; + } + + public static class DoubleNode extends PropNode { + public double data; + } + + public static class DoubleArrayNode extends PropNode { + public double[] data; + } +} diff --git a/src/com/gnarly/engine/properties/PropertyReader.java b/src/com/gnarly/engine/properties/PropertyReader.java new file mode 100644 index 0000000..12353fb --- /dev/null +++ b/src/com/gnarly/engine/properties/PropertyReader.java @@ -0,0 +1,90 @@ +package com.gnarly.engine.properties; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; +import com.gnarly.engine.properties.Properties.*; + +public class PropertyReader { + + private static int lineNum; + private static String path; + + public static Properties readProperties(String path) { + Properties props = null; + try { + File file = new File(path); + Scanner scanner = new Scanner(file); + PropertyReader.path = path; + lineNum = 0; + props = readBlock(file.getName(), scanner).data; + scanner.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + System.exit(-1); + } + return props; + } + + private static BlockNode readBlock(String name, Scanner scanner) { + BlockNode props = new BlockNode(); + props.key = name; + props.data = new Properties(name); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + line = line.replaceAll("\\s", ""); + if(line.equals("}")) + break; + else if(line.length() < 2 || !line.substring(0, 2).equals("//")){ + String[] pair = line.split(":"); + if (pair.length != 2) + throw new ImproperFormattingException("Formatting exception on line " + line + " in file '" + path + "!"); + pair[1] = pair[1].replaceAll("\\s", ""); + if (pair[1].equals("{")) + props.data.add(readBlock(pair[0], scanner)); + else if (pair[1].matches("(\\d+|0x[\\da-f]+)")) { + IntNode node = new IntNode(); + node.key = pair[0]; + node.data = Integer.decode(pair[1]); + props.data.add(node); + } + else if (pair[1].matches("(\\d+|0x[\\d0-9]+)(,(\\d+|0x[\\d0-9]+))+")) { + String[] data = pair[1].split(","); + int[] ints = new int[data.length]; + for (int i = 0; i < ints.length; ++i) + ints[i] = Integer.decode(data[i]); + IntArrayNode node = new IntArrayNode(); + node.key = pair[0]; + node.data = ints; + props.data.add(node); + + } + else if (pair[1].matches("\\d+\\.\\d+")) { + DoubleNode node = new DoubleNode(); + node.key = pair[0]; + node.data = Double.parseDouble(pair[1]); + props.data.add(node); + } + else if (pair[1].matches("\\d+\\.\\d+(,\\d+\\.\\d+)+")) { + String[] data = pair[1].split(","); + double[] doubles = new double[data.length]; + for (int i = 0; i < doubles.length; ++i) + doubles[i] = Double.parseDouble(data[i]); + DoubleArrayNode node = new DoubleArrayNode(); + node.key = pair[0]; + node.data = doubles; + props.data.add(node); + + } + else { + StringNode node = new StringNode(); + node.key = pair[0]; + node.data = pair[1]; + props.data.add(node); + } + } + ++lineNum; + } + return props; + } +} diff --git a/src/com/gnarly/engine/properties/UndeclaredPropertyException.java b/src/com/gnarly/engine/properties/UndeclaredPropertyException.java new file mode 100644 index 0000000..56bb7dd --- /dev/null +++ b/src/com/gnarly/engine/properties/UndeclaredPropertyException.java @@ -0,0 +1,8 @@ +package com.gnarly.engine.properties; + +public class UndeclaredPropertyException extends Exception { + + public UndeclaredPropertyException(String exception) { + super(exception); + } +} diff --git a/src/com/gnarly/engine/shaders/Shader.java b/src/com/gnarly/engine/shaders/Shader.java new file mode 100644 index 0000000..8dc9359 --- /dev/null +++ b/src/com/gnarly/engine/shaders/Shader.java @@ -0,0 +1,101 @@ +package com.gnarly.engine.shaders; + +import static org.lwjgl.opengl.GL20.GL_COMPILE_STATUS; +import static org.lwjgl.opengl.GL20.GL_FRAGMENT_SHADER; +import static org.lwjgl.opengl.GL20.GL_VERTEX_SHADER; +import static org.lwjgl.opengl.GL20.glAttachShader; +import static org.lwjgl.opengl.GL20.glCompileShader; +import static org.lwjgl.opengl.GL20.glCreateProgram; +import static org.lwjgl.opengl.GL20.glCreateShader; +import static org.lwjgl.opengl.GL20.glDeleteProgram; +import static org.lwjgl.opengl.GL20.glDeleteShader; +import static org.lwjgl.opengl.GL20.glDetachShader; +import static org.lwjgl.opengl.GL20.glGetShaderInfoLog; +import static org.lwjgl.opengl.GL20.glGetShaderi; +import static org.lwjgl.opengl.GL20.glGetUniformLocation; +import static org.lwjgl.opengl.GL20.glLinkProgram; +import static org.lwjgl.opengl.GL20.glShaderSource; +import static org.lwjgl.opengl.GL20.glUniformMatrix4fv; +import static org.lwjgl.opengl.GL20.glUseProgram; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import org.joml.Matrix4f; + +public abstract class Shader { + + public static Shader2c SHADER2C; + public static Shader2t SHADER2T; + public static Shader2ft SHADER2FT; + + protected int program; + + protected int mvpLoc; + + protected Shader(String vertPath, String fragPath) { + program = glCreateProgram(); + + int vert = loadShader(vertPath, GL_VERTEX_SHADER); + int frag = loadShader(fragPath, GL_FRAGMENT_SHADER); + + glAttachShader(program, vert); + glAttachShader(program, frag); + + glLinkProgram(program); + + glDetachShader(program, vert); + glDetachShader(program, frag); + + glDeleteShader(vert); + glDeleteShader(frag); + + mvpLoc = glGetUniformLocation(program, "mvp"); + } + + private int loadShader(String path, int type) { + StringBuilder file = new StringBuilder(); + try { + BufferedReader reader = new BufferedReader(new FileReader(new File(path))); + String line; + while((line = reader.readLine()) != null) + file.append(line + '\n'); + reader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + String source = file.toString(); + int shader = glCreateShader(type); + glShaderSource(shader, source); + glCompileShader(shader); + if(glGetShaderi(shader, GL_COMPILE_STATUS) != 1) + throw new RuntimeException("Failed to compile shader: " + path + "! " + glGetShaderInfoLog(shader)); + return shader; + } + + protected abstract void getUniforms(); + + public void setMVP(Matrix4f matrix) { + glUniformMatrix4fv(mvpLoc, false, matrix.get(new float[16])); + } + + public void enable() { + glUseProgram(program); + } + + public void disable() { + glUseProgram(0); + } + + public void destroy() { + glDeleteProgram(program); + } + + public static void init() { + SHADER2C = new Shader2c (); + SHADER2T = new Shader2t (); + SHADER2FT = new Shader2ft(); + } +} diff --git a/src/com/gnarly/engine/shaders/Shader2c.java b/src/com/gnarly/engine/shaders/Shader2c.java new file mode 100644 index 0000000..6939682 --- /dev/null +++ b/src/com/gnarly/engine/shaders/Shader2c.java @@ -0,0 +1,27 @@ +package com.gnarly.engine.shaders; + +import static org.lwjgl.opengl.GL20.*; + +public class Shader2c extends Shader { + + int colorLoc; + + protected Shader2c(String vert, String frag) { + super(vert, frag); + getUniforms(); + } + + protected Shader2c() { + super("res/shaders/s2c/vert.gls", "res/shaders/s2c/frag.gls"); + getUniforms(); + } + + @Override + protected void getUniforms() { + colorLoc = glGetUniformLocation(program, "iColor"); + } + + public void setColor(float r, float g, float b, float a) { + glUniform4f(colorLoc, r, g, b, a); + } +} diff --git a/src/com/gnarly/engine/shaders/Shader2ft.java b/src/com/gnarly/engine/shaders/Shader2ft.java new file mode 100644 index 0000000..1c83392 --- /dev/null +++ b/src/com/gnarly/engine/shaders/Shader2ft.java @@ -0,0 +1,8 @@ +package com.gnarly.engine.shaders; + +public class Shader2ft extends Shader2c { + + protected Shader2ft() { + super("res/shaders/s2ft/vert.gls", "res/shaders/s2ft/frag.gls"); + } +} diff --git a/src/com/gnarly/engine/shaders/Shader2t.java b/src/com/gnarly/engine/shaders/Shader2t.java new file mode 100644 index 0000000..9e6d722 --- /dev/null +++ b/src/com/gnarly/engine/shaders/Shader2t.java @@ -0,0 +1,11 @@ +package com.gnarly.engine.shaders; + +public class Shader2t extends Shader { + + protected Shader2t() { + super("res/shaders/s2t/vert.gls", "res/shaders/s2t/frag.gls"); + } + + @Override + protected void getUniforms() {} +} \ No newline at end of file diff --git a/src/com/gnarly/engine/texture/Texture.java b/src/com/gnarly/engine/texture/Texture.java new file mode 100644 index 0000000..a3544a7 --- /dev/null +++ b/src/com/gnarly/engine/texture/Texture.java @@ -0,0 +1,89 @@ +package com.gnarly.engine.texture; + +import static com.gnarly.game.PathUtils.*; + +import static org.lwjgl.opengl.GL11.GL_CLAMP; +import static org.lwjgl.opengl.GL11.GL_NEAREST; +import static org.lwjgl.opengl.GL11.GL_RGBA; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_MAG_FILTER; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_MIN_FILTER; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_S; +import static org.lwjgl.opengl.GL11.GL_TEXTURE_WRAP_T; +import static org.lwjgl.opengl.GL11.GL_UNSIGNED_BYTE; +import static org.lwjgl.opengl.GL11.glBindTexture; +import static org.lwjgl.opengl.GL11.glDeleteTextures; +import static org.lwjgl.opengl.GL11.glGenTextures; +import static org.lwjgl.opengl.GL11.glTexImage2D; +import static org.lwjgl.opengl.GL11.glTexParameterf; + +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; + +import javax.imageio.ImageIO; + +import org.lwjgl.BufferUtils; + +public class Texture { + + protected int id, width, height; + + public Texture(String name) { + BufferedImage bi = null; + try { + bi = ImageIO.read(new File("res/" + theme + "/img/" + res + "/" + name)); + } catch (IOException e) { + try { + bi = ImageIO.read(new File("res/" + theme + "/img/const/" + name)); + } catch (IOException ex) { + e.printStackTrace(); + } + } + if (bi != null) { + width = bi.getWidth(); + height = bi.getHeight(); + int[] pixels = bi.getRGB(0, 0, width, height, null, 0, width); + ByteBuffer buffer = BufferUtils.createByteBuffer(width * height * 4); + + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + int pixel = pixels[i * width + j]; + buffer.put((byte)((pixel >> 16) & 0xFF)); // Red + buffer.put((byte)((pixel >> 8) & 0xFF)); // Green + buffer.put((byte)((pixel ) & 0xFF)); // Blue + buffer.put((byte)((pixel >> 24) & 0xFF)); // Alpha + } + } + buffer.flip(); + + id = glGenTextures(); + bind(); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer); + unbind(); + } + } + + public Texture(int id, int width, int height) { + this.id = id; + this.width = width; + this.height = height; + } + + public void bind() { + glBindTexture(GL_TEXTURE_2D, id); + } + + public void unbind() { + glBindTexture(GL_TEXTURE_2D, 0); + } + + public void destroy() { + glDeleteTextures(id); + } +} diff --git a/src/com/gnarly/game/Button.java b/src/com/gnarly/game/Button.java new file mode 100644 index 0000000..5c172e9 --- /dev/null +++ b/src/com/gnarly/game/Button.java @@ -0,0 +1,81 @@ +package com.gnarly.game; + +import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_1; + +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.TexRect; + +public class Button { + + public static final int + UNPRESSED = 0, + RELEASED = 1, + PRESSED = 2, + HELD = 3; + + private Window window; + private Camera camera; + + private TexRect[] states; + + private float x, y, width, height; + + private int state, tex; + + public Button(Window window, Camera camera, String tex1, String tex2, String tex3, float x, float y, float depth, float width, float height, boolean gui) { + this.window = window; + this.camera = camera; + this.x = x; + this.y = y; + this.width = width; + this.height = height; + states = new TexRect[3]; + states[0] = new TexRect(camera, tex1, x, y, depth, width, height, 0, gui); + states[1] = new TexRect(camera, tex2, x, y, depth, width, height, 0, gui); + states[2] = new TexRect(camera, tex3, x, y, depth, width, height, 0, gui); + tex = 0; + state = 0; + } + + public void update() { + if(contains(window.getMouseCoords(camera))) { + if(window.mousePressed(GLFW_MOUSE_BUTTON_1) > Window.BUTTON_UNPRESSED) { + tex = 2; + if(state <= RELEASED) + state = PRESSED; + else + state = HELD; + } + else { + tex = 1; + if(state >= PRESSED) + state = RELEASED; + else + state = UNPRESSED; + } + } + else { + tex = 0; + state = UNPRESSED; + } + } + + public void render() { + states[tex].render(); + } + + public boolean contains(Vector3f coords) { + return coords.x >= x && coords.y >= y && coords.x < x + width && coords.y < y + height; + } + + public int getState() { + return state; + } + + public void setTex(int tex) { + this.tex = tex; + } +} diff --git a/src/com/gnarly/game/ByteKeys.java b/src/com/gnarly/game/ByteKeys.java new file mode 100644 index 0000000..bc10a54 --- /dev/null +++ b/src/com/gnarly/game/ByteKeys.java @@ -0,0 +1,66 @@ +package com.gnarly.game; + +import static com.gnarly.engine.display.Window.*; +import static com.gnarly.game.PathUtils.res; +import static com.gnarly.game.PathUtils.theme; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_A; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_D; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_F; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_J; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_K; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_L; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_S; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_SEMICOLON; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.FadeTexRect; + +public class ByteKeys { + + private Window window; + private Camera camera; + + private FadeTexRect[] letTexs; + + public ByteKeys(Window window, Camera camera) { + this.window = window; + this.camera = camera; + + letTexs = new FadeTexRect[8]; + letTexs[0] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/a.png", 0, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[1] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/s.png", 16, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[2] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/d.png", 32, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[3] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/f.png", 48, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[4] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/j.png", 64, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[5] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/k.png", 80, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[6] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/l.png", 96, 0, 0, 16, 16, 0, 0, 0, 1, true); + letTexs[7] = new FadeTexRect(camera, "res/" + theme + "/letters/" + res + "/semicolon.png", 112, 0, 0, 16, 16, 0, 0, 0, 1, true); + } + + public void update() { + for (int i = 0; i < 8; ++i) + letTexs[i].update(); + checkKey(GLFW_KEY_A, 0); + checkKey(GLFW_KEY_S, 1); + checkKey(GLFW_KEY_D, 2); + checkKey(GLFW_KEY_F, 3); + checkKey(GLFW_KEY_J, 4); + checkKey(GLFW_KEY_K, 5); + checkKey(GLFW_KEY_L, 6); + checkKey(GLFW_KEY_SEMICOLON, 7); + } + + public void render() { + for (int i = 0; i < 8; ++i) + letTexs[i].render(); + } + + + private void checkKey(int key, int index) { + if (window.keyPressed(key) >= BUTTON_PRESSED) + letTexs[index].setColor(1, 0, 0, 1); + else if(window.keyPressed(key) == BUTTON_RELEASED) + letTexs[index].fadeTo(0, 0, 0, 1, 500); + } +} diff --git a/src/com/gnarly/game/EndPanel.java b/src/com/gnarly/game/EndPanel.java new file mode 100644 index 0000000..9ff2f2f --- /dev/null +++ b/src/com/gnarly/game/EndPanel.java @@ -0,0 +1,180 @@ +package com.gnarly.game; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.FadeRect; +import com.gnarly.engine.model.TexRect; +import com.gnarly.game.map.MapEntry; +import com.gnarly.game.map.Stack; + +public class EndPanel extends Panel { + + private double time; + + private TexRect gameOver, logo, play, scoreText; + + private Button easy, medium, hard, helpButton, prev, next, back; + + private int difficulty; + + private boolean end = false; + + private NumberDisplay highscore; + + private FadeRect overlay; + + private boolean helpActive; + private int index; + private TexRect[] help; + + public EndPanel(Window window, Camera camera) { + gameOver = new TexRect(camera, "gameover.png", 144, 55,-0.1f, 290, 100, 0, true); + logo = new TexRect(camera, "logo.png", 144, 55, -0.1f, 290, 100, 0, true); + + play = new TexRect(camera, "playicon.png", 144, 140, -0.1f, 290, 45, 0, false); + + easy = new Button(window, camera, "easyone.png", "easytwo.png", "easythree.png", 144, 200, -0.1f, 90, 45, false); + medium = new Button(window, camera, "medone.png", "medtwo.png", "medthree.png", 244, 200, -0.1f, 90, 45, false); + hard = new Button(window, camera, "hardone.png", "hardtwo.png", "hardthree.png", 344, 200, -0.1f, 90, 45, false); + + helpButton = new Button(window, camera, "helpone.png", "helptwo.png", "helpthree.png", 268, 252, -0.1f, 40, 20, false); + + back = new Button(window, camera, "backone.png", "backtwo.png", "backthree.png", camera.getWidth() - 78, 6, 0, 20, 20, false); + prev = new Button(window, camera, "prevone.png", "prevtwo.png", "prevthree.png", camera.getWidth() - 52, 6, 0, 20, 20, false); + next = new Button(window, camera, "nextone.png", "nexttwo.png", "nextthree.png", camera.getWidth() - 26, 6, 0, 20, 20, false); + + int highScore = 0; + File file = new File("res/high.sco"); + if(file.exists()) { + try { + Scanner scanner = new Scanner(file); + highScore = scanner.nextInt(); + scanner.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + highscore = new NumberDisplay(camera, 297, 280, -0.1f, MapEntry.TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, highScore, 8, NumberDisplay.DISPLAY_DEC); + scoreText = new TexRect(camera, "highscore.png", 207, 280, -0.1f, MapEntry.TILE_WIDTH * 9, MapEntry.TILE_HEIGHT, 0, false); + + overlay = new FadeRect(camera, 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, 0, 0, 0, false); + + helpActive = false; + index = 0; + help = new TexRect[8]; + help[0] = new TexRect(camera, "help/premise.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[1] = new TexRect(camera, "help/overview.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[2] = new TexRect(camera, "help/interface.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[3] = new TexRect(camera, "help/controls.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[4] = new TexRect(camera, "help/thebyte.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[5] = new TexRect(camera, "help/groups.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[6] = new TexRect(camera, "help/swapping.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + help[7] = new TexRect(camera, "help/difficulty.png", 0, 0, 0, camera.getWidth(), camera.getHeight(), 0, false); + } + + @Override + public void update() { + if(!helpActive) { + easy.update(); + medium.update(); + hard.update(); + helpButton.update(); + if(easy.getState() == Button.RELEASED) { + state = Main.PANEL_PLAY; + difficulty = Stack.DIFFICULTY_EASY; + } + else if(medium.getState() == Button.RELEASED) { + state = Main.PANEL_PLAY; + difficulty = Stack.DIFFICULTY_MEDIUM; + } + else if(hard.getState() == Button.RELEASED) { + state = Main.PANEL_PLAY; + difficulty = Stack.DIFFICULTY_HARD; + } + else if(helpButton.getState() == Button.RELEASED) { + helpActive = true; + index = 0; + } + overlay.update(); + } + else { + back.update(); + if(back.getState() == Button.PRESSED) + helpActive = false; + if(index != 0) { + prev.update(); + if(prev.getState() == Button.PRESSED) { + --index; + } + } + else + prev.setTex(2); + if(index != help.length - 1) { + next.update(); + if(next.getState() == Button.PRESSED) { + ++index; + } + } + else + next.setTex(2); + } + } + + @Override + public void render() { + if(!helpActive) { + if(end) + gameOver.render(); + else + logo.render(); + easy.render(); + medium.render(); + hard.render(); + play.render(); + highscore.render(); + scoreText.render(); + helpButton.render(); + overlay.render(); + } + else { + back.render(); + prev.render(); + next.render(); + help[index].render(); + } + } + + public int getState() { + int temp = state; + state = Main.PANEL_END; + return temp; + } + + public void setActive() { + overlay.fadeFromTo(0, 0, 0, 1, 0, 0, 0, 0, 1000); + time = 0; + end = true; + + int highScore = 0; + File file = new File("res/high.sco"); + if(file.exists()) { + try { + Scanner scanner = new Scanner(file); + highScore = scanner.nextInt(); + scanner.close(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + this.highscore.setValue(highScore); + } + + public int getDifficulty() { + return difficulty; + } +} diff --git a/src/com/gnarly/game/Hitbox.java b/src/com/gnarly/game/Hitbox.java new file mode 100644 index 0000000..a294826 --- /dev/null +++ b/src/com/gnarly/game/Hitbox.java @@ -0,0 +1,121 @@ +package com.gnarly.game; + +import org.joml.Vector3f; + +public class Hitbox { + + private Vector3f position, dims; + + public Hitbox(float x, float y, float width, float height) { + position = new Vector3f(x, y, 0); + dims = new Vector3f(width, height, 0); + } + + public boolean collides(Hitbox hitbox) { + Vector3f center = getCenter(); + Vector3f center2 = hitbox.getCenter(); + Vector3f halfExtent = getHalfExtent(); + Vector3f halfExtent2 = hitbox.getHalfExtent(); + return Math.abs(center.x - center2.x) < Math.abs(halfExtent.x + halfExtent2.x) && + Math.abs(center.y - center2.y) < Math.abs(halfExtent.y + halfExtent2.y); + } + + public Vector3f getTransform(Hitbox hitbox) { + Vector3f center = getCenter(); + Vector3f center2 = hitbox.getCenter(); + Vector3f halfExtent = getHalfExtent(); + Vector3f halfExtent2 = hitbox.getHalfExtent(); + float dx = Math.abs(center.x - center2.x) - Math.abs(halfExtent.x + halfExtent2.x); + float dy = Math.abs(center.y - center2.y) - Math.abs(halfExtent.y + halfExtent2.y); + if (Math.abs(dx) < Math.abs(dy)) + dy = 0; + else + dx = 0; + if(center.x < center2.x) dx = -dx; + if(center.y < center2.y) dy = -dy; + return new Vector3f(dx, dy, 0); + } + + public float getTransformX(Hitbox hitbox) { + Vector3f center = getCenter(); + Vector3f center2 = hitbox.getCenter(); + Vector3f halfExtent = getHalfExtent(); + Vector3f halfExtent2 = hitbox.getHalfExtent(); + float dx = Math.abs(center.x - center2.x) - Math.abs(halfExtent.x + halfExtent2.x); + if (center.x < center2.x) dx = -dx; + return dx; + } + + public float getTransformY(Hitbox hitbox) { + Vector3f center = getCenter(); + Vector3f center2 = hitbox.getCenter(); + Vector3f halfExtent = getHalfExtent(); + Vector3f halfExtent2 = hitbox.getHalfExtent(); + float dy = Math.abs(center.y - center2.y) - Math.abs(halfExtent.y + halfExtent2.y); + if (center.y < center2.y) dy = -dy; + return dy; + } + + public static boolean intersect(Vector3f p1, Vector3f p2, Vector3f p3, Vector3f p4) { + float cmax = p3.x - p1.x, cmay = p3.y - p1.y, rx = p2.x - p1.x, ry = p2.y - p1.y, sx = p4.x - p3.x, sy = p4.y - p3.y; + float rxs = rx * sy - ry * sx; + float t = (cmax * sy - cmay * sx) / rxs; + float u = (cmax * ry - cmay * rx) / rxs; + return (u >= 0 && u <= 1 && t >= 0 && t <= 1); + } + + public Vector3f getPosition() { + return position; + } + + public void setPosition(float x, float y) { + position.x = x; + position.y = y; + } + + public void translate(Vector3f translate) { + position.x += translate.x; + position.y += translate.y; + } + + public void setBounds(float width, float height) { + dims.x = width; + dims.y = height; + } + + public float getX() { + return position.x; + } + + public float getY() { + return position.y; + } + + public float getWidth() { + return dims.x; + } + + public float getHeight() { + return dims.y; + } + + public Vector3f getCenter() { + return dims.div(2, new Vector3f()).add(position); + } + + public Vector3f getHalfExtent() { + return dims.div(2, new Vector3f()); + } + + public void set(float x, float y, float width, float height) { + position.x = x; + position.y = y; + dims.x = width; + dims.y = height; + } + + public void sync(Vector3f position, Vector3f dims) { + this.position = position; + this.dims = dims; + } +} diff --git a/src/com/gnarly/game/Main.java b/src/com/gnarly/game/Main.java new file mode 100644 index 0000000..8cfdee8 --- /dev/null +++ b/src/com/gnarly/game/Main.java @@ -0,0 +1,105 @@ +package com.gnarly.game; + +import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE; + +import com.gnarly.engine.audio.ALManagement; +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.properties.Properties; +import com.gnarly.engine.properties.PropertyReader; +import com.gnarly.engine.properties.UndeclaredPropertyException; +import com.gnarly.engine.shaders.Shader; + +public class Main { + + public static final int + PANEL_PLAY = 1, + PANEL_END = 2; + + private int FPS = 60; + + public static double dtime; + public static double ttime; + + private ALManagement al; + + private Window window; + private Camera camera; + + private int state = 0; + + private PlayPanel play; + private EndPanel end; + + private Panel panel; + + public void start() { + long curTime, pastTime, startTime, nspf = 1000000000 / FPS; + init(); + pastTime = System.nanoTime(); + startTime = pastTime; + while(!window.shouldClose()) { + curTime = System.nanoTime(); + if(curTime - pastTime > nspf) { + dtime = (curTime - pastTime) / 1000000d; + ttime = (curTime - startTime) / 1000000d; + update(); + render(); + pastTime = curTime; + } + } + al.destroy(); + Window.terminate(); + } + + private void init() { + al = new ALManagement(); + window = new Window("TBD", true); + camera = new Camera(576, 324); + Shader.init(); + PathUtils.init("res/options.prop"); + + play = new PlayPanel(window, camera); + end = new EndPanel(window, camera); + + panel = end; + state = PANEL_END; + } + + private void update() { + window.update(); + panel.update(); + camera.update(); + + switch(state) { + case PANEL_PLAY: { + int state = play.getState(); + if(state == PANEL_END) { + end.setActive(); + panel = end; + this.state = state; + } + break; + } + case PANEL_END: { + int state = end.getState(); + if(state == PANEL_PLAY) { + play.setActive(end.getDifficulty()); + panel = play; + this.state = state; + } + break; + } + } + } + + private void render() { + window.clear(); + panel.render(); + window.swap(); + } + + public static void main(String[] args) { + new Main().start(); + } +} diff --git a/src/com/gnarly/game/NumberDisplay.java b/src/com/gnarly/game/NumberDisplay.java new file mode 100644 index 0000000..f1a1dce --- /dev/null +++ b/src/com/gnarly/game/NumberDisplay.java @@ -0,0 +1,219 @@ +package com.gnarly.game; + +import org.joml.Vector2f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.model.FadeTexRect; +import com.gnarly.engine.texture.Texture; +import com.gnarly.game.map.MapEntry; + +public class NumberDisplay { + + public static final int + DISPLAY_BIN = 0, + DISPLAY_OCT = 8, + DISPLAY_DEC = 10, + DISPLAY_HEX = 16; + + public static final int + JUSTIFICATION_LEFT = 0, + JUSTIFICATION_CENTER = 1, + JUSTIFICATION_RIGHT = 2; + + public static Texture[] nums; + + private static final float DIMENSION_RATIO = (float) (9.0 / 12.0); + + private Camera camera; + + private long num; + private int minDigits; + + private int justification; + private float x, y, height; + + private FadeTexRect display; + + private int displayFormat; + + public NumberDisplay(Camera camera, float x, float y, float z, float height, int justification, long number, int minDigits, int displayFormat) { + this.camera = camera; + this.num = number; + this.minDigits = minDigits; + this.justification = justification; + this.x = x; + this.y = y; + this.height = height; + this.displayFormat = displayFormat; + if(nums == null) { + nums = new Texture[18]; + nums[0] = new Texture("zero.png"); + nums[1] = new Texture("one.png"); + nums[2] = new Texture("two.png"); + nums[3] = new Texture("three.png"); + nums[4] = new Texture("four.png"); + nums[5] = new Texture("five.png"); + nums[6] = new Texture("six.png"); + nums[7] = new Texture("seven.png"); + nums[8] = new Texture("eight.png"); + nums[9] = new Texture("nine.png"); + nums[10] = new Texture("a.png"); + nums[11] = new Texture("b.png"); + nums[12] = new Texture("c.png"); + nums[13] = new Texture("d.png"); + nums[14] = new Texture("e.png"); + nums[15] = new Texture("f.png"); + nums[16] = new Texture("r.png"); + nums[17] = new Texture("o.png"); + MapEntry.nums = nums; + } + display = new FadeTexRect(camera, nums[0], 0, 0, z, 0, 0, 1, 1, 1, 1, true); + } + + public void render() { + float width = height * DIMENSION_RATIO; + float x = this.x; + String text = "error"; + switch (displayFormat) { + case DISPLAY_BIN: + text = Long.toBinaryString(num); + break; + case DISPLAY_OCT: + text = Long.toOctalString(num); + break; + case DISPLAY_DEC: + text = Long.toString(num); + break; + case DISPLAY_HEX: + text = Long.toHexString(num); + break; + } + int numDigits = Math.max(minDigits, text.length()); + if(justification == JUSTIFICATION_CENTER) + x -= (numDigits / 2.0f) * width; + else if(justification == JUSTIFICATION_RIGHT) + x -= numDigits * width; + display.setX(x); + display.setY(y); + display.setHeight(height); + display.setWidth(width); + for(int i = 0; i < numDigits; ++i) { + int index = 0; + if(i + text.length() - numDigits > -1) { + if(text.charAt(i + text.length() - numDigits) == 'r') + index = 16; + else if(text.charAt(i + text.length() - numDigits) == 'o') + index = 17; + else if(text.charAt(i + text.length() - numDigits) >= 'a') + index = text.charAt(i + text.length() - numDigits) - 87; + else + index = text.charAt(i + text.length() - numDigits) - 48; + } + display.setTexture(nums[index]); + display.render(); + display.translate(width, 0, 0); + } + } + + private int getNumDigits() { + String text = "error"; + switch (displayFormat) { + case DISPLAY_BIN: + text = Long.toBinaryString(num); + break; + case DISPLAY_OCT: + text = Long.toOctalString(num); + break; + case DISPLAY_DEC: + text = Long.toString(num); + break; + case DISPLAY_HEX: + text = Long.toHexString(num); + break; + } + return text.length(); + } + + public int getDigit(int index) { + return (int) (num / Math.pow(displayFormat, index)) % displayFormat; + } + + public long getValue() { + return num; + } + + public void setValue(long num) { + this.num = num; + } + + public void add(long num) { + this.num += num; + } + + public void sub(long num) { + this.num -= num; + } + + public void increment() { + ++num; + } + + public void decrement() { + --num; + } + + public FadeTexRect getDisplay() { + return display; + } + + public void setHeight(float height) { + this.height = height; + } + + public void setDigitWidth(float width) { + this.height = width / DIMENSION_RATIO; + } + + public void setJustification(int justification) { + float x = getX(justification); + this.justification = justification; + this.x = x; + } + + public float getX() { + return getX(JUSTIFICATION_LEFT); + } + + public float getX(int justification) { + return this.x + ((justification - this.justification) * height * DIMENSION_RATIO * getNumDigits() / 2); + } + + public float getY() { + return y; + } + + public Vector2f getPosition() { + return new Vector2f(x, y); + } + + public Vector2f getPosition(int justification) { + return new Vector2f(x, y); + } + + public void setX(float x) { + this.x = x; + } + + public void setY(float y) { + this.y = y; + } + + public void setPosition(float x, float y) { + this.x = x; + this.y = y; + } + + public void setDisplayFormat(int displayFormat) { + this.displayFormat = displayFormat; + } +} diff --git a/src/com/gnarly/game/Panel.java b/src/com/gnarly/game/Panel.java new file mode 100644 index 0000000..edcc622 --- /dev/null +++ b/src/com/gnarly/game/Panel.java @@ -0,0 +1,9 @@ +package com.gnarly.game; + +public abstract class Panel { + + protected int state; + + public abstract void update(); + public abstract void render(); +} diff --git a/src/com/gnarly/game/PathUtils.java b/src/com/gnarly/game/PathUtils.java new file mode 100644 index 0000000..422ca3b --- /dev/null +++ b/src/com/gnarly/game/PathUtils.java @@ -0,0 +1,36 @@ +package com.gnarly.game; + +import com.gnarly.engine.display.Window; +import com.gnarly.engine.properties.Properties; +import com.gnarly.engine.properties.PropertyReader; +import com.gnarly.engine.properties.UndeclaredPropertyException; + +public class PathUtils { + + public static String res; + public static String theme; + + public static void init(String path) { + Properties props = PropertyReader.readProperties(path); + try { + res = props.getAsString("texRes"); + theme = props.getAsString("theme"); + if (res.equals("dynamic")) { + if(Window.SCREEN_HEIGHT > 2160) + res = "8k"; + else if(Window.SCREEN_HEIGHT > 1440) + res = "4k"; + else if(Window.SCREEN_HEIGHT > 1080) + res = "1440p"; + else if(Window.SCREEN_HEIGHT > 720) + res = "1080p"; + else + res = "720p"; + } + } catch (UndeclaredPropertyException e) { + e.printStackTrace(); + res = "4k"; + theme = "default"; + } + } +} diff --git a/src/com/gnarly/game/PlayPanel.java b/src/com/gnarly/game/PlayPanel.java new file mode 100644 index 0000000..cca54fb --- /dev/null +++ b/src/com/gnarly/game/PlayPanel.java @@ -0,0 +1,46 @@ +package com.gnarly.game; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.ColRect; +import com.gnarly.game.map.Map; +import com.gnarly.game.map.Stack; + +public class PlayPanel extends Panel { + + private Window window; + private Camera camera; + + private Map map; + + public PlayPanel(Window window, Camera camera) { + this.window = window; + this.camera = camera; + + state = Main.PANEL_PLAY; + + map = new Map(window, camera, null, Stack.DIFFICULTY_MEDIUM); + } + + public void update() { + map.update(); + if(map.checkEnd()) { + state = Main.PANEL_END; + map.checkScore(); + } + } + + public void render() { + map.render(); + } + + public int getState() { + int temp = state; + state = Main.PANEL_PLAY; + return temp; + } + + public void setActive(int difficulty) { + map.reset(difficulty); + } +} diff --git a/src/com/gnarly/game/map/ButtonTracker.java b/src/com/gnarly/game/map/ButtonTracker.java new file mode 100644 index 0000000..25210e5 --- /dev/null +++ b/src/com/gnarly/game/map/ButtonTracker.java @@ -0,0 +1,51 @@ +package com.gnarly.game.map; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.FadeTexRect; + +public class ButtonTracker extends FadeTexRect { + + public static final int + TRACK_DOWN = 0, + TRACK_PRESSED = 1, + TRACK_RELEASED = 2; + + private Window window; + + private int key; + private int method; + private boolean state; + + public ButtonTracker(Window window, Camera camera, String path, float x, float y, float z, float width, float height, int key, int method) { + super(camera, path, x, y, z, width, height, 1, 1, 1, 1, true); + this.window = window; + this.key = key; + this.method = method; + state = false; + } + + public void update() { + super.update(); + if (state && !checkKey()) { + state = false; + fadeTo(1, 1, 1, 1, 500); + } + else if(!state && checkKey()) { + state = true; + setColor(0, 1, 0, 1); + } + } + + private boolean checkKey() { + switch (method) { + case TRACK_DOWN: + return window.keyPressed(key) > Window.BUTTON_UNPRESSED; + case TRACK_PRESSED: + return window.keyPressed(key) == Window.BUTTON_PRESSED; + case TRACK_RELEASED: + return window.keyPressed(key) == Window.BUTTON_RELEASED; + } + return false; + } +} diff --git a/src/com/gnarly/game/map/Falling.java b/src/com/gnarly/game/map/Falling.java new file mode 100644 index 0000000..1e49810 --- /dev/null +++ b/src/com/gnarly/game/map/Falling.java @@ -0,0 +1,161 @@ +package com.gnarly.game.map; + +import static org.lwjgl.glfw.GLFW.GLFW_KEY_A; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_D; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_S; +import static org.lwjgl.glfw.GLFW.GLFW_KEY_SPACE; + +import java.util.Random; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.game.Main; +import com.gnarly.game.NumberDisplay; + +public class Falling { + + private static final double KEY_RATE = 50; + private static final double KEY_DOWN_RATE = 150; + private static final double TOP_STALL = 750; + + private Window window; + private Camera camera; + + private Map map; + private Stack stack; + private NumberDisplay numbers; + + private int x, y; + + private double rate, time; + + private double keyTime, downTime; + + private int init; + + private MapEntry[][] array; + + public Falling(Window window, Camera camera, Map map, Stack stack) { + this.window = window; + this.camera = camera; + this.map = map; + this.stack = stack; + this.array = map.getMap(); + numbers = new NumberDisplay(camera, 0, 0, 0, MapEntry.TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, 0, 8, stack.getDifficulty()); + } + + public void update() { + time += Main.dtime; + if(time > rate || (y == -1 && time > TOP_STALL + rate / 100) ) { + if(init == 0) { + Random random = new Random(); + x = random.nextInt(Map.MAP_WIDTH - 8); + y = -1; + numbers.setValue(stack.read()); + init = 1; + } + else { + ++y; + if(y == Map.MAP_HEIGHT || checkBelow()) { + --y; + finalize(); + return; + } + } + if(time > rate) + time -= rate; + else + time -= TOP_STALL + rate / 100; + } + if(y != -1) { + keyTime += Main.dtime; + if(keyTime > KEY_RATE) { + if(window.keyPressed(GLFW_KEY_A) > Window.BUTTON_UNPRESSED && !checkLeft()) + --x; + if(window.keyPressed(GLFW_KEY_D) > Window.BUTTON_UNPRESSED && !checkRight()) + ++x; + keyTime -= KEY_RATE; + } + downTime += Main.dtime; + if (downTime > KEY_DOWN_RATE) { + if(window.keyPressed(GLFW_KEY_S) > Window.BUTTON_UNPRESSED) { + ++y; + if (checkBelow() || y == Map.MAP_HEIGHT - 1) { + --y; + finalize(); + return; + } + } + } + if(window.keyPressed(GLFW_KEY_SPACE) == Window.BUTTON_PRESSED) { + finalize(); + return; + } + } + if(y == -1) + numbers.setPosition(Map.MAP_X_OFFSET + x * MapEntry.TILE_WIDTH, 8); + else + numbers.setPosition(Map.MAP_X_OFFSET + x * MapEntry.TILE_WIDTH, Map.MAP_Y_OFFSET + y * MapEntry.TILE_HEIGHT); + } + + private boolean checkBelow() { + if(y >= Map.MAP_HEIGHT - 1) + return false; + for(int i = 0; i < 8; ++i) + if(array[x + i][y].isActive()) + return true; + return false; + } + + private boolean checkLeft() { + return x - 1 < 0 || array[x - 1][y].isActive(); + } + + private boolean checkRight() { + return x + 8 == Map.MAP_WIDTH || array[x + 8][y].isActive(); + } + + public void finalize() { + if(y == -1) + map.triggerEnd(1); + else { + for(int i = 0; i < 8; ++i) { + int ty = y; + while (ty < Map.MAP_HEIGHT && !array[x + i][ty].isActive()) + ++ty; + --ty; + array[x + i][ty].setNum(numbers.getDigit(7 - i)); + array[x + i][ty].setActive(true); + } + init = 0; + time = rate + 1; + } + } + + public void render() { + numbers.render(); + } + + public void setDifficulty(int difficulty) { + numbers.setDisplayFormat(difficulty); + numbers.setValue(stack.read()); + } + + public void increaseRate(double time) { + rate -= time; + if (rate < 250) + rate = 250; + } + + public void reset() { + rate = 1000; + time = 0; + keyTime = 0; + downTime = 0; + Random random = new Random(); + x = random.nextInt(Map.MAP_WIDTH - 8); + y = -1; + numbers.setValue(stack.read()); + init = 1; + } +} diff --git a/src/com/gnarly/game/map/Map.java b/src/com/gnarly/game/map/Map.java new file mode 100644 index 0000000..ad33c1c --- /dev/null +++ b/src/com/gnarly/game/map/Map.java @@ -0,0 +1,311 @@ +package com.gnarly.game.map; + +import static com.gnarly.game.map.MapEntry.TILE_HEIGHT; +import static com.gnarly.game.map.MapEntry.TILE_WIDTH; +import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_1; +import static org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_2; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.Random; +import java.util.Scanner; + +import org.joml.Vector3f; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.display.Window; +import com.gnarly.engine.model.FadeRect; +import com.gnarly.engine.model.TexRect; +import com.gnarly.game.Main; +import com.gnarly.game.NumberDisplay; + +public class Map { + + public static final int + MAP_WIDTH = 32, + MAP_HEIGHT = 24, + MAP_X_OFFSET = 144, + MAP_Y_OFFSET = TILE_WIDTH + TILE_HEIGHT; + + private Window window; + private Camera camera; + + private MapEntry[][] map; + + private TexRect border; + + private Stack stack; + + private Falling falling; + + private int end; + + private double runTime = 0; + private NumberDisplay timeDisplay; + + private NumberDisplay score, deletions; + private float scoreMul; + + private TexRect timeWord, scoreWord, groupWord, stackWord, groupSizeWord; + + private int selectX; + private int selectY; + + private boolean[][] bucket; + + private FadeRect selected; + + private NumberDisplay groupSize; + + public Map(Window window, Camera camera, String path, int difficulty) { + this.window = window; + this.camera = camera; + map = new MapEntry[MAP_WIDTH][MAP_HEIGHT]; + bucket = new boolean[MAP_WIDTH][MAP_HEIGHT]; + for (int i = 0; i < MAP_WIDTH; i++) + for (int j = 0; j < MAP_HEIGHT; j++) + map[i][j] = new MapEntry(camera, MAP_X_OFFSET + i * TILE_WIDTH, MAP_Y_OFFSET + j * TILE_HEIGHT); + clearBucket(); + border = new TexRect(camera, "mapBorder.png", 0, 0, -0.1f, camera.getWidth(), camera.getHeight(), 0, true); + stack = new Stack(camera, difficulty); + falling = new Falling(window, camera, this, stack); + end = 0; + timeDisplay = new NumberDisplay(camera, 36, 33, 0, TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, 0, 8, NumberDisplay.DISPLAY_DEC); + score = new NumberDisplay(camera, 36, 93, 0, TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, 0, 8, NumberDisplay.DISPLAY_DEC); + deletions = new NumberDisplay(camera, 36, 153, 0, TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, 0, 8, NumberDisplay.DISPLAY_DEC); + groupSize = new NumberDisplay(camera, 36, 213, 0, TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, 0, 8, NumberDisplay.DISPLAY_DEC); + reset(difficulty); + + timeWord = new TexRect(camera, "time.png", 27, 8, 0, 36, TILE_HEIGHT, 0, true); + scoreWord = new TexRect(camera, "score.png", 27, 68, 0, 45, TILE_HEIGHT, 0, true); + groupWord = new TexRect(camera, "groups.png", 27, 128, 0, 54, TILE_HEIGHT, 0, true); + groupSizeWord = new TexRect(camera, "groupsize.png", 27, 188, 0, 90, TILE_HEIGHT, 0, true); + stackWord = new TexRect(camera, "stack.png", 460, 8, 0, 45, TILE_HEIGHT, 0, true); + + selectX = -1; + selectY = -1; + + selected = new FadeRect(camera, 0, 0, -0.7f, TILE_WIDTH, TILE_HEIGHT, 0, 0, 0, 0, false); + } + + public void update() { + for (int i = 0; i < MAP_WIDTH; i++) { + for (int j = 0; j < MAP_HEIGHT; j++) { + map[i][j].update(); + if(map[i][j].isActive()) + map[i][j].getRect().fadeTo(1, (float) j / (float) MAP_HEIGHT, (float) j / (float) MAP_HEIGHT, 1, 250); + else + map[i][j].getRect().fadeTo(0.045f, 0.045f, 0.045f, 1, 250); + } + } + if(window.mousePressed(GLFW_MOUSE_BUTTON_1) == Window.BUTTON_PRESSED) { + if (selectX != -1) { + Vector3f mouse = window.getMouseCoords(camera); + int mx = getTileX(mouse.x); + int my = getTileY(mouse.y); + if(mx > -1 && my > -1 && mx < MAP_WIDTH && my < MAP_HEIGHT && map[mx][my].isActive()) { + int temp = map[mx][my].getNum(); + map[mx][my].setNum(map[selectX][selectY].getNum()); + map[selectX][selectY].setNum(temp); + } + selectX = -1; + selectY = -1; + selected.fadeTo(0, 0, 0, 0, 250); + } + else { + Vector3f mouse = window.getMouseCoords(camera); + selectX = getTileX(mouse.x); + selectY = getTileY(mouse.y); + if(selectX > -1 && selectY > -1 && selectX < MAP_WIDTH && selectY < MAP_HEIGHT && map[selectX][selectY].isActive()) { + selected.setPosition(MAP_X_OFFSET + selectX * TILE_WIDTH, MAP_Y_OFFSET + selectY * TILE_HEIGHT); + selected.fadeTo(0, 0.6f, 0, 1, 250); + } + else { + selectX = -1; + selectY = -1; + } + } + } + else if(window.mousePressed(GLFW_MOUSE_BUTTON_2) == Window.BUTTON_PRESSED) { + Vector3f mouse = window.getMouseCoords(camera); + int mx = getTileX(mouse.x); + int my = getTileY(mouse.y); + bucketScore(mx, my); + } + selected.update(); + falling.update(); + + runTime += Main.dtime; + timeDisplay.setValue((int) (runTime / 1000.0)); + Vector3f mouse = window.getMouseCoords(camera); + int mx = getTileX(mouse.x); + int my = getTileY(mouse.y); + if(mx > -1 && my > -1 && mx < MAP_WIDTH && my < MAP_HEIGHT) + groupSize.setValue(bucketCount(map[mx][my].getNum(), mx, my)); + else + groupSize.setValue(0); + clearBucket(); + } + + public void render() { + selected.render(); + for (int i = 0; i < MAP_WIDTH; i++) + for (int j = 0; j < MAP_HEIGHT; j++) + map[i][j].render(); + border.render(); + stack.render(); + if (end == 0) + falling.render(); + groupSize.render(); + timeDisplay.render(); + score.render(); + deletions.render(); + timeWord.render(); + scoreWord.render(); + groupWord.render(); + groupSizeWord.render(); + stackWord.render(); + } + + private int getTileX(float x) { + return (int) ((x - MAP_X_OFFSET) / TILE_WIDTH); + } + + private int getTileY(float y) { + return (int) ((y - MAP_Y_OFFSET) / TILE_HEIGHT); + } + + public void clear() { + for (int i = 0; i < MAP_WIDTH; i++) { + for (int j = 0; j < MAP_HEIGHT; j++) { + map[i][j].setNum(0); + map[i][j].setActive(false); + map[i][j].getRect().fadeTo(0.045f, 0.045f, 0.045f, 1, 500); + } + } + } + + public MapEntry[][] getMap() { + return map; + } + + public void triggerEnd(int end) { + this.end = end; + } + + public boolean checkEnd() { + return end == 1; + } + + public void reset(int difficulty) { + stack.setDifficulty(difficulty); + falling.setDifficulty(difficulty); + falling.reset(); + clear(); + Random random = new Random(); + for (int i = MAP_HEIGHT - difficulty / 2; i < MAP_HEIGHT; ++i) { + for (int j = 0; j < MAP_WIDTH; ++j) { + map[j][i].setNum(random.nextInt(difficulty)); + map[j][i].setActive(true); + } + } + end = 0; + score.setValue(0); + deletions.setValue(0); + timeDisplay.setValue(0); + scoreMul = 1; + } + + private void bucketScore(int x, int y) { + int count = bucketCount(map[x][y].getNum(), x, y); + if(count > 7) { + score.add((int) (count * scoreMul)); + deletions.increment(); + scoreMul *= count / 6.0; + falling.increaseRate(25); + for (int i = 0; i < MAP_WIDTH; ++i) + for (int j = 0; j < MAP_HEIGHT; ++j) + if(bucket[i][j]) { + map[i][j].setActive(false); + map[i][j].setNum(0); + } + waterfall(); + for (int i = 0; i < MAP_WIDTH; ++i) + for (int j = 0; j < MAP_HEIGHT; ++j) + if(bucket[i][j]) + map[i][j].getRect().setColor(0, 1, 0); + } + else { + for (int i = 0; i < MAP_WIDTH; ++i) + for (int j = 0; j < MAP_HEIGHT; ++j) + if(bucket[i][j]) + map[i][j].getRect().setColor(0.5f, 0.045f, 0.3f, 1); + } + clearBucket(); + } + + private int bucketCount(int search, int x, int y) { + if(!map[x][y].isActive() || map[x][y].getNum() != search || bucket[x][y]) + return 0; + int num = 1; + bucket[x][y] = true; + if (x > 0) + num += bucketCount(search, x - 1, y); + if (y > 0) + num += bucketCount(search, x, y - 1); + if (x < MAP_WIDTH - 1) + num += bucketCount(search, x + 1, y); + if (y < MAP_HEIGHT - 1) + num += bucketCount(search, x, y + 1); + return num; + } + + private void clearBucket() { + for (int i = 0; i < MAP_WIDTH; ++i) + for (int j = 0; j < MAP_HEIGHT; ++j) + bucket[i][j] = false; + } + + private void waterfall() { + for(int i = 0; i < MAP_WIDTH; ++i) { + for(int j = MAP_HEIGHT - 2; j > -1; --j) { + if(map[i][j].isActive()) { + int ty = j + 1; + while (ty < Map.MAP_HEIGHT && !map[i][ty].isActive()) + ++ty; + --ty; + int temp = map[i][j].getNum(); + map[i][j].setActive(false); + map[i][j].setNum(0); + map[i][ty].setNum(temp); + map[i][ty].setActive(true); + } + } + } + } + + public void checkScore() { + File file = new File("res/high.sco"); + try { + if(file.exists()) { + Scanner scanner = new Scanner(file); + int score = scanner.nextInt(); + int high = Math.max(score, (int) this.score.getValue()); + scanner.close(); + + PrintWriter writer = new PrintWriter(file); + writer.write(Long.toString(high)); + writer.close(); + } + else { + PrintWriter writer = new PrintWriter(file); + writer.write(Long.toString(score.getValue())); + writer.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/src/com/gnarly/game/map/MapEntry.java b/src/com/gnarly/game/map/MapEntry.java new file mode 100644 index 0000000..20d710f --- /dev/null +++ b/src/com/gnarly/game/map/MapEntry.java @@ -0,0 +1,90 @@ +package com.gnarly.game.map; + +import com.gnarly.engine.display.Camera; +import com.gnarly.engine.model.FadeTexRect; +import com.gnarly.engine.model.Rect; +import com.gnarly.engine.texture.Texture; +import com.gnarly.game.Main; +import com.gnarly.game.NumberDisplay; + +public class MapEntry extends Rect { + + public static Texture[] nums; + + public static final int + TILE_WIDTH = 9, + TILE_HEIGHT = 12; + + private FadeTexRect num; + + private boolean active; + + private int digit; + + public MapEntry(Camera camera, float x, float y) { + super(camera, x, y, -0.5f, TILE_WIDTH, TILE_HEIGHT, 0, false); + if(nums == null) { + nums = new Texture[18]; + nums[0] = new Texture("zero.png"); + nums[1] = new Texture("one.png"); + nums[2] = new Texture("two.png"); + nums[3] = new Texture("three.png"); + nums[4] = new Texture("four.png"); + nums[5] = new Texture("five.png"); + nums[6] = new Texture("six.png"); + nums[7] = new Texture("seven.png"); + nums[8] = new Texture("eight.png"); + nums[9] = new Texture("nine.png"); + nums[10] = new Texture("a.png"); + nums[11] = new Texture("b.png"); + nums[12] = new Texture("c.png"); + nums[13] = new Texture("d.png"); + nums[14] = new Texture("e.png"); + nums[15] = new Texture("f.png"); + nums[16] = new Texture("r.png"); + nums[17] = new Texture("o.png"); + NumberDisplay.nums = nums; + } + num = new FadeTexRect(camera, nums[0], 0, 0, -0.5f, TILE_WIDTH, TILE_HEIGHT, 0.045f, 0.045f, 0.045f, 1, true); + this.camera = camera; + active = false; + digit = (byte) (Math.random() * 2); + } + + public void update() { + num.update(); + } + + public void render() { + num.setPosition(position); + num.setTexture(nums[digit]); + num.render(); + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public FadeTexRect getRect() { + return num; + } + + public int getNum() { + return digit; + } + + public void setNum(int digit) { + this.digit = digit; + } + + public void setNum(char digit) { + if(digit >= 'a') + this.digit = digit - 87; + else + this.digit = digit - 48; + } +} diff --git a/src/com/gnarly/game/map/Stack.java b/src/com/gnarly/game/map/Stack.java new file mode 100644 index 0000000..a4b7289 --- /dev/null +++ b/src/com/gnarly/game/map/Stack.java @@ -0,0 +1,67 @@ +package com.gnarly.game.map; + +import java.util.Random; + +import com.gnarly.engine.display.Camera; +import com.gnarly.game.NumberDisplay; + +public class Stack { + + public static final int + DIFFICULTY_EASY = 8, + DIFFICULTY_MEDIUM = 10, + DIFFICULTY_HARD = 16; + + private Camera camera; + + private long num; + + private NumberDisplay stackDisplay; + + private int difficulty; + + public Stack(Camera camera, int difficulty) { + this.camera = camera; + this.difficulty = difficulty; + num = rand(); + stackDisplay = new NumberDisplay(camera, 469, Map.MAP_Y_OFFSET + MapEntry.TILE_HEIGHT, 0, MapEntry.TILE_HEIGHT, NumberDisplay.JUSTIFICATION_LEFT, num, 8, difficulty); + } + + public void render() { + stackDisplay.render(); + } + + public long read() { + long ret = num; + num = rand(); + stackDisplay.setValue(num); + return ret; + } + + private long rand() { + Random rand = new Random(); + long random = -1; + while(random < 0) + random = rand.nextLong(); + switch (difficulty) { + case DIFFICULTY_EASY: + random %= 0xffffffL; + case DIFFICULTY_MEDIUM: + random %= 100000000L; + default: + random %= 0xffffffffL; + } + return random; + } + + public int getDifficulty() { + return difficulty; + } + + public void setDifficulty(int difficulty) { + this.difficulty = difficulty; + stackDisplay.setDisplayFormat(difficulty); + num = rand(); + stackDisplay.setValue(num); + } +}