#include <acknex.h>
/////////////////////////////////////////
var i_1 = 0; // when you make more than one panel...
STRING* input_c = "#80";
STRING* text_a = "testa";
STRING* text_b = "testb";
BMAP* arrow = "cursor.png";
BMAP* hWnd_win_console = "hwnd_fill_256.bmp";
BMAP* hWnd_but_2_up = "hWnd_but_2_up.bmp";
BMAP* hWnd_but_2_down = "hWnd_but_2_down.bmp";
PANEL* hWnd_win_console_pan[100]; // for example..
function move_hWnd_win_console();
function kill_hWnd_win_console();
TEXT* def_ctxt =
{
string("Befehl: ",input_c);
layer = 999;
}
TEXT* show_txt =
{
pos_x = 400;
pos_y = 10;
flags = SHOW;
layer = 999;
}
function create_console()
{
hWnd_win_console_pan[i_1] = pan_create
(
"bmap = hWnd_win_console;
pos_x = 400;
pos_y = 100;
button(234,1,hWnd_but_2_down,hWnd_but_2_up,hWnd_but_2_down,kill_hWnd_win_console,NULL,NULL);
button(218,1,hWnd_but_2_down,hWnd_but_2_up,hWnd_but_2_down,move_hWnd_win_console,NULL,NULL);
flags = SHOW | TRANSLUCENT ",10
);
toggle (def_ctxt,SHOW);
def_ctxt.pos_x = hWnd_win_console_pan[i_1].pos_x + 10;
def_ctxt.pos_y = hWnd_win_console_pan[i_1].pos_y + 20;
while is(def_ctxt ,SHOW)
{
inkey((def_ctxt ->pstring)[1]); // write ...
//input a //
if (str_cmp(input_c,text_a))
{
(show_txt.pstring)[0] = "Input A Okey";
}
else
//input b //
if (str_cmp(input_c,text_b))
{
(show_txt.pstring)[0] = "Input B Okey";
}
else
{
(show_txt.pstring)[0] = "Error";
}
wait(-2);
str_cpy(input_c," ");
(show_txt.pstring)[0] = " ";
}
}
function move_hWnd_win_console()
{
var mouse_offset_x = mouse_panel.pos_x - mouse_pos.x;
var mouse_offset_y = mouse_panel.pos_y - mouse_pos.y;
while(mouse_left) // während die maustaste gehalten wird:
{
mouse_panel.pos_x = mouse_pos.x + mouse_offset_x;
mouse_panel.pos_y = mouse_pos.y + mouse_offset_y;
mouse_panel.pos_x = clamp(mouse_panel.pos_x, 0, screen_size.x - mouse_panel.size_x);
mouse_panel.pos_y = clamp(mouse_panel.pos_y, 0, screen_size.y - mouse_panel.size_y);
def_ctxt.pos_x = hWnd_win_console_pan[i_1].pos_x + 10;
def_ctxt.pos_y = hWnd_win_console_pan[i_1].pos_y + 20;
wait(1);
}
}
function kill_hWnd_win_console()
{
reset(mouse_panel,SHOW);
toggle(def_ctxt,SHOW);
}
/////////////////////////////////////////
/////////////////////////////////////////
function main()
{
vec_set(screen_size,vector(1600,768,0)); // FENSTERGRÖSSE
vec_set(screen_color,vector(50,1,1));
vec_set(sky_color,vector(50,1,1));
video_window(NULL,NULL,0,"Console");
d3d_antialias = 1;
shadow_stencil = 3;
video_mode = 8; // Auflösung
mouse_map = arrow;
mouse_mode = 4;
level_load(NULL);
i_1++; //count up for the next window/panel
create_console(); //not (i_1) !!! -> because all other console events are'n filled by an array, only the win_pan !
}