Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Thumbnail saves  (Read 5794 times)

0 Members and 1 Guest are viewing this topic.

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Thumbnail saves
« on: December 12, 2005, 08:51:26 AM »

Morning everyone,

I want to have thumbnail saves/loads pretty much just like they are in Project Joe, where you click the thumbnail to load the game, and the save description goes underneath, but I'm having trouble understanding how to implement that exactly.

Also, how could I load the game just by clicking on the thumbnail instead of having the "Are you sure you want to load the game?" window come up?

Thanks in advance.  8)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Thumbnail saves
« Reply #1 on: December 12, 2005, 10:45:32 AM »

The save thumbnails work exactly like any other image, which means you can assign them to buttons etc. Only instead of image paths, such as "path\some_image.png" you reference them like "savegame:0", "savegame:1" etc.

So, all you need to do is to create a window with a bunch of buttons, and assign these thumbnail images to the buttons. That's how the Project Joe save/load windows work.
You will need to scan the saved games slots to check which ones are used, so that you know which buttons to use and which ones you need to leave empty. The code will be very similar to what the default save/load windows do when they populate the buttons with saved games names.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Thumbnail saves
« Reply #2 on: December 13, 2005, 07:54:25 AM »

Hi again,

I'm lost already - how do I assign the images to the buttons? Currently the button is like TEMPLATE = "whatever button file" - do I put the "savegame:0" in place of that?

How do I then make the thumbnail border change when you rollover the image in the load menu?

And I don't know about "scanning the slots"...???...it's hard to fully understand this stuff if you've never programmed before in your life.  8)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Thumbnail saves
« Reply #3 on: December 14, 2005, 07:04:30 PM »

I'm lost already - how do I assign the images to the buttons? Currently the button is like TEMPLATE = "whatever button file" - do I put the "savegame:0" in place of that?
No, you put it where you'd normally use an image file, i.e.

BUTTON
{
  NAME = "Blah"
  ...some properties
  IMAGE = ""savegame:0
  ...more properties
}

Or in the script you'd call SomeButton.SetImage("savegame:0");


How do I then make the thumbnail border change when you rollover the image in the load menu?
Well, in Project Joe is cheating a little in this. Since the button can only have one image assigned, PJ places a static control over the button. The button itself displays the thumbnail image, while the static control only contains the transparent frame. There is a script attached to each of the buttons which handles the "MouseEntry" and "MouseLeave" events and displays either the selected or deselected frame.


And I don't know about "scanning the slots"...???...it's hard to fully understand this stuff if you've never programmed before in your life.  8)
By "scanning" I mean checking if the slot is in use or not. You can check the "data\interface\system\load.script" file in the WME demo for an example. There is a SetState() function which traverses through the save slots, and it paints the saved games names for slots in use.

I know it may sound confusing to a beginner and I'm not sure if the interface is a good place to start, because it can get rather complex if you want to make non-standard interfaces. But then again, you only create the interface once. The routine tasks are much simpler. Hopefully it won't discourage you :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Thumbnail saves
« Reply #4 on: December 14, 2005, 07:56:08 PM »

It won't discourage me - it's great when you make something work properly.  :)  I'm finding most of the things quite simple, but sometimes it seems like you really need to know some programming basics, but I'm learning anyway.

Also, what's the difference between the BACK and the IMAGE parts of the button definition? Is it not possible to make the border the BACK and the thumbnail the IMAGE?

Thanks.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Thumbnail saves
« Reply #5 on: December 14, 2005, 09:26:54 PM »

Also, what's the difference between the BACK and the IMAGE parts of the button definition? Is it not possible to make the border the BACK and the thumbnail the IMAGE?
The BACK option is used for so-called tiled images (resizable window backgrounds, more info in the docs) and yes, you're right it should work that way. I didn't think of that :)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Thumbnail saves
« Reply #6 on: December 18, 2005, 04:21:27 PM »

Hi again,

I have another problem now relating to my thumbnail saves.

When a player presses ESC in a scene, I have the Game fade out, load the mainmenu window, then fade the game back in. Then, behind the scenes, I fade the Scene out really quickly. When the player closes the mainmenu either by pressing ESC again or clicking RESUME GAME, I fade the window itself out - and then the Scene fades back in, so everything is fading in and out nicely.

Problem is when you click OK after entering the save name, that closes the window I think, but doesn't come out of systemexclusive mode, so the scene is still faded out. That's when it takes the screenshot I think, so it just takes a shot of a blank black screen, which means my thumbnails are useless anyway.

Any ideas as to how I can get around this problem, but still maintain all the fades?

Thanks.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Thumbnail saves
« Reply #7 on: December 19, 2005, 01:31:02 PM »

Yes, that's a problem. The thumbnail image is taken immediately before saving the game and there's not much you can do about it.
I was thinking about adding some method for pre-caching the thumbnail, so that the developer can the the exact moment when to take the screenshot. In your case you'd call the method before fading the screen...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

McCoy

  • The cocido eater
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 365
  • Spurrrrrrring
    • View Profile
    • Spur Games
Re: Thumbnail saves
« Reply #8 on: December 19, 2005, 04:54:51 PM »

Meanwhile, maybe the plug-in support would prove useful, just making a small plug-in which captures the screen when you call it, and creates a BMP file (for example) of XY size in the hard disk, then you can load it from that location when you want as thumbnail. The problem with that is that the savegames thumbnails would be in a format in which the user could see and edit inside windows, instead of encrypted/compressed as WME's built-in ones.
Logged

Click here to sign my sig!

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5674
    • View Profile
    • Dead:Code Site
Re: Thumbnail saves
« Reply #9 on: December 19, 2005, 09:28:26 PM »

Right, you don't even need a plugin for this, you could use the Game.ScreenshotEx() method.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Thumbnail saves
« Reply #10 on: December 19, 2005, 10:22:05 PM »

Where would I start using that method?

I could insert the screenshotex code after you hit ESC, but how do you then use those bitmaps for the thumbnails?
Logged

McCoy

  • The cocido eater
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 365
  • Spurrrrrrring
    • View Profile
    • Spur Games
Re: Thumbnail saves
« Reply #11 on: December 20, 2005, 01:16:47 AM »

Right, you don't even need a plugin for this, you could use the Game.ScreenshotEx() method.

Another new method? Man I'm getting old... :P
Logged

Click here to sign my sig!

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Thumbnail saves
« Reply #12 on: December 20, 2005, 08:43:58 AM »

Meanwhile, maybe the plug-in support would prove useful, just making a small plug-in which captures the screen when you call it, and creates a BMP file (for example) of XY size in the hard disk, then you can load it from that location when you want as thumbnail. The problem with that is that the savegames thumbnails would be in a format in which the user could see and edit inside windows, instead of encrypted/compressed as WME's built-in ones.

This is IMO almost impossible because you don't have access for the surface of the global render (only to partials).

Mnemonic, are you using backbuffer? Because then maybe it would have been possible to hijack direct3d object and lock the backbuffer surface, which then could be read and written as a file. But I don't know about performance of such dirty tricks. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

McCoy

  • The cocido eater
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 365
  • Spurrrrrrring
    • View Profile
    • Spur Games
Re: Thumbnail saves
« Reply #13 on: December 20, 2005, 08:07:09 PM »

Is really prnt-scrn so difficult to mimic? Windows does it on its own :P. Anyway there's no need now that Mnemonic mentioned the Game.ScreenshotEx() method, doesn't it?
Logged

Click here to sign my sig!
 

Page created in 0.231 seconds with 17 queries.