Gamestudio Links
Zorro Links
Newest Posts
IB - Stop order for options
by Petra. 01/19/21 10:52
Writing strategy DLL in C#
by AndrewAMD. 01/18/21 13:56
Training strategy - errors
by Petra. 01/18/21 12:14
question about View* Entity
by ratz. 01/16/21 23:18
Has anyone used LSTM?
by TraderTom. 01/16/21 22:41
NOFILTER for Level Blocks?
by Dooley. 01/15/21 20:30
AUM Magazine
Latest Screens
Scheherazade's Journey
Paradox Vector
The Space Between
Pogostuck: Rage With Your Friends
Who's Online Now
1 registered members (MMK), 474 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
minimeken, TraderTom, babyrazia, copernico, jari
18574 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
question about View* Entity #482115
12/26/20 21:33
12/26/20 21:33
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
Hello i have an Question about View* Entity...
is it possible to give an view* Entity a rotation function ?

Code
ENTITY* element_onscreen =
{
  type = "h2.mdl";
  layer = 10;
   x = 750;
   y = -330;
   z = -10;
   pan = 0.2; // like this ..endless
   flags2 = SHOW;
}

Re: question about View* Entity [Re: ratz] #482116
12/26/20 21:41
12/26/20 21:41
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
okey i find it grin

Code
...
while(1)
 {
  //maus_x = mouse_pos.x;
  //maus_y = mouse_pos.y;	
  
  element_onscreen.pan += 1;
  wait(1);
 }
 

Last edited by ratz; 12/26/20 23:02.
Re: question about View* Entity [Re: ratz] #482118
12/27/20 00:06
12/27/20 00:06
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
okey... now i want move my Entity the same time, like the element-windows + infoPan...

in this part is the function:

Code

function move_peerd()
{
 while(mouse_left == 1)
	{	
  panPeerdiodenSystem.pos_x = mouse_pos.x-769;               // need number in posX so the panel/mouse will not jump to anywhere if you click the move button
  panPeerdiodenSystem.pos_y = mouse_pos.y-10;                // need number in posY so the panel/mouse will not jump  to anywhere if you click the move button
  
  pan_info.pos_x = panPeerdiodenSystem.pos_x;     
  pan_info.pos_y = panPeerdiodenSystem.pos_y;
  
     
  element_onscreen.y =- panPeerdiodenSystem.pos_x-130;        // NOW !...      Y = left/right  ...( =- need this ! or up is down)
  element_onscreen.z =- panPeerdiodenSystem.pos_y+300a;        //  NOW ! ...     Z = up/down ...( =- need this  !or left is right)
  
 
  
  	wait(1);
 	}
}



it works .. but the entity moves not so fast ... its a little bit slower,so it moves outside my window.. how can i fix it ?



you lke moving windows with runtime-evens ???
copy/paste/run

here is my GUI* a simple part .. grin

Code

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

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

  var cam_x = 0;
  var cam_y = 0;
  var cam_z = 0;
  
  var cam_pan = 0;
  var cam_tilt = 0;
  var cam_roll = 0;

  var maus_x = 0;
  var maus_y = 0;
  
  var elementID = 0;
 

PANEL* panDEBUGDisplay =
{
 pos_x = 100;     
  pos_y = 100;
  
  digits(35, 10, "Camera X = %0.f", *, 1, cam_x);
  digits(35, 20, "Camera Y = %0.f", *, 1, cam_y);
  digits(35, 30, "Camera Z = %0.f", *, 1, cam_z);

  digits(35, 50, "Box Pan = %0.f", *, 1, cam_pan);
  digits(35, 60, "Box Tilt = %0.f", *, 1, cam_tilt);
 digits(35, 70, "Box Roll = %0.f", *, 1, cam_roll);

  digits(35, 90, "Maus X = %0.f", *, 1, maus_x);
  digits(35, 100, "Maus Y = %0.f", *, 1, maus_y);
  
  layer = 10;
  flags = SHOW;
  
}

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

BMAP* arrow = "arrow.tga"; // 32x32 ARGB image 	
PANEL* panPeerdiodenSystem;


function kill_peerd();
function mini_peerd();
function move_peerd();
function maxi_peerd();



//function set_menu();

function set_peeriod();

//function set_edit();

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

STRING* string1_name = "bla";
STRING* string1_id = "bla bla";
STRING* string1_typ = "bla bla bla";

PANEL* pan_info =
{       
  pos_x = 200;     
  pos_y = 300;
  
    digits(710,150,0,*,0,string1_name);
    digits(710,160,0,*,0,string1_id);
    digits(710,170,0,*,0,string1_typ);  
    layer = 6;
}


ENTITY* element_onscreen =
{
  type = NULL;
  layer = 10;
   x = 750;
   y = -330;
   z = -10;
   flags2 = SHOW;
}


////////////////////////ALL  ELEMENTS//////////////////////////////////////

function h2_info()
{
  
  str_cpy(string1_name,"Wasserstoff"); 
  str_cpy(string1_id,"1"); 
  str_cpy(string1_typ,"Wasserstoff"); 	 
  //ent_morph(element_onscreen,"h2.mdl");	   // Works GREAT :)
//...
}

function he_info()
{
  str_cpy(string1_name,"Helium"); 
  str_cpy(string1_id,"2"); 
  str_cpy(string1_typ,"Edelgas"); 	 
//  ent_morph(element_onscreen,"he.mdl");        // Works GREAT :)
//...
}

function li_info()
{
  str_cpy(string1_name,"Lithium"); 
  str_cpy(string1_id,"3"); 
  str_cpy(string1_typ,"Alkali"); 	 
//  ent_morph(element_onscreen,"li.mdl");	
//...
}


function be_info()
{
  str_cpy(string1_name,"Beryllium"); 
  str_cpy(string1_id,"4"); 
  str_cpy(string1_typ,"Erdalkalimetall"); 	 
//  ent_morph(element_onscreen,"be.mdl");	 
//...
}

// .......

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

PANEL* panPeerdiodenSystem =
{
  bmap = "peerd.bmp";
  pos_x = 200;     
  pos_y = 300;
  
  digits(784,10,"X",*,0,0);
  digits(765,10,"0",*,0,0);
  digits(746,10,"_",*,0,0);
   
  digits(628,150,"Element Name:",*,0,0);
  digits(628,160,"Element ID:",*,0,0);
  digits(628,170,"Element Typ:",*,0,0);
  
  button (778,6 "small_down.bmp", "small_up.bmp", "small_up.bmp", kill_peerd(), NULL, NULL);
  button (759,6 "small_down.bmp", "small_up.bmp", "small_up.bmp", move_peerd, NULL, NULL);
  button (740,6 "small_down.bmp", "small_up.bmp", "small_up.bmp", mini_peerd(), NULL, NULL);
  
  
 button (32,28, "hwnd_blank_down.bmp", "hwnd_blank_up.bmp", "hwnd_blank_up.bmp",  h2_info(), NULL, NULL);
 button (576,28, "hwnd_blank_down.bmp", "hwnd_blank_up.bmp", "hwnd_blank_up.bmp", he_info(), NULL, NULL);
  
 button (32,56, "hwnd_blank_down.bmp", "hwnd_blank_up.bmp", "hwnd_blank_up.bmp", li_info(),NULL, NULL);
 button (64,56, "hwnd_blank_down.bmp", "hwnd_blank_up.bmp", "hwnd_blank_up.bmp", be_info(), NULL, NULL);
  
 // button (416,56, "hwnd_b_down.bmp", "hwnd_b_up.bmp", "hwnd_b_up.bmp", b_info(), NULL, NULL);  
 // button (448,56, "hwnd_c_down.bmp", "hwnd_c_up.bmp", "hwnd_c_up.bmp", c_info(), NULL, NULL);  
 // button (480,56, "hwnd_n_down.bmp", "hwnd_n_up.bmp", "hwnd_n_up.bmp", n_info(), NULL, NULL);
 // button (512,56, "hwnd_o_down.bmp", "hwnd_o_up.bmp", "hwnd_o_up.bmp", o_info(), NULL, NULL);
 // button (544,56, "hwnd_f_down.bmp", "hwnd_f_up.bmp", "hwnd_f_up.bmp", f_info(), NULL, NULL);
 // button (576,56, "hwnd_ne_down.bmp", "hwnd_ne_up.bmp", "hwnd_ne_up.bmp", ne_info(), NULL, NULL);
  
  
  // button (32,84, "hwnd_na_down.bmp", "hwnd_na_up.bmp", "hwnd_na_up.bmp", NULL, NULL, NULL);
 // button (64,84, "hwnd_mg_down.bmp", "hwnd_mg_up.bmp", "hwnd_mg_up.bmp", NULL, NULL, NULL);
 // button (416,84, "hwnd_al_down.bmp", "hwnd_al_up.bmp", "hwnd_al_up.bmp", NULL, NULL, NULL);  
 // button (448,84, "hwnd_si_down.bmp", "hwnd_si_up.bmp", "hwnd_si_up.bmp", NULL, NULL, NULL);  
 // button (480,84, "hwnd_p_down.bmp", "hwnd_p_up.bmp", "hwnd_p_up.bmp", NULL, NULL, NULL);
 // button (512,84, "hwnd_s_down.bmp", "hwnd_s_up.bmp", "hwnd_s_up.bmp", NULL, NULL, NULL);
 // button (544,84, "hwnd_cl_down.bmp", "hwnd_cl_up.bmp", "hwnd_cl_up.bmp", NULL, NULL, NULL);
 // button (576,84, "hwnd_ar_down.bmp", "hwnd_ar_up.bmp", "hwnd_ar_up.bmp", NULL, NULL, NULL);  
 

 //....
 //....
 //....

   layer = 5;
  
}


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

PANEL* panMiniPeerd =
{
  bmap = "Button_up.bmp";
  pos_x = 40;     
  pos_y = 720;
  
  digits(15,5,"Elemente",*,0,0);
  
  button (0,0, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp", maxi_peerd(),NULL, NULL);
  layer = 10;
 }

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



function kill_peerd()
{
 reset(panPeerdiodenSystem, SHOW); 
 reset(pan_info, SHOW);
}


function mini_peerd()
{	
 reset(panPeerdiodenSystem, SHOW);
 reset(pan_info, SHOW);
 
 set(panMiniPeerd, SHOW);  
}


function maxi_peerd()
{	
 reset(panMiniPeerd, SHOW);
 
 set(pan_info, SHOW);
 set(panPeerdiodenSystem, SHOW);  
}



function move_peerd()
{
 while(mouse_left == 1)
 {	
  panPeerdiodenSystem.pos_x = mouse_pos.x-769;               // need number in posX so the panel/mouse will not jump to anywhere if you click the move button
  panPeerdiodenSystem.pos_y = mouse_pos.y-10;                // need number in posY so the panel/mouse will not jump  to anywhere if you click the move button
  
  pan_info.pos_x = panPeerdiodenSystem.pos_x;     
  pan_info.pos_y = panPeerdiodenSystem.pos_y;
  
     
  element_onscreen.y =- panPeerdiodenSystem.pos_x-130;        // NOW !...      Y = left/right  ...( =- need this ! or up is down)
  element_onscreen.z =- panPeerdiodenSystem.pos_y+300;        //  NOW ! ...     Z = up/down ...( =- need this  !or left is right)
  
  wait(1);
  }
}


function set_peeriod()
{	
 set(panPeerdiodenSystem, SHOW);  
 set(pan_info, SHOW);
}



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


PANEL* panGame =
{
  bmap = "emty_screen.bmp";
  pos_x = 0;     
  pos_y = 0;
  
  //75x18 button + 15x10 digits
  
  digits(15,10,"Menu 1",*,0,0);
  button (0,5, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp",NULL,NULL, NULL);
  
  digits(90,10,"Menu 2",*,0,0);
  button (75,5, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp",set_peeriod(),NULL,NULL);

 digits(155,10,"Menu 3",*,0,0);
  button (150,5, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp", NULL,NULL, NULL);
  
  digits(230,10,"Menu 4",*,0,0);
  button (225,5, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp", NULL,NULL, NULL);
  

  button (300,5, "Button_down.bmp", "Button_up.bmp", "Button_up.bmp", NULL,NULL, NULL);
    
  layer = 1;
  flags = OVERLAY | SHOW;
}



function main()
{
  vec_set(screen_size,vector(1024,768,0));
  vec_set(screen_color,vector(1,1,1)); // dark blue
  vec_set(sky_color,vector(1,1,1)); // dark blue
  video_mode = 10;
  video_window(NULL,NULL,0,"Demo");
 // video_screen = 1;
  
  d3d_antialias = 1;
  shadow_stencil = 3;
  
  level_load(NULL);

  //vec_set(camera.x,vector(0,0,0));
  //vec_set(camera.pan,vector(0,0,0));
  
  //ship_creator();
  mouse_map = arrow; // use arrow as Mouspointer!
 
  mouse_mode = 4;
 
  while(1)
  {
    maus_x = mouse_pos.x;
   maus_y = mouse_pos.y;	
  
   element_onscreen.pan += 1;
   wait(1);
  }
  

}


all u need
6 sample Buttons (up/down)+ mouse and 2 -panel

grin grin grin



Last edited by ratz; 12/27/20 02:55.
Re: question about View* Entity [Re: ratz] #482121
12/27/20 10:58
12/27/20 10:58
Joined: Jul 2007
Posts: 590
Turkey, izmir
Emre Offline
User
Emre  Offline
User

Joined: Jul 2007
Posts: 590
Turkey, izmir
You need to use vec_for_screen to convert the coordinates. Sample:
Code
#include <acknex.h>
#include <default.c>


ENTITY* element_onscreen =
{
	type = "CUBE.mdl";
	layer = 10;
	x = 750;
	y = -330;
	z = -10;
	flags2 = SHOW;
}

function main()
{

	video_mode = 10;
	video_window(NULL,NULL,0,"Demo");
	level_load(NULL);
	mouse_pointer=2; 
	mouse_mode = 4;
	
	VECTOR v;
	while(1)
	{
		element_onscreen.pan += 1;
		if(mouse_left == 1)
		{	
			v.x = mouse_pos.x;
			v.y = mouse_pos.y;
			v.z = 750;//(element_onscreen.x)
			
			//convert coordinates
			vec_for_screen(v,camera);
			vec_set(element_onscreen.x,v);
		} 
		wait(1);
	}
}


Re: question about View* Entity [Re: ratz] #482180
01/07/21 01:53
01/07/21 01:53
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
hi i'm back...
i have a new problem:

how can i start a view/flag2 object in runtime ?

Code
- ptr_remove(element_on_screen);  // in mini_panel();


works grin ...

backtime when i starts my window panel again +
Code
set(element_on_screen, SHOW)  // in maxi_panel


there comes an error message in my program , after minisize and pop it up to normal size:
Invaild function arguments in ...(bla bla bla function() ) // <-he_info()


...

Code
ent_create(element_on_sceen,NULL,NULL)


doesn't work .. whats wrong

Re: question about View* Entity [Re: ratz] #482181
01/07/21 02:05
01/07/21 02:05
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
oh ... it was : ent_createlayer(STRING* filename, var flags2, var layer) : ENTITY*

Re: question about View* Entity [Re: ratz] #482249
01/16/21 23:18
01/16/21 23:18
Joined: Oct 2008
Posts: 341
R
ratz Offline OP
Senior Member
ratz  Offline OP
Senior Member
R

Joined: Oct 2008
Posts: 341
runtime:

VIEW:
element_onscreen.flags2 = OFF;
element_onscreen.flags2 |= SHOW;

PANEL:
set(your_pan, SHOW)
reset(your_pan, SHOW)

ENTITY:
ent_create()
ptr_remve(); // be carefully ! delete stringline*, too !
// need an empty Entity pointer or Malfunction error!




Last edited by ratz; 01/16/21 23:28.

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