gca

GUI - Html or Canvas

Recommended Posts

Hi guys,

I'm very new into the game dev scene (1 week new). My idea is to develop games using Phaser and then compile it, using phonegap, for mobile devices.

In this scenario - as I see some no-nos in others. Is it bad practice to use html + jquery and gsap to create the gui of the game, instead of the canvas?

 

I bring a lot of experience of dom manipulation into this new venture and I didn't like the way of positioning things around the canvas. Pixels, ew. I was on my way, building a javascript grid based on the phaser api, to mitigate the previous ew-remark, when I remembered good old html. But... standards, and you got to love standards. What's your view on this subject?

Share this post


Link to post
Share on other sites

It depends how much gui you have. A few buttons are easier wth phaser alone. If you plan dropdown menus and off-canvas navigation than css3 is your friend.  Here is example that has gui in html&css3 and phaser for animation render. (Spoiler that is mine): http://demo.irokus.si/irokusplus/kem8uc/kem8_ani_02/

There are no problems with mixing dom and canvas... Just structure you code appropriately. Phaser and jquery have very different ideas about code organization. 

Share this post


Link to post
Share on other sites

As @mattstyles said, zero problems and personal preference. A canvas UI is obviously a lot more work and always something you can include later if you decide, I would use the time to focus on the game engine first, while using a HTML UI during development.

Share this post


Link to post
Share on other sites

I like to mix and match, but I find that some types of css transitions are unacceptably slow on mobile browsers, so for some things canvas is really the only viable option.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.