Canvas Generated Status Bar

Talk about making games.

Canvas Generated Status Bar

Postby Hblade » Mon Nov 28, 2011 1:22 am

Currently this is best seen on 320x240 resolution D: I'm working on more though :3

The code:
Code: Select all
void DrawBar(int w, int R, int G, int B) {
    int i;
        erase(0, 0, 0, 0);
        setpen(R, G, B, 0, 1);
    for (i=4;i<w-4;i++){
        moveto(i, 0);
        lineto(i, 8); }
    setpen(216, 216, 216, 0, 2);
    putpixel(0, 4);
    setpen(124, 124, 124, 0, 2);
    putpixel(2, 2);
    putpixel(2, 4);
    putpixel(2, 6);
    setpen(216, 216, 216, 0, 2);
    putpixel(4, 0);
    putpixel(4, 2);
    putpixel(4, 4);
    putpixel(4, 6);
    putpixel(4, 7);
    setpen(216, 216, 216, 0, 2);
    putpixel(w, 4);
    setpen(124, 124, 124, 0, 2);
    putpixel(w-2, 2);
    putpixel(w-2, 4);
    putpixel(w-2, 6);
    setpen(216, 216, 216, 0, 2);
    putpixel(w-4, 0);
    putpixel(w-4, 2);
    putpixel(w-4, 4);
    putpixel(w-4, 6);
    putpixel(w-4, 7);
    moveto(4, 8);
    lineto(w-4, 8);
    moveto(4, 0);
    lineto(w-4, 0);
    moveto(6, 2);
    setpen(255, 255, 255, 1, 1);
    putpixel(3, 0);
    putpixel(3, 8);
    putpixel(w-4, 0);
    putpixel(w-4, 8);
    setpen(188, 188, 188, 0, 1);
    moveto(4, 3);
    lineto(w-6, 3);
                    }


No programming skills needed to use this. Simply put:
Code: Select all
DrawBar(width, r, g, b);


replace width with the bar size you want, and r g b with numbers.

Enjoy :3

It's up to you to integrate this to work with HP though D:
Attachments
scrn.png
scrn.png (586 Bytes) Viewed 655 times
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest