PDA

View Full Version : Office Inspirations


LarryCos
07-26-2007, 10:02 PM
All,

Office Inspirations is a free program I developed a long time ago using Embedded Visual Basic. It is something like a screensaver but with a twist.

This program isn't going to change the world but I incorporated a lot of different techniques into this application and learned a great deal about PPL basics.

Using what I've learned with Office Inspirations, I will be converting another one of my programs and writing some other new gaming ideas using PPL. Not only is it a lot of fun to learn but it keeps getting easier to use each time I sit down to work with it. To top if off, the improvements just keep on coming and the support is excellent.

If you have any questions or problems with this application, please let me know.

Thanks and enjoy.

LarryCos [br]1185483716_259_FT0_office_inspirations_ppc.zip[br]1185483716_259_FT0_office_inspirations_wm2003.zip

kornalius
07-26-2007, 11:40 PM
Thank you for the contribution, I will give it a try very soon.

Thank you for the kind words.

We hope to improve PPL even more, with version 1.30 it is going to be a very nice step forward.

PointOfLight
08-09-2007, 05:25 AM
This was pretty neat.* I'll admit that the little dancing dudes were a bit freaky, but a nifty program none the less.* If you plan on playing around with this any more, I'd offer a suggestion on the slogans:

Put all the slogans in a text file, one per line.* Read the text file in, and store the slogans in a list.* Randomly pick an index from 0 to NumListElements - 1, and render the text for that slogan to a blank sprite.* That way you don't need to have all the graphics, and it makes it much easier to add new slogans.

LarryCos
08-09-2007, 01:03 PM
Eric,

Thank you for your comments and for your excellent suggestion.

My first objective was just to move the program from eVB to PPL and then secondly to jazz it up a bit. I guess V2.1 won't be far away thanks to you.

Suggestions like yours helps us all grow and learn from someone who knows what can be done with PPL. I really appreciate it.

I hope you had a chance to blow up the little dudes. Did the HELP file work for you?

Thanks again,

LarryCos

LarryCos
08-09-2007, 03:59 PM
Eric,

Reading the text file containing the slogans and placing them into a list is easy enough but I am curious as to which methods you would recommend to render the text to a blank sprite.

I've looked at a couple of different items I've found in the forums but nothing really firm. There was some discussion about SPRITE g_cachetext and G_SetRenderTarget scattered about. Is there something I missed with better documentation or examples that would make this process a bit clearer?

Thanks,

PointOfLight
08-09-2007, 10:17 PM
//Create a surface
MsgSurface$ = NewSurface(240, 320);
//Create a sprite
MsgSprite$ = NewSprite(null);
SetSpriteSurface(MsgSprite$, MsgSurface$, 1, 0);

//When you want to display a new saying
cursurf$ = SetRenderTarget(MsgSurface$);
//Draw text to surface... ask if you need help with this
//Restore original drawing surface
SetRenderTarget(cursurf$);

PointOfLight
08-09-2007, 10:24 PM
I didn't know you could blow up the characters.* Cool!* By the way, I really like how the text comes up from behind the background.* A simple yet nice looking effect.

LarryCos
08-10-2007, 12:42 AM
Eric,

"I didn't know you could blow up the characters."

Typical user doesn't read the Help/Documentation to find out how everything works. Ha, ha. Just kidding.

If you could provide me a bit or information or point me to an example of documentation about drawing text to a surface, I would really appreciate it.

Yes. It is a simple program but it does use quite a few different methods to accomplish the effects you see. It was a good program to learn more about PPL. The more I use this language, the more I like it.

Thanks a lot!

PointOfLight
08-10-2007, 04:37 AM
Check out G_LOADFONT and G_DRAWTEXTEX for Truetype fonts, and G_LOADVGAFONT and G_TEXTOUTEX for VGA fonts (you'll want to use the EX functions because the provide word wrap capabilities).

LarryCos
08-10-2007, 11:42 AM
Eric,

Thank you. I really appreciate your insights and help.

This sounds simple enough. What is the "magic spell" method that actually causes the Text to be associated with the Surface?

Where might you suggest I could read up on Surfaces to get a better understanding of Surfaces?

Thank you,

PointOfLight
08-10-2007, 02:41 PM
Unfortunately, at the moment there's not really a good place to read up on surfaces as a whole.* You can certainly check out all the surface functions in the help file.* To use an artist's analogy, a surface is nothing more than a canvas.* It's the area that you are currently drawing on.* However, unlike a traditional artist's canvas, in PPL you can combine multiple surfaces into one by drawing one surface on top of another.* To actually draw text to a particular surface, I refer you back to an earlier post on this thread:


//Create a surface
MsgSurface$ = NewSurface(240, 320);
//Create a sprite
MsgSprite$ = NewSprite(null);
SetSpriteSurface(MsgSprite$, MsgSurface$, 1, 0);
font$ = G_LOADFONT(...);



//When you want to display a new saying
cursurf$ = SetRenderTarget(MsgSurface$);
//Draw text to surface... ask if you need help with this
G_DRAWTEXTEX(font$, ...);
//Restore original drawing surface
SetRenderTarget(cursurf$);


block1 would be done in some sort of setup routine after you've initialized the GameAPI.* block2 would be done each time you switch sayings.* The SETRENDERTARGET function is the key to which surface you are drawing to.* If a drawing function doesn't specifically ask for a surface as one of it's parameters, then it will render to whatever the current surface is.

LarryCos
08-10-2007, 08:25 PM
Eric,

Thanks a heap. I will give it a try.

LarryCos
08-13-2007, 12:05 AM
Eric,

Everything is working except that the new text simply plops on top of the existing text. Maybe you could expand on the BLOCK2 code and tell me how I go about clearing out the old text from the surface. Here is what I have...

//* New Stuff *//
// Block 2

//When you want to display a new saying
TargetSurface$ = SetRenderTarget(SloganSurface$);


//Draw text to surface... ask if you need help with this
g_DrawTextEx(SloganFont$,SloganText$[SloganCount$], 5, 125, 235, -1, True);

//Restore original drawing surface
SetRenderTarget(TargetSurface$);

//* End of New Stuff *//

Thanks for your help.

PointOfLight
08-13-2007, 01:58 AM
Oops, my bad.* Use G_CLEAR(G_RGB(0, 0, 0));

Actually, the values for G_RGB can be whatever you want, but the following will create a blank black sprite.

LarryCos
08-13-2007, 03:20 AM
Eric,

Oh, man. I'm sorry. I should have been able to figure that out. I knew there had to be some way to clear that out. This makes total sense.

Thanks to you, anyone reading this thread will have learned quite a bit about Surfaces.

Gracias!

All the best to you,