BASIC

Author Topic: DrawRect with Border  (Read 2111 times)

momosxp

  • Guest
DrawRect with Border
« on: 2009-Aug-18 »
Here a simple function to draw a rectangle with border. I wrote it for the Menus of a RPG..
Maybe something which could be implemented in GLBasic?

Code: GLBasic [Select]
FUNCTION DrawWindow: WindowX,WindowY,WindoWidth,WindowHeight,WindowRGB,BorderRGB,Border
                DRAWRECT WindowX,WindowY,WindoWidth+2*Border,Border,BorderRGB
                DRAWRECT WindowX,WindowY+WindowHeight+Border,WindoWidth+2*Border,Border,BorderRGB
                DRAWRECT WindowX,WindowY+Border,Border,WindowHeight+Border,BorderRGB
                DRAWRECT WindowX+WindoWidth+Border,WindowY+Border,Border,WindowHeight+Border,BorderRGB
//              ALPHAMODE 1
                DRAWRECT WindowX+Border,WindowY+Border,WindoWidth,WindowHeight,WindowRGB
//              ALPHAMODE 0
ENDFUNCTION



Example
Code: GLBasic [Select]
SETSCREEN 320,240,0
SYSTEMPOINTER TRUE
        // SETCURRENTDIR("Media") // seperate media and binaries?
WHILE TRUE
MOUSESTATE mx,my,b1,b2
DrawWindow (20,2,50,100,RGB(255,255,255),RGB(0,0,255),5)
DrawWindow (120,70,100,100,RGB(0,0,255),RGB(255,0,0),mx)
SHOWSCREEN
WEND
FUNCTION DrawWindow: WindowX,WindowY,WindoWidth,WindowHeight,WindowRGB,BorderRGB,Border
                DRAWRECT WindowX,WindowY,WindoWidth+2*Border,Border,BorderRGB
                DRAWRECT WindowX,WindowY+WindowHeight+Border,WindoWidth+2*Border,Border,BorderRGB
                DRAWRECT WindowX,WindowY+Border,Border,WindowHeight+Border,BorderRGB
                DRAWRECT WindowX+WindoWidth+Border,WindowY+Border,Border,WindowHeight+Border,BorderRGB
//              ALPHAMODE 1
                DRAWRECT WindowX+Border,WindowY+Border,WindoWidth,WindowHeight,WindowRGB
//              ALPHAMODE 0
ENDFUNCTION

[attachment deleted by admin]
« Last Edit: 2009-Aug-18 by momosxp »

momosxp

  • Guest
Re: DrawRect with Border
« Reply #1 on: 2009-Aug-24 »
ohh i would have to look into that.. Don't know polyvector yes. Will give it a try