Omnimaga

Calculator Community => HP Calculators => Topic started by: DJ Omnimaga on December 12, 2013, 03:28:46 am

Title: HP PPL Fade in/out effects (SNES style)
Post by: DJ Omnimaga on December 12, 2013, 03:28:46 am
Here are some fade in/out effects for the HP Prime:

(http://img.ourl.ca//ssballfadein.gif)

Here is the code I used to fade the screen to black with a pixelating effect like in SNES transitions:

Code: [Select]
DIMGROB_P(G3,320,240);
DIMGROB_P(G4,320,240);
BLIT_P(G4,G0);
FOR A FROM 2 TO 16 DO
BLIT_P(G3,0,0,320/A,240/A,G4,0,0,320,240);
FILLPOLY_P(G3,{{0,0},{320,0},{320,240},{0,240}}, #000000, 16*A);
BLIT_P(G0,0,0,320,240,G3,0,0,320/A,240/A);
END;

And the code I used to fade from black (after drawing something in GROB #4):

Code: [Select]
FOR A FROM 16 DOWNTO 2 DO
BLIT_P(G3,0,0,320/A,240/A,G4,0,0,320,240);
FILLPOLY_P(G3,{{0,0},{320,0},{320,240},{0,240}}, #000000, (16*A)-16);
BLIT_P(G0,0,0,320,240,G3,0,0,320/A,240/A);
END;

To fade to/from black (or any other color), you have to use the new FILLPOLY_P command, which supports alpha transparency. To fade out, you can also do the following:

Code: [Select]
FOR Z FROM 1 TO 29 DO
FILLPOLY_P({{0,0},{320,0},{320,240},{0,240}}, #000000, 9);
WAIT(1);
END;

Which is smaller, but won't let you fade in.


Before this new firmware came out, to fade out, you had to use the BITSR command then use the following code by Gilles59 (http://ourl.ca/19467/359108). It took 4 seconds to render each frame. With the polygon command, it's as fast as the screenshot demonstrates!

Given what I did with the Super Sonic Ball HP logo in the screenshot above, I bet that wavy transitions could be used as well if you want to, not to mention the good ol' TI-89 ASM games transitions when launching them.
Title: Re: HP PPL Fade in/out effects
Post by: Eiyeron on December 12, 2013, 04:07:17 am
Nice, now can the sprites be rotated? You could easily impelment the Street GIfhter 2 SNES intro like this!
Title: Re: HP PPL Fade in/out effects
Post by: Sorunome on December 12, 2013, 10:11:30 am
That's looking nice!
Title: Re: HP PPL Fade in/out effects
Post by: timwessman on December 12, 2013, 11:59:04 am
One other thing, you might want to take a look at the program I've attached.

Note, the "ICON" keyword will most likely be changing, as will the encoded data. One thing I am thinking about is to create a "resource" area that would contain binary data, not show up in the editor on calc (a list of names only, and ability to change the names), and could be called by name within a program. The intent would be that large objects (graphics, strings, etc) that don't really ever get edited would be storeable alongside the program file for use.

Anyway, you can now load PNG data directly as of the last update. And the little helper program is attached. Note that neither this one nor the first was made by me, but rather by cyrille (one of my coworkers). It is not endorsed or supported in any way by HP, but is given out as a help for interested parties.

The program I've stuck up here for download randomly plasters that png data across the screen as shown below.

(http://s10.postimg.org/3lekz5c2x/image.png)

Title: Re: HP PPL Fade in/out effects
Post by: Streetwalrus on December 12, 2013, 01:35:02 pm
This is just crazy epic. O.O
Title: Re: Re: HP PPL Fade in/out effects
Post by: DJ Omnimaga on December 12, 2013, 05:39:54 pm
Wow, PNG support seems nice! Is it smaller and faster than the standard format?
Title: Re: HP PPL Fade in/out effects
Post by: timwessman on December 12, 2013, 06:48:10 pm
Yes, it will be smaller. Might be faster too. There is only a single copy of the PNG referenced.

I have no clue what it does with transparency though now that I think about it...
Title: Re: Re: HP PPL Fade in/out effects
Post by: DJ Omnimaga on December 12, 2013, 07:12:03 pm
Are 8 bit PNGs supported?
Title: Re: HP PPL Fade in/out effects
Post by: MacBernick on December 12, 2013, 08:23:08 pm
I did some tests, looks like 8 bits is supported, but transparency is lost somewhere, either in DIMGROBHelper or in blit operation.
Title: Re: Re: HP PPL Fade in/out effects
Post by: DJ Omnimaga on December 12, 2013, 09:16:36 pm
Ok but in such case, would we still be able to specify atransparent color at the end of the BLIT_P command?
Title: Re: HP PPL Fade in/out effects
Post by: MacBernick on December 12, 2013, 09:30:05 pm
Yes that's still working.

I'll try tomorrow maybe to import a PNG without DIMGROBHelper to check if it solves transparency issues.
Title: Re: HP PPL Fade in/out effects
Post by: DJ Omnimaga on December 12, 2013, 10:44:02 pm
Ok that's good.

One of my main concern is that I tend to not like to split my HP Prime games into too many files, because it makes it harder for the connectivity kit to detect my entire calc content in a reasonable amount of time. I usually prefer to keep my games into one single file or two unless it's impossible for any reason. However, if this can greatly reduce the size of one of my program (for example, my pseudo 3D tilemap demo is over 400 KB large) I might not mind.
Title: Re: HP PPL Fade in/out effects
Post by: Juju on December 13, 2013, 11:51:17 am
That's pretty cool ^_^
Title: Re: HP PPL Fade in/out effects
Post by: SpiroH on December 13, 2013, 04:40:46 pm
I like it, it looks cool to me! I would give a bit more emphasis to the fading process by slowing down the unrolling and rolling up.
Spoiler For Spoiler:
mockup (with your permission):
(http://imageshack.us/a/img577/6738/woc3.gif)
Title: Re: HP PPL Fade in/out effects
Post by: DJ Omnimaga on December 13, 2013, 05:08:14 pm
Yeah I plan to use such slower fading effect in the future, but probably not for transition between regular screens. Else, people will get annoyed due to the longer wait. I was mainly thinking about RPG cutscene or intro endings where it transitions into a different cutscene located elsewhere or a different chapter in the game. It would also work for when you load a saved game. I think it was pretty common in old SNES RPGs like Final Fantasy. For transitions between two linked maps, however, usually only the fade out effect without the pixelating occurs, else when pixelating is used, there's no fade-out and instead they use a black frame that shrinks down towards the middle of the screen.

What I also saw used as special effects in SNES RPGs is when your main character is feeling dizzy, the screen suddenly gets pixelated twice in a row, to make it look like you are fainting and have vision troubles. Then there's of course the battle transitions.
Title: Re: HP PPL Fade in/out effects (SNES style)
Post by: Keoni29 on December 14, 2013, 03:06:48 am
This even blows most ndless stuff for nspire out of the water. Prime basic is awesome.
Title: Re: HP PPL Fade in/out effects (SNES style)
Post by: DJ Omnimaga on December 14, 2013, 07:18:51 pm
Indeed. I think the only things that can't be done are complex stuff like program launchers (shells), Doom or some emulators.
Title: Re: HP PPL Fade in/out effects (SNES style)
Post by: fb39ca4 on December 14, 2013, 10:30:43 pm
This even blows most ndless stuff for nspire out of the water. Prime basic is awesome.
Properly written graphics routines in C would still work quite well. The Prime does have the advantage of a faster CPU.
Title: Re: HP PPL Fade in/out effects (SNES style)
Post by: DJ Omnimaga on December 16, 2013, 12:09:47 am
On a side note, since the ICON command isn't available in the program menus (although it can be found in the help if you search hard enough), here is some info about it: http://h30499.www3.hp.com/t5/Calculators/HP-Prime-Help-Entry-ICON-Setting-App-Icons/td-p/6298613#.Uq6K90Bgh8E

From what I gather, it is impossible to only display parts of an icon at once nor scale them up/down, right?