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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (M_D), 1,430 guests, and 3 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
Console for you #456370
11/20/15 14:03
11/20/15 14:03
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
you want to make a console in your 3d Gamestudio Project ?

here it is !

Code:
#include <acknex.h>


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

STRING* input_c = "#80"; 

STRING* text_a = "testa";
STRING* text_b = "testb";

//BMAP* arrow = "cursor.png";


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



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()
{   

  toggle (def_ctxt,SHOW);

  def_ctxt.pos_x = 410;
  def_ctxt.pos_y = 120;
  
  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 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);
  
  create_console();
  
}



write testa
or
wrtie testb



do you like it ?

Last edited by ratz; 11/20/15 14:19.
Re: Console for you [Re: ratz] #456377
11/20/15 19:38
11/20/15 19:38

M
Malice
Unregistered
Malice
Unregistered
M



<-- Added to the 2015 round-up thread.

I'll test it today and post a more helpful reply.
Mal

Re: Console for you [Re: ] #456399
11/21/15 11:13
11/21/15 11:13
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
i hope that was helpfull ->

to use: Copy and Paste to compile wink

Re: Console for you [Re: ratz] #456405
11/21/15 17:01
11/21/15 17:01

M
Malice
Unregistered
Malice
Unregistered
M



Simple, easy and effective, with room for modifying and variations. Helpful Indeed


Thanks
Mal

Re: Console for you [Re: ] #456422
11/22/15 11:46
11/22/15 11:46
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
you want to make a small GUI Console, that you can move and close ?

-> NO PROBELM !

here it is
Code:
#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 !
  
}



guiconsole.rar





Last edited by ratz; 11/22/15 11:51.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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