Keep showing the mouse cursor on FadeIn and FadeOut

Started by Gal Shemesh, Thu 03/08/2023 13:02:54

Previous topic - Next topic

Gal Shemesh

Hi everyone,

Trying to solve this one out myself but kind of stuck...

I'm willing to keep the mouse cursor visible with the 'Wait()' sprite when Fade-In and Fade-Out transitions are playing. But Can't find a way to doing so - whenever a fade is playing, either by the 'player.ChangeRoom()' function or manually by using 'FadeIn()' and 'FadeOut()' functions the cursor gets hidden.

Thanks

EDIT:
Not sure if this is the right way to doing it, but I just ended up making a hidden 'gWait' GUI that I set with the Wait cursor sprite and size, and set it to follow the X and Y positions of the mouse cursor in the repeatedly_execute() function. Then I made a custom function that is called when clicking on the main menu buttons, and in it I set the 'gWait' GUI to show up, then I set a FadeOut() transition to play, and right after it before changing the room I made the 'gWait' GUI to be hidden again.
Gal Shemesh,
goldeng

Cassiebsg

Seems like you solved it yourself :)
But to answer your original question, as far as I know, you can't show the cursor during the built in fade out and fade in.

The solution is of course to code your own fade effect, like you did (GUI or Room, and set fade to instant).
There are those who believe that life here began out there...

Gal Shemesh

#2
Thanks @Cassiebsg. :) That's another thing I tried solving which remained opened. I just can't find a way to make the fake 'Wait' cursor (the GUI I made) to keep showing on-top of the fade when it plays - in other words, to exclude it from the fade transitions; the transitions affect it even if I set the default fade to Instant and use the FadeIn() / FadeOut() functions...
Gal Shemesh,
goldeng

Snarky

Am I crazy, or is this whole problem just a matter of setting the Wait cursor image to an actual cursor rather than a blank sprite?

To explain a little further: in AGS, when the game is blocked from player input, the cursor is set to the Wait cursor mode. This cursor mode can have a special cursor image, for example an hourglass or a stopwatch, but in many games it is simply set to be invisible instead. That's why the cursor disappears when the game blocks. If you instead set it to a normal cursor image, it should show up normally, but of course then there won't be any visual indication that the game is not currently responding to player input.

Quote from: Gal Shemesh on Sat 05/08/2023 10:52:04I just can't find a way to make the fake 'Wait' cursor (the GUI I made) to keep showing on-top of the fade when it plays - in other words, to exclude it from the fade transitions; the transitions affect it even if I set the default fade to Instant and use the FadeIn() / FadeOut() functions...

If your pseudocursor is on a GUI and your custom fade relies on a fullscreen black GUI, then it's just a matter of setting up the GUI z-order to decide whether the "cursor" is in front of or behind the black screen.

Khris

I checked this in the Tumbleweed template; the wait cursor is the crosshairs but it disappears during the fade. So I don't think it's just a matter of a missing Wait cursor sprite.

Snarky

Quote from: Khris on Sat 05/08/2023 14:22:01I checked this in the Tumbleweed template; the wait cursor is the crosshairs but it disappears during the fade. So I don't think it's just a matter of a missing Wait cursor sprite.

Yeah, the in-engine fade might have some special voodoo, but in that case I wouldn't expect that doing anything in repeatedly_execute_always() would work either. But the custom fade method should certainly work if the Wait cursor sprite is set.

Nahuel

It would be possible then to create a function for fade in and out adding custom behaviour for something like player.ChangeToRoom(int room_id, int x, int y, ...) with optional x and y. And add a GUI and can be use in conjunction with Tween Module to fade out and fade in but adding on game_start SetScreenTransition(eTransitionInstant)


SetScreenTransition
Life isn't a game. Let's develop a life-like-game.

Gal Shemesh

Quote from: Snarky on Sat 05/08/2023 14:46:44If your pseudocursor is on a GUI and your custom fade relies on a fullscreen black GUI, then it's just a matter of setting up the GUI z-order to decide whether the "cursor" is in front of or behind the black screen.
Thanks for the suggestion. However, not matter what high number I put in the ZOrder, the cursor remains below the transition...
Gal Shemesh,
goldeng

Crimson Wizard

Quote from: Gal Shemesh on Sat 05/08/2023 15:24:57Thanks for the suggestion. However, not matter what high number I put in the ZOrder, the cursor remains below the transition...

Are you using FadeOut/FadeIn functions for translation, or a GUI?

Gal Shemesh

Quote from: Crimson Wizard on Sat 05/08/2023 15:50:33Are you using FadeOut/FadeIn functions for translation, or a GUI?
Just the built-in transitions, either the default behavior of FadeInAndOut or manually calling for them with the FadeIn() and FadeOut() functions.
Gal Shemesh,
goldeng

Crimson Wizard

#10
Quote from: Gal Shemesh on Sat 05/08/2023 16:10:07
Quote from: Crimson Wizard on Sat 05/08/2023 15:50:33Are you using FadeOut/FadeIn functions for translation, or a GUI?
Just the built-in transitions, either the default behavior of FadeInAndOut or manually calling for them with the FadeIn() and FadeOut() functions.

The mentioned method of adding zorder is for when you are using GUI as a fadeout.

This thread mentioned several separate methods:
- built-in fadeout run during transition;
- calling FadeIn/Out yourself in script.
- using GUI to fade the screen.

First of all, I believe the mouse cursor will only stay above the fade effect if you are using GUI. It never is drawn above a built-in fade effect, regardless of how it's run (by a script command, or automatically during transition).

Secondly, if you're using gui as a replacement for the mouse cursor, then you also need to adjust it's zorder to be higher than the "fade" gui.

EDIT:
in regards to the Wait cursor:
The Wait cursor is NOT shown during fade, regardless of how Fade is run.
Testing FadeIn/Out commands, I can see that the cursor disappears completely during FadeIn, but not manual FadeOut (idk why).

Gal Shemesh

#11
Appearantly I mixed between the methods. Thanks @Crimson Wizard for the clarification. :)
Gal Shemesh,
goldeng

Cassiebsg

Forget about the built in fade in and fade out. Write your own, using a GUI, it's easy and it'll solve all your problems. That means you set in the setting the effect to instant, and instead you just turn on the GUI, fade (change transparency from 0% to 100%) the GUI to black, change room instantly, and then fade to normal to the new room. This will keep your cursor behaving normally.

And then instead of using FadeIn() and FadeOut(), you just use MyFadeIn() and MyFadeOut(). (and you can just use a find & replace in script. ;)

And of course, you need to set the wait cursor to the same sprite you normally use (or a special one you might want).
There are those who believe that life here began out there...

Gal Shemesh

Quote from: Cassiebsg on Sat 05/08/2023 19:22:45Forget about the built in fade in and fade out. Write your own, using a GUI, it's easy and it'll solve all your problems. That means you set in the setting the effect to instant, and instead you just turn on the GUI, fade (change transparency from 0% to 100%) the GUI to black, change room instantly, and then fade to normal to the new room. This will keep your cursor behaving normally.

And then instead of using FadeIn() and FadeOut(), you just use MyFadeIn() and MyFadeOut(). (and you can just use a find & replace in script. ;)

And of course, you need to set the wait cursor to the same sprite you normally use (or a special one you might want).
Yep, that would probably be the best way to doing it. Though, the pure black is considered as transparent... Any way to make my GUI color a solid black instead of using a background image?
Gal Shemesh,
goldeng

Crimson Wizard

Quote from: Gal Shemesh on Sat 05/08/2023 19:35:06Yep, that would probably be the best way to doing it. Though, the pure black is considered as transparent... Any way to make my GUI color a solid black instead of using a background image?

Apprently not, because it's AGS.

The closest you may with the BackgroundColor is RGB 0;4;0.

Gal Shemesh

Hah hah, "Because it's AGS" :-D I like this comment.

Thanks @Crimson Wizard. Then I'll just use a pure black graphic that covers the whole screen. It's nice that this method of 'fade' using a GUI keeps showing the mouse cursor with the Wait cursor like @Cassiebsg has mentioned, so I disregarded the fake 'Wait' cursor GUI I made altogether. :)
Gal Shemesh,
goldeng

Laura Hunt

I always use BackgroundColourNumber 32 (or like CW said, 0,4,0) as the background colour of any black GUIs I might need for fades and other stuff. Maybe it's not technically pure black, but I've never been able to tell the difference.

Snarky

What happens if you set it to 65536?

(Personally I usually just import a fullscreen black sprite.)

Gal Shemesh

#18
Quote from: Snarky on Sat 05/08/2023 20:33:50What happens if you set it to 65536?

(Personally I usually just import a fullscreen black sprite.)
Me too. But just tried 65536, took a screenshot of it and went to check the color with the eye-dropper tool in Photoshop and what do you know - PURE BLACK! RGB values are 0,0,0. :-D Thanks!

When I set it to 65536 then in AGS, the RGB are shown as 0,0,0 and the Hue, Sat and Lum values are 160,0,0. But if I set the RGB and the Hue, Sat and Lum values manually then the transparent index takes over. So I guess using the actual color number is the better way of setting up colors in AGS. I wonder what's the equivalent for pure white of 255,255,255 then, as in AGS white gets 248,252,248.
Gal Shemesh,
goldeng

Snarky

You could try using the TruBlu module's GetColorFromTrueColorRGB(255,55,255);

I'm not sure it will work. The AGS color system is an insane mess, and that it's possible to use above-16-bit color values at all is unintentional behavior, so no guarantees. (I actually thought the 248,252,248 problem had been fixed a long time ago, though.)

If that doesn't work, you can use color 15, which is at least neutral.

SMF spam blocked by CleanTalk