Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, Power_P), 1,065 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Centering object #341652
09/19/10 01:53
09/19/10 01:53
Joined: Sep 2010
Posts: 12
Iceland
B
bjarni Offline OP
Newbie
bjarni  Offline OP
Newbie
B

Joined: Sep 2010
Posts: 12
Iceland
//I have this FADE IN splash screen

// Question HOW TO CENTER THE PANEL OR BMP

#include <acknex.h>
#include <default.c>


BMAP* splashing = "SplashScreen.pcx"; //Set the bitmap


function call_splash()
{
video_switch(7,32,1);

// Black background
sky_color.red = 0;
sky_color.green = 0;
sky_color.blue = 0;

mouse_mode = 2;
level_load(NULL);

PANEL* splashscreeny = pan_create("flags=SHOW | TRANSLUCENT;", 999); //create a panel at 0,0 at runtime

//Splash properties on start
splashscreeny.alpha = 0; // Start alpha of the Panel to 0
splashscreeny.bmap = splashing; // NOW add the bmap to the Panel


//Fade in
while(splashscreeny.alpha < 99) // make the Panel visible Loop
{
splashscreeny.alpha += 0.5*time_step; // increase the 1 to make the visible effect faster
wait(1);
}
splashscreeny.alpha = 100; // maks sure the Panel is fully visible
wait(-2); // wait 2 seconds before making it invisible again
while(splashscreeny.alpha > 99) // make the Panel invisible Loop
{
splashscreeny.alpha -= 1*time_step; // dencrease the 1 to make the invisible effect slower
wait(1);
}

//end of splashscreen
}


function main()
{
call_splash();


}

Re: Centering object [Re: bjarni] #341653
09/19/10 02:05
09/19/10 02:05
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
after
Code:
splashscreeny.bmap = splashing;

put
Code:
splashscreeny.pos_x = (screen_size.x - bmap_width(splashing)) / 2;
splashscreeny.pos_y = (screen_size.y - bmap_height(splashing)) / 2;



Re: Centering object [Re: MrGuest] #341654
09/19/10 02:47
09/19/10 02:47
Joined: Sep 2010
Posts: 12
Iceland
B
bjarni Offline OP
Newbie
bjarni  Offline OP
Newbie
B

Joined: Sep 2010
Posts: 12
Iceland
MrGuest thanx its working.


this one splashscreeny.pos_y = (screen_size.y - bmap_height(splashing)) / 2;
put it to further up so using
this one on vertical splashscreeny.pos_y = (screen_size.y =10);

just so other can get final version

thx again


Here it goes


/////////////////////////////////////////////////////////
// Car game with only 100 lines of lite-C.
// The original version was created by Thomas Oppl (ventilator)
// and won the "100 lines of code" contest. Artwork (c) Thomas Oppl.
/////////////////////////////////////////////////////////
// 5-2010 Adapted to car.c (jcl) - single player only
// 7-2010 Added speedometer (jcl)
/////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>


BMAP* splashing = "SplashScreen.pcx"; //Set the bitmap


function call_splash()
{
video_switch(7,32,1);

// Black background
sky_color.red = 0;
sky_color.green = 0;
sky_color.blue = 0;

mouse_mode = 2;
level_load(NULL);

PANEL* splashscreeny = pan_create("flags=SHOW | TRANSLUCENT;", 999); //create a panel at 0,0 at runtime

//Splash properties on start
splashscreeny.alpha = 0; // Start alpha of the Panel to 0
splashscreeny.bmap = splashing; // NOW add the bmap to the Panel

splashscreeny.pos_x = (screen_size.x - bmap_width(splashing)) / 2;
splashscreeny.pos_y = (screen_size.y =10);


//Fade in
while(splashscreeny.alpha < 99) // make the Panel visible Loop
{
splashscreeny.alpha += 0.5*time_step; // increase the 1 to make the visible effect faster
wait(1);
}
splashscreeny.alpha = 100; // maks sure the Panel is fully visible
wait(-2); // wait 2 seconds before making it invisible again
while(splashscreeny.alpha > 99) // make the Panel invisible Loop
{
splashscreeny.alpha -= 1*time_step; // dencrease the 1 to make the invisible effect slower
wait(1);
}

//end of splashscreen
}


function main()
{
call_splash();


}


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1