Sequentially replacing PANEL & TEXT

Posted By: kns

Sequentially replacing PANEL & TEXT - 05/10/09 06:35

Okay this is likely embarrassingly trivial (and I have more)... how does one update/replace a PANEL display with something new? Imagine displaying an image until a key is pressed at which time the screen is cleared or TEXT is displayed followed by another image.

I have browsed the first few Workshop tutorials but could not find the solution.

Thanks
Posted By: MrGuest

Re: Sequentially replacing PANEL & TEXT - 05/10/09 10:11

hey, depends on what's in the panel, you can either change the bmap, or if you have a seperate panel, just make the old one invisible and the new on visible

Code:
void main(){
  while(!key_enter){wait(1);} //wait until the enter key is pressed
  pnl_this.bmap = new_bmp; //show new bmap
}
or
Code:
void main(){
  while(!key_enter){wait(1);} //wait until the enter key is pressed
  reset(pnl_old, SHOW); //hide previous panel
  set(pnl_new, SHOW); //show new panel
}

hope this helps
Posted By: kns

Re: Sequentially replacing PANEL & TEXT - 05/10/09 16:06

Thank you.

Can this process be hardware accelerated with the bitmaps preloaded? Ultimately, the names of images will be read from a file into a STRUCT along with other information (e.g., x/y coord) while time elapsed, in ms, between display and key press will be critical.

Are there any benefits to doing this in legacy mode?

Again, I apologize for the basic nature of the questions. I am hoping to systematically reach a flexible end point which may necessitate very naive posts.

Code:
////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>

////////////////////////////////////////////////////////////////////

BMAP* first_pcx = "first.pcx"; 
BMAP* second_pcx = "main.pcx";


PANEL* first_pan = 
{
	pos_x = 0;
	pos_y = 0;
	layer = 1;
	bmap = first_pcx;
	flags = OVERLAY | VISIBLE;
}


/////////////////////////////////////////////////////////////////////

void main()
{
	video_mode = 7; 
	screen_color.blue = 150;


while(!key_enter)
{
	wait(1);
	} //wait until the enter key is pressed
  
  first_pan.bmap = second_pcx; //show new bmap	
	
}

© 2023 lite-C Forums