Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,508 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Why is my panel event not being called?? #286477
08/25/09 13:16
08/25/09 13:16
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
I have the folowing code:

BMAP* my_panel_bmap = "panel.tga";
BMAP* my_panel_clkd_bmap = "panel_clicked.tga";

PANEL* my_panel =
{ layer = 10;
bmap = my_panel_bmap;
event = panel_clicked;
FLAGS = OVERLAY | VISIBLE;
}

function panel_clicked()
{ my_panel.bmap = my_panel_clkd_bmap
wait(10);
my_panel.bmap = my_panel_bmap
}

So as you can see, the panel will basically "light up" (ymy_panel_clkd_bmap) when ever you click on it. But nothing happens. Im pretty sure its not even calling the function to begin with. Is there some other parameter I have to have set? like maybe my_panel.enable_click or something?

Re: Why is my panel event not being called?? [Re: Caermundh] #286492
08/25/09 14:17
08/25/09 14:17
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
What about the global variable "enable_mouse"? It's supposed to default to "1" (events on left-click) but perhaps elsewhere in your code it has been changed to "0"?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Why is my panel event not being called?? [Re: JibbSmart] #286499
08/25/09 14:43
08/25/09 14:43
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
Oh yeah. Forgot to mention that. I'm setting enable mouse to 1 in main() and it is not being changed anywhere else

Re: Why is my panel event not being called?? [Re: Caermundh] #286522
08/25/09 16:37
08/25/09 16:37
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Why are you not using buttons? wink
Quote:

bmapOn Bmap displayed when the button is switched on; gives also the size of the button.
bmapOff Bmap displayed when the the button is switched off.
bmapOver Bmap displayed when the mouse is over the button.




Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Why is my panel event not being called?? [Re: Ottawa] #286534
08/25/09 17:50
08/25/09 17:50
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
That's actually a pretty fair question. LOL! The answer is mostly because I hadn't thought to use buttons. But also I want the user to be able to grab panels with the mouse and drag them around the screen. So I need the panel event to work as well as button events.

Re: Why is my panel event not being called?? [Re: Caermundh] #286539
08/25/09 18:44
08/25/09 18:44
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

I think that a mixture of both is needed. I haven't tested this,
but I think that the buttons would follow the panel.


Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Why is my panel event not being called?? [Re: Ottawa] #286545
08/25/09 19:35
08/25/09 19:35
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Just a stab in the dark but try using a prototype at the begining of your code

for function panel_clicked()


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: Why is my panel event not being called?? [Re: Nidhogg] #286547
08/25/09 19:39
08/25/09 19:39
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
Yeah I put a protype in and it still acted like it wasn't calling the function

Re: Why is my panel event not being called?? [Re: Caermundh] #286735
08/26/09 20:25
08/26/09 20:25
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi!

Here's the code that I tested today.

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

/////////////////////////////// my mouse code
#include "mi_souris.c"
////////////////////// ---- my folders 
#define PRAGMA_PATH "..\\Models";
#define PRAGMA_PATH "..\\des_tga";
#define PRAGMA_PATH "..\\des_pcx";
#define PRAGMA_PATH "..\\panels";
#define PRAGMA_PATH "..\\sons_stereo"; //son_wav
#define PRAGMA_PATH "..\\son_wav";
//
BMAP* chrono_rec = "chrono_rec.pcx"; //my pcx picture
BMAP* b_fire = "fire.tga"; // tga picture for the button

//////////////////////////////////
PANEL* my_panel_1 = {
	bmap = chrono_rec;
	event = pan_event_1;
	scale_x = -0.5; 	
	scale_Y = -0.5;
	button (50, 50, b_fire,b_fire,b_fire,NULL,NULL,NULL);
	flags = SHOW;
}
///////////////////////////////
// panel event
function pan_event_1 ()
{
	while (mouse_left)
	{
		my_panel_1.pos_x = mouse_pos.x;   
		my_panel_1.pos_y = mouse_pos.y;
		wait (1);	
	}
}

function main() // main from code templates
{
	vec_set(screen_size,vector(800,400,0));
	vec_set(screen_color,vector(50,1,1)); // dark blue
	vec_set(sky_color,vector(50,1,1)); // dark blue
	video_window(NULL,NULL,0,"Moving a panel on the screen.");
	level_load("");
	ma_souris (); // my mouse code
	vec_set(camera.x,vector(-250,0,50));
	vec_set(camera.pan,vector(0,-15,0));
}



This moves the panel and the button over the screen.
When I touched the button the panel event was not activated.
Change the bmaps names and this should work.


Hope this helps!
Ottawa laugh

Ver 7.86.2 Pro and Lite-C
Re: Why is my panel event not being called?? [Re: Ottawa] #286798
08/27/09 13:48
08/27/09 13:48
Joined: Aug 2009
Posts: 26
Goiânia - Brazil
D
dmBlack Offline
Newbie
dmBlack  Offline
Newbie
D

Joined: Aug 2009
Posts: 26
Goiânia - Brazil
Just to test, change wait(10) for wait(-1.5)
Perhaps wait(10) is too fast to see the bmap shift.

Page 1 of 2 1 2

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

Gamestudio download | 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