Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | 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