|
|
draw_quad layer?
#258301
03/29/09 15:32
03/29/09 15:32
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
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: Joozey]
#258483
03/30/09 22:11
03/30/09 22:11
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
Joined: Mar 2009
Posts: 112
Germany
|
Yeah you could make a panel this way: Code to create the bmpCreateString taken from EvilSOB's post
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
OP
Expert
|
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: Joozey]
#258577
03/31/09 17:04
03/31/09 17:04
|
Joined: Mar 2009
Posts: 112 Germany
KDuke
Member
|
Member
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
OP
Expert
|
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
|
|
|
|