Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: invalid image for thumbnail  (Read 4062 times)

0 Members and 1 Guest are viewing this topic.

binary1

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 51
    • View Profile
invalid image for thumbnail
« on: June 17, 2015, 11:09:19 PM »

When I save or load a game, I only see a label "invalid image" for the thumbnail.  I've gone through the 3d demo looking at all the scripts for loading, saving games but can't find anything different from what I have.  I see where the thumbnail object is getting the image but I don't see when the screenshot is being made in the script.  There is a flash on the screen when the save button is pressed so I'm guessing that is when the screenshot is made but what method is being called and where?  I don't see anything in the game script either.

This is in the saveslot.script: Thumbnail.SetImage("savegame:" + this.Name);
Printing this.Name to the screen just shows the number of the slot so where is the image coming from?  Or, in my case not coming from?

I found Screenshot, ScreenshotEx, and StoreSaveThumbnail functions under the game object but I don't see where any of these are being called in the script for the demo.  I've searched the forum but haven't come up with a solution.  Do I need to call one of these functions or a different one?  How does the demo create the screenshot?

Thanks.
Logged

binary1

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 51
    • View Profile
Re: invalid image for thumbnail
« Reply #1 on: June 18, 2015, 10:30:17 PM »

I compared my project with the demo 3D project and found settings that needed to be changed.  I set the thumbnail width and height to the settings given in the 3D demo.  I looked at Game.SaveThumbnail() and put it in my code.  However, that only returns true or false so I don't see how I can access the thumbnail.  It apparently is used by Game.SaveGame() but mine is identical to the one in the 3D demo.

Any other suggestions?  Or can anyone give me insight into how and where thumbnails are saved?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: invalid image for thumbnail
« Reply #2 on: June 19, 2015, 09:34:55 AM »

If the saved game thumbnails are enabled in project settings, the screenshot is taken automatically when you call Game.SaveGame() and it's stored in the saved game file. Only if you want to take the screenshot explicitly at other time, you'd call Game.StoreSaveThumbnail(), but that's optional.

The thumbnail image works just like any other image (sprite) in WME, only instead of using the image path (such as "path\whatever\image.png") you use a filename such as "savedgame:0". WME will detect this special image path, and instead of using a physical image file, it will extract the thumbnail from a given saved game slot (slot zero in this case).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

binary1

  • Supporter
  • Occasional poster
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 51
    • View Profile
Re: invalid image for thumbnail
« Reply #3 on: June 19, 2015, 09:58:35 PM »

Thanks!  That looked pretty much like what was in the 3D demo code.  When I looked back at mine, I realized that I had made some changes before setting the thumbnail height and width.  As a result, things still weren't working when I enabled thumbnails.  I put things back to the original code and everything works great now.  Your explanation was just what I needed.

If anyone else is having the same problem (before making changes in the code), look at the Project Manager under Saved Games.  If thumbnail width and height are set to zero, no thumbnail will be generated.  The 3D demo set the width and height to 270, 200, which is also working well for me.
Logged
 

Page created in 0.015 seconds with 19 queries.