Posted By: arezxtreme
Please Help with Panels/Visibility/Level_load - 12/16/07 18:59
Okay, so I did the 24 part Lite-C Tutorial and figured i'd dive right in before I start all the other tutorials. I created some pretty nice panels, and such but here is my problem.
The Problem:
I have a menu that has the following buttons, Start, Load Game, Options, Quit.
My problem is with the start button. When I click start which is supposed to load the function start, and it does i'm sure because if I move the panel off center I can see the level load behind it. However, I want that as soon as I click the start button, the panel loses its visibility, however I can't do it because the start function comes before the panel is even defined and if I try ingame_panel1.flags &= ~VISIBLE I just get an undeclared, unless it is after the panel.
Question:
How can I get my panel to dissapear and my level to load when I click the start button?
Code:
///////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
BMAP* ingame_bmap1 = "panel_main.tga"; // my first bmap
BMAP* mouse_pcx = "mouse.pcx"; // bitmap used for the mouse pointer
/////////////////////////////////////////////////////////////////////
function brightness()
{
video_gamma = 150;
while (video_gamma > 50)
{
video_gamma -= 1;
wait(-5);
}
}
function quit_program()
{
while (key_any)
{
wait (1);
}
sys_exit(NULL);
}
void load_game()
{
}
void options_main()
{
brightness();
}
function start_game()
{
level_load("rpg.wmb");
wait(2);
}
PANEL* ingame_panel1 = // my first panel
{
pos_x = 0;
pos_y= 0;
layer = 1;
bmap = ingame_bmap1;
flags = VISIBLE;
button (250, 335, "start_clicked.tga", "start_normal.tga", "start_over.tga", start_game, NULL, NULL);
button (250, 400, "load_clicked.tga", "load_normal.tga", "load_over.tga", load_game, NULL, NULL);
button (250, 465, "options_clicked.tga", "options_normal.tga", "options_over.tga", options_main, NULL, NULL);
button (250, 530, "quit_clicked.tga", "quit_normal.tga", "quit_over.tga", quit_program, NULL, NULL);
}
function main()
{
video_mode = 7;
screen_color.blue = 150;
mouse_mode = 1;
while (1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}
*This is the version without the line "ingame_panel.flags &= ~VISIBLE because I don't know where to put it.
The Problem:
I have a menu that has the following buttons, Start, Load Game, Options, Quit.
My problem is with the start button. When I click start which is supposed to load the function start, and it does i'm sure because if I move the panel off center I can see the level load behind it. However, I want that as soon as I click the start button, the panel loses its visibility, however I can't do it because the start function comes before the panel is even defined and if I try ingame_panel1.flags &= ~VISIBLE I just get an undeclared, unless it is after the panel.
Question:
How can I get my panel to dissapear and my level to load when I click the start button?
Code:
///////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
////////////////////////////////////////////////////////////////////
BMAP* ingame_bmap1 = "panel_main.tga"; // my first bmap
BMAP* mouse_pcx = "mouse.pcx"; // bitmap used for the mouse pointer
/////////////////////////////////////////////////////////////////////
function brightness()
{
video_gamma = 150;
while (video_gamma > 50)
{
video_gamma -= 1;
wait(-5);
}
}
function quit_program()
{
while (key_any)
{
wait (1);
}
sys_exit(NULL);
}
void load_game()
{
}
void options_main()
{
brightness();
}
function start_game()
{
level_load("rpg.wmb");
wait(2);
}
PANEL* ingame_panel1 = // my first panel
{
pos_x = 0;
pos_y= 0;
layer = 1;
bmap = ingame_bmap1;
flags = VISIBLE;
button (250, 335, "start_clicked.tga", "start_normal.tga", "start_over.tga", start_game, NULL, NULL);
button (250, 400, "load_clicked.tga", "load_normal.tga", "load_over.tga", load_game, NULL, NULL);
button (250, 465, "options_clicked.tga", "options_normal.tga", "options_over.tga", options_main, NULL, NULL);
button (250, 530, "quit_clicked.tga", "quit_normal.tga", "quit_over.tga", quit_program, NULL, NULL);
}
function main()
{
video_mode = 7;
screen_color.blue = 150;
mouse_mode = 1;
while (1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}
*This is the version without the line "ingame_panel.flags &= ~VISIBLE because I don't know where to put it.
Like this...