Page 1 of 1

Simple but useful: Text window without images

PostPosted: Tue Mar 08, 2011 10:13 pm
by Hblade
This function allows you to draw a simple window handling both custom color per window, and opacity of the back part of the window. The command is easy as
Code: Select all
drawWin(r, g, b, transparency);

NOTE that this has to be in a Canvas Actor. The width and height are dependent on the canvas.
Simply replace r g b with the colors you want, and anywhere between 0 - 1 (EG: 0.50), where transparency is. Here's what this looks like :3
WindowOfAwesome.jpg


The code: Copy and paste this in the Global Code
Code: Select all
void drawWin(int R, int G, int B, double TRANS) {
    int i;
    setpen(R, G, B, TRANS, 1);
    moveto(3, 3);
    for (i=3;i<height-4;i++) {
        moveto(3, i);
        lineto(width-4, i);
                             }
    setpen(R*1.2, G*1.2, B*1.2, 0, 3);
    moveto(0, 0);
    lineto(0, height-1);
    lineto(width-1, height-1);
    lineto(width-1, 0);
    lineto(0, 0);
    setpen(R/2, G/2, B/2, 0, 3);
    moveto(4, 4);
    lineto(4, height-5);
    lineto(width-5, height-5);
    lineto(width-5, 4);
    lineto(4, 4);
                 }

Re: Simple but useful: Text window without images

PostPosted: Tue Mar 08, 2011 10:19 pm
by again
Plus +1 for that useful info.

Re: Simple but useful: Text window without images

PostPosted: Wed Mar 09, 2011 12:10 am
by Hblade
Thanks

Re: Simple but useful: Text window without images

PostPosted: Fri Mar 11, 2011 9:58 am
by Camper1995
Pretty simple to use and looks great in game. Good job Hblade.

Yesterday, I have made a button for games using canvas. Check it out. I just wanna share it with you, maybe you'll think about where to use it :D
It can be resized to any size.

canvas button Windows XP.ged
(2.15 KiB) Downloaded 87 times


I was trying to make button that looks like from WinXP :lol:

Re: Simple but useful: Text window without images

PostPosted: Fri Mar 11, 2011 5:51 pm
by Hblade
awesome dude :D