Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Loading of pictures and (un)covering them

Loading of pictures and (un)covering them

Scheduled Pinned Locked Moved C#
comgame-devperformancetutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nstk
    wrote on last edited by
    #1

    I am planning a memory game (as an exercise for myself) and thought of loading pictures, probably gifs or pngs into PictureBox controls like Microsoft does in this tutorial. http://msdn.microsoft.com/en-us/library/dd492173.aspx I would like to have the opinion of more experienced members in this forum, and mostly an answer to the following. During the game, two pieces will be revealed to the player for X seconds and then, in case he/she fails, they will have to be covered again. What does this mean in programming terms? I think that loading a picture and then loading a blank one would be a solution but probably a bad one, provoking unnecessary traffic. I have no better idea for the time being :( What do you think? Thanks in advance. PS: In those tutorials the last one is a Memory game, but with fonts. http://msdn.microsoft.com/en-us/library/dd553233.aspx What I am trying to do is to combine the techniques of those two tuts.

    G 1 Reply Last reply
    0
    • N nstk

      I am planning a memory game (as an exercise for myself) and thought of loading pictures, probably gifs or pngs into PictureBox controls like Microsoft does in this tutorial. http://msdn.microsoft.com/en-us/library/dd492173.aspx I would like to have the opinion of more experienced members in this forum, and mostly an answer to the following. During the game, two pieces will be revealed to the player for X seconds and then, in case he/she fails, they will have to be covered again. What does this mean in programming terms? I think that loading a picture and then loading a blank one would be a solution but probably a bad one, provoking unnecessary traffic. I have no better idea for the time being :( What do you think? Thanks in advance. PS: In those tutorials the last one is a Memory game, but with fonts. http://msdn.microsoft.com/en-us/library/dd553233.aspx What I am trying to do is to combine the techniques of those two tuts.

      G Offline
      G Offline
      GlobX
      wrote on last edited by
      #2

      Sounds like a good enough solution to me. You could either set the visibility of the picture box control to show/hide it, or replace the image with a "blank" one you already have - it all depends on the aesthetic you're going for. I would suggest pre-loading all the images (including the blank one) at startup and keeping them in memory (remembering to free them on close, GC may handle this for you, can't quite remember with images...). If you have a reasonable number of images, then this should be fine. Remember you'll only need one in-memory copy of the blank one although it may be used for all tiles. Another solution would be simply to draw something over the top of the images in order to hide them, for example a black rectangle or another image. This may be another solution worth looking into. Seems like you're on the right track though. Good luck!


      Typical n-tiered architecture: DB <-> Junk(0) <-> ... <-> Junk(n-1) <-> Pretty

      modified on Wednesday, July 27, 2011 6:55 AM

      N 1 Reply Last reply
      0
      • G GlobX

        Sounds like a good enough solution to me. You could either set the visibility of the picture box control to show/hide it, or replace the image with a "blank" one you already have - it all depends on the aesthetic you're going for. I would suggest pre-loading all the images (including the blank one) at startup and keeping them in memory (remembering to free them on close, GC may handle this for you, can't quite remember with images...). If you have a reasonable number of images, then this should be fine. Remember you'll only need one in-memory copy of the blank one although it may be used for all tiles. Another solution would be simply to draw something over the top of the images in order to hide them, for example a black rectangle or another image. This may be another solution worth looking into. Seems like you're on the right track though. Good luck!


        Typical n-tiered architecture: DB <-> Junk(0) <-> ... <-> Junk(n-1) <-> Pretty

        modified on Wednesday, July 27, 2011 6:55 AM

        N Offline
        N Offline
        nstk
        wrote on last edited by
        #3

        Thanks for your reply. I'm not quite sure, that I know how to do the following.

        GlobX wrote:

        pre-loading all the images (including the blank one) at startup and keeping them in memory

        GlobX wrote:

        you'll only need one in-memory copy

        Could you give me any hint please, on what you refer to, please? Thank you.

        G 1 Reply Last reply
        0
        • N nstk

          Thanks for your reply. I'm not quite sure, that I know how to do the following.

          GlobX wrote:

          pre-loading all the images (including the blank one) at startup and keeping them in memory

          GlobX wrote:

          you'll only need one in-memory copy

          Could you give me any hint please, on what you refer to, please? Thank you.

          G Offline
          G Offline
          GuyThiebaut
          wrote on last edited by
          #4

          nstk wrote:

          I'm not quite sure, that I know how to do the following.

          GlobX wrote:

          pre-loading all the images (including the blank one) at startup and keeping them in memory

          I would suggest creating a class that contains a List of bitmaps. St the bitmpas to your images on startup. You can then point the pictureboxes on the form to the appropriate bitmap when needed. This way the images are kept in memory within the List.

          Continuous effort - not strength or intelligence - is the key to unlocking our potential.(Winston Churchill)
          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups