SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    284
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Canvas, Table or List (in a commercial app)?

    (Another in the series of teaching myself HTML5 and Javascript.)

    I'm using a solitare game as my teaching tool. In the simplistic game I have in mind, I will need to place card images on the screen then detect which "card" the player clicks upon.

    These appear to be my options
    • place the images on an HTML5 canvas (with an 'onclick' function), then capture the coordinates when the player "clicks" an image
    • Create a standard table with each cell having an image and unique identifier (with an onclick event)
    • create a list (ul or ol) in conjunction with CSS with each <li> sporting an id (also with an onclick event)
    • some other option I haven't listed (that you would kindly point out to me)


    Because this is a self-teaching exercise, I will probably go with the canvas option. But I am interested as to what would be the normal approach in a commercial environment.

    Regards,

    grNadpa

  2. #2
    SitePoint Mentor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,256
    Mentioned
    32 Post(s)
    Tagged
    4 Thread(s)
    Hi grNadpa,

    After your last thread about drawing cards on the canvas, I thought I'd have a go at building a version of solitaire myself. While trying to figure out how to implement drag and drop for moving the cards around I came across EaselJS, which is a library for working with canvas elements. I think you might find it useful.

  3. #3
    SitePoint Addict
    Join Date
    Oct 2005
    Posts
    284
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fretburner View Post
    Hi grNadpa,

    I came across EaselJS, which is a library for working with canvas elements. I think you might find it useful.
    Thank you again for sticking with me Fretburner. I take two things from your reply:
    • The canvas option is the appropriate option of the three I've listed and
    • The EaselJS should provide code examples a javascript nearly-illiterate can muddle through.

    Again, you've been a great and patient help. Thank you.

    grNadpa


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •