Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, The_Judge, Grant), 898 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
draw_quad layer? #258301
03/29/09 15:32
03/29/09 15:32
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
I can't set a quad's layer, can I?
that really bugs me. I want to overlay the screen with a dark layer (transparent draw quad) and then render a message box panel ontop of that.
I used to do this in c_script and I used a small bmap for it, 1*1 pixels and streched that to the screen_size.x and .y... but that's ugly code and seems unecessary. Does anyone have an idea how to achieve the effect without having to load an extra image?


~"I never let school interfere with my education"~
-Mark Twain
Re: draw_quad layer? [Re: Germanunkol] #258479
03/30/09 20:36
03/30/09 20:36
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
No, you can't set a quad's layer.

Re: draw_quad layer? [Re: Lukas] #258480
03/30/09 20:59
03/30/09 20:59
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
... bmap_createblack and pan_create?


Click and join the 3dgs irc community!
Room: #3dgs
Re: draw_quad layer? [Re: Joozey] #258483
03/30/09 22:11
03/30/09 22:11
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
Yeah you could make a panel this way:
Code to create the bmpCreateString taken from EvilSOB's post
Code:

BMAP* createTransBMP(int SizeX, SizeY, int CDepth)
{

   STRING* bmpCreateString = str_create("");
   str_cat_num(bmpCreateString, "#%.0fx", SizeX);
   str_cat_num(bmpCreateString, "%.0fx",  SizeY);
   str_cat_num(bmpCreateString, "%.0f",   CDepth ); //Should be 32 for your purpose
   BMAP* bBlack = bmap_create(bmpCreateString);
   //Alright! Bmap is created... though we need it transparent!
   long i;
   //Every fourth byte is the alpha channel of the pixel!
   for(i = 3; i<= SizeX*SizeY*CDepth; i+=4)
      (bBlack->pixels)[i] = (byte)127; //set it to half opaque
   return bBlack;
}

function main()
{
   PANEL* myTransBlackPanel = pan_create("flags = SHOW", 1);
   myTransBlackPanel->bmap = createTransBMP(screen_size.x, screen_size.y, (int)32);
   myTransBlackPanel->size_x = myTransBlackPanel->bmap->width;
   myTransBlackPanel->size_y = myTransBlackPanel->bmap->height;
}


Though don't forget to ptr_remove the thing when it isn't needed anymore!

greetings
K-Duke


Last edited by KDuke; 03/30/09 22:13.

Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: draw_quad layer? [Re: KDuke] #258561
03/31/09 15:29
03/31/09 15:29
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
All right, that's just the kind of workaround I was looking for, thank you!
I use bmap_createblack since I only need a black one. I'm wondering though: when I use 32 bit, it doesn't do anything... it only works with 16 bit.
Any Ideas why?


~"I never let school interfere with my education"~
-Mark Twain
Re: draw_quad layer? [Re: Germanunkol] #258564
03/31/09 16:10
03/31/09 16:10
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Most likely because the alpha bit in 32 bit is set to 0. You need to change that manually then.


Click and join the 3dgs irc community!
Room: #3dgs
Re: draw_quad layer? [Re: Joozey] #258577
03/31/09 17:04
03/31/09 17:04
Joined: Mar 2009
Posts: 112
Germany
K
KDuke Offline
Member
KDuke  Offline
Member
K

Joined: Mar 2009
Posts: 112
Germany
I don't know why though I've found a better way to set the color of the created bitmap. That would be bmap_fill... just look it up in the manual.

But I gotta point you out that bmap_createblack will only create sizes of power of 2! So if you've got an odd screen-size (widescreen or window mode) it might get unhandy...

greetings
K-Duke


Using A7 Free
Click and join the 3dgs irc community!
Room: #3dgs
Re: draw_quad layer? [Re: KDuke] #258641
04/01/09 05:32
04/01/09 05:32
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
I've got to do yome last-minute studyies now, as I'm writing the last one of my final exams today, but I'll try it out this afternoon. I'll read up on bmap_fill, check out the resolution of the created bmap and check out the alpha bit. I don't really need alpha, since I'm setting the entire panel's alpha to 50 or so, meaning that I don't need the bmap to have an alpha channel. Does that mean I can just go with 16 bits? I don't really know much about the usage of those bits in a bitmap...
Thanks, and till this afternoon...


~"I never let school interfere with my education"~
-Mark Twain

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