Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple graphics
#1
This wasn't aiming to be impressive, in fact it originally was just a very lame way of filling a circle, however my creativity soon got away with me and the last 2 and a half hours were spent making this. It doesn't require any external lib's just FreeBasic. Basically it makes squares rotating in a eclipsical ( :???: ) pattern whose size is determined by the mouse position. Enjoy... Post any optimizations if you want, my coding has a lot of room for improvement.
Code:
const r2d = 3.14159265359/180
dim r as integer, deg as integer 'radius, degree
dim wt as double 'timer
dim x as double, y as double 'deal with mouse
screen 14, 32
locate 8,16 :print "Fullscreen?"
locate 10, 18: print "Y = Yes"
locate 12, 18: print "N = No"
locate 14, 8: Print "Press 'F' in game to switch"
do
    if multikey(21) then     'Y
        fullscreen = 1
        exit do
    elseif multikey(49) then 'N
        fullscreen = 0
        exit do
    end if
loop
screen 20, 32, 2, fullscreen
work.page = 0:show.page = 1
screenset work.page, show.page
for rot = 0 to 25
    if rot = 25 then rot = 0
    cls
    getmouse mx,my
    x = mx - 512
    x = (x / 256)
    y = my - 384
    y = (y / 192)
    for r = 0 to 300 step 50
        for deg = 0 to 360 step 12
            line (cos((deg+rot)*r2d)*r*x+502, sin((deg+rot)*r2d)*r*y+379)-(cos((deg+rot)*r2d)*r*x+522, sin((deg+rot)*r2d)*r*y+389),rgb(0,0,255),b
            line (cos((360-(deg+rot))*r2d)*(r+25)*x+502, sin((360-(deg+rot))*r2d)*(r+25)*y+379)-(cos((360-(deg+rot))*r2d)*(r+25)*x+522, sin((360-(deg+rot))*r2d)*(r+25)*y+389),rgb(255,0,0),b
        next deg
    next r
    wt = timer + .01
    if multikey(33) then 'if 'F' is pressed, then switch fullscreen/windowed
        fullscreen = (fullscreen -1) * -1 'if 0 then 1 if 1 then 0
        screen 20, 32, 2, fullscreen
    end if
    swap work.page, show.page
    screenset work.page, show.page
    do
        i$ = inkey$        
    loop while wt > timer
    if multikey(1) then end 'exit on esc
next rot
end
[Image: freebasic.png]
Reply
#2
I like it, sometimes simple effects can be made to look really cool.
gunder
"I have a perfect body, but it's in the trunk and starting to smell."
Reply
#3
Wholy crap that is trippy and psychedelic! I think my eyes hurt.
Reply
#4
Thats neat! Its kind of pseudo 3D.
Reply
#5
heh, glad you guys got a kick out of it, I know i did. Big Grin
[Image: freebasic.png]
Reply
#6
:o Dizzy....... :barf:

Big Grin That was awusome! very pretty put it that way.. :wink:

8)
Kevin (x.t.r.GRAPHICS)

[Image: 11895-r.png]
Reply
#7
nice
It's the difference between asking someone how much flour goes into pancakes, and handing them a sorry mix of oozing green goo and asking them to fix it." - Deleter

-Founder & President of the No More Religion Threads movement-
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)