Code Snippet03--SplashWindow(Timer driven)

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.
D.Bane
Posts: 78
Joined: Thu Jul 29, 2010 2:51 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by D.Bane »

Hi to all.

Sam. I was looking to add some changes to the Window class of ecere and while going through code I wanted to try something.

I have updated the splash.ec file with these new codes:

Code: Select all

 
 opacity = 0.5;
 alphaBlend = true;
 bool effectGoDown; effectGoDown = true; // CHECK THIS OUT - TRUE/FALSE - different results
 
and this in timer's expired function

Code: Select all

 
 if(effectGoDown == true)
  { opacity += 0.1; } //better effects
 else
  { opacity -= 0.1; }
 
I have also attached the entire flash.ec file.

I think this adds a bit more to the splash screen. To use it as you would like you need to think about next thing. The background color is very important as depending on the color, you will get transparency of different percentages. For example, the white color is opaque even if the opacity is set to 0, but if you set the opacity to 0 and have black for your background you will barely see it.

Oh, and a suggestion for Jerome and Redj, some functions do not have a name that others can understand at the first, it might be better to have a comment line just under the start of function that will tell something like 'used for setting position of window', 'used for moving window'...

O, and ecere is cool :)

Thank you,
D.Bane.
Attachments
splash.ec
It shows how to use form as a splash screen that counts down and has some transparency effects. It works with the main.ec located in the Sam's first post
(1.15 KiB) Downloaded 1163 times
No army is to big, if the heart is beating strong.
There's no bad luck, it's just easier to blame someone else.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by jerome »

Hi D. Bane,

Thanks for posting this opacity tweak :)

About your suggestion for comments, the idea would be that the documentation (accessible from F1 in the IDE) would have a detailed description and usage information for the whole Ecere API. Some of it might be written already, but it is not complete at this point.

That is a high priority but unfortunately my time is very limited right now. Help is welcome :)

Regards,

Jerome
D.Bane
Posts: 78
Joined: Thu Jul 29, 2010 2:51 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by D.Bane »

Hi Jerome.

I understand about the time very well :)

I am trying out some things, hopefully I will be able to add some things to ecere as well, I am amazed by how everything works with ecere.

For now I am looking to figure out opacity as much as possible, and add a tooltip property to the window class and some other things...

Regarding splash.ec. If anyone wants to create a fast and nice looking splash screen I would suggest going with

Code: Select all

i = 50;
and

Code: Select all

delay = 0.05;
and go up and down with opacity...

I will create a ReadyToUse Splash class, with few effects when I get time.
No army is to big, if the heart is beating strong.
There's no bad luck, it's just easier to blame someone else.
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by samsam598 »

Hi D.Bane,

Thank you so much for all you've done!Looking forward to the complete SplashWindow class.I encountered weird crash when I tried to modify i to 50 and/or delay to 0.05.
D.Bane
Posts: 78
Joined: Thu Jul 29, 2010 2:51 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by D.Bane »

Hi.

Sam, I believe that you have not changed the char[2] to char[3] or more.. I am sorry that I have not said that as well.

OK. Here is the splash.ec with i = 50; I also added up and down transition to it..you'll see :)

So basically if that was the case with the error, you had a small bucket and tried to put to much in it...

I changed this:

Code: Select all

int i; i=50;
....
Timer timer
 {
    userData = this, started = true, delay = 0.1;

    bool DelayExpired()
    {

       char msg[3]; //this here - and it needs to be updated with regards of the number.. 0-9 char[2] 10-99 char[3] 100-999 char[4]... because of the '\0'
        ...
       if(effectGoDown == true) //better effects
       {
          opacity += 0.05;
          if (i == 25)
          {effectGoDown = false;}
       }
       ....
    }
Attachments
splash.ec
With i = 50;
(1.23 KiB) Downloaded 1154 times
No army is to big, if the heart is beating strong.
There's no bad luck, it's just easier to blame someone else.
samsam598
Posts: 212
Joined: Thu Apr 14, 2011 9:44 pm

Re: Code Snippet03--SplashWindow(Timer driven)

Post by samsam598 »

Sorry for my careless,I should have found the buffer overflow issue by myself.Thanks again!
Post Reply