Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  libgdx - why extend Game instead of implement ApplicationListener?  (Read 4696 times)
0 Members and 1 Guest are viewing this topic.
Offline heisenbergman

JGO Coder

Medals: 14

L___ o_ G___ a__ P___

« Posted 2013-05-05 12:06:13 »

Was reading this article: Using Screen and Game Classes and I was wondering why a lot of tutorials I come across use "extends Game" instead of "implements ApplicationListener"?

Currently, my main class for the game I'm trying to make implements ApplicationListener.

I was hoping to understand "extends Game" more so that I could decide which is better.


Offline davedes
« Reply #1 - Posted 2013-05-05 12:37:31 »

If you want multiple states (i.e. menu, gameplay, options, etc) then you can utilize LibGDX's "Game" and "Screen" helper classes. They are very minimal, and it's easy enough to write your own state management if you'd rather do something specific (i.e. fancy transitions between states). Game is just an extension of ApplicationListener.

Look at how simple the Game and Screen classes are to get an idea of what they do.

Offline JavaGameXYZ

Junior Newbie

Medals: 1

« Reply #2 - Posted 2013-05-06 16:56:35 »

I struggled with this question too.  I ultimately worked through Andrew Steigert's blog series on building a Tyrion clone and it helped me a lot.

Like davedes says, it's mainly so you can support multiple screens, where each screen contains its own code (e.g. render(float delta))

Open source + tutorial SRPG using libgdx and artemis
Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (863 views)
2018-03-24 14:47:39

ivj94 (125 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!