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
3 registered members (AndrewAMD, TipmyPip, OptimusPrime), 15,359 guests, and 7 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 2 of 2 1 2
Re: Color Picker [Re: MasterQ32] #406473
08/21/12 08:08
08/21/12 08:08
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
ah, you mean something like this?

if(hitMap==mouse_panel)
{...}

i will try it tonight after work

Re: Color Picker [Re: GameScore] #406475
08/21/12 08:33
08/21/12 08:33
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
yes, i meant this
but if this is correct, you have to substract the panel position from your mouse position:

var texX = mouse_pos.x - hitMap.pos_x;
var texY = mouse_pos.y - hitMap.pos_y;

then you have valid texture coordinates to get the pixel from


Visit my site: www.masterq32.de
Re: Color Picker [Re: MasterQ32] #406477
08/21/12 09:02
08/21/12 09:02
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
you should clamp the coords to the bitmap size too

var texX = clamp ( mouse_pos.x - hitMap.pos_x, 0, bmap_width(hiMap)-1 );
var texY = clamp ( mouse_pos.y - hitMap.pos_y, 0, bmap_height(hitMap)-1 );

Re: Color Picker [Re: txesmi] #406488
08/21/12 17:46
08/21/12 17:46
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
now i wrot ethe code like this and i get nor crash

Code:
void get_clr()
{
COLOR clr;	
var format; 
var pixel;

BMAP* hitMap = "color_btn.png";

var texX = clamp ( mouse_pos.x - clr_main.pos_x, 0, bmap_width(hitMap)-1 );
var texY = clamp ( mouse_pos.y - clr_main.pos_y, 0, bmap_height(hitMap)-1 );

if(mouse_panel==clr_main)
{
var format=bmap_lock(hitMap,0);
var pixel=pixel_for_bmap(hitMap,texX,texY);

bmap_unlock(hitMap);
}
}



clr_main is the panel where the mouse is over
and hitMap is the button with the colorfield bmap to grab the color
the function will called when i hit this button
but how can i get the colorvalues of the pixel now?

Last edited by GameScore; 08/21/12 17:47.
Re: Color Picker [Re: GameScore] #406491
08/21/12 18:08
08/21/12 18:08
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
COLOR col;
var alpha;
pixel_to_vec(&col, &alpha, format, pixel);


Visit my site: www.masterq32.de
Re: Color Picker [Re: MasterQ32] #406492
08/21/12 18:13
08/21/12 18:13
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
thanks guys man!
now it works nearly
the rest i can do by my self

Page 2 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