Simulation of Glitches (GFX)

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Post Reply
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Simulation of Glitches (GFX)

Post by mrminecrafttnt »

Code: Select all

randomize timer
#include "fbgfx.bi"
screenres 640,480
dim as integer x1,x2,y1,y2,c
dim as integer cix,ciy,drawloopflag
dim as string glitchstring
dim as fb.Image Ptr  corrupt1 = imagecreate(64,64)
dim as fb.Image Ptr  corrupt2 = imagecreate(64,64)
dim as fb.image ptr img
do
   
    x1 = int(rnd*640)
    x2 = int(rnd*640)
    y1 = int(rnd*480)
    y2 = int(rnd*480)
    c = int(rnd*256)
    screenlock
    select case int(rnd*11)
    case 0
        line(x1,y1)-(x1+int(rnd*200),y1+int(rnd*200)),c,b
    case 1
        line(x1,y1)-(x2,y2),c,bf
    case 2
        locate int(rnd*100),int(rnd*100)
    case 3
        print glitchstring
    case 4
        color int(rnd*256)
    case 5
        if int(rnd * 100 ) = 1 then cls
    case 6
        
        select case int(rnd * 2)
        case 1
            img = corrupt1
        case 0
            img = corrupt2
        end select
       
        cix = int(rnd*640) + 1
        ciy = int(rnd*480) + 1
       
        if cix + 65 > 640 then cix - = 65
        if ciy + 65 > 480 then ciy - = 65
        
        print cix,ciy
        get (cix,ciy)-(cix+63,ciy+63),img
        
    case 7
        select case int(rnd*2)
        case 0
            for cx as integer = 0 to 640 step 30
                select case int(rnd * 2)
            case 1
                img = corrupt1
            case 0
                img = corrupt2
            end select
            for cy as integer = 0 to 480 step int(rnd*60) + 1
             
                select case int(rnd*2)
                case 0
                    put (cx,cy),img,and
                case 1
                    put (cx,cy),img,xor
                end select
               
            next
            next
           
        case 1
            for cy as integer = 0 to 480 step 64
                select case int(rnd * 2)
            case 1
                img = corrupt1
            case 0
                img = corrupt2
            end select
            for cx as integer = 0 to 640 step int(rnd*60) + 1
             
                select case int(rnd*2)
                case 0
                    put (cx,cy),img,or
                case 1
                    put (cx,cy),img,and
                end select
            next
            next
           
        end select
       
           
    case 8
        dim as ubyte char = int(rnd*256)
        if char <> 7 then glitchstring + = chr(char)
    case 9
        if int(rnd*100) = 0 then glitchstring = ""
   
    case 10
       
   
            for x as integer = 0 to 640 step 64
                for y as integer = 0 to 480 step (64  - int(rnd*10))
                    if int(rnd*2)=0 then img = corrupt1 else img = corrupt2
                    put(x,y),img,pset
                next
            next
    end select

    select case inkey
    case chr(27)
        exit do
    end select
   
    screenunlock
    sleep 15
loop 'until inkey = chr(27)
More things fixed! ;)
Last edited by mrminecrafttnt on May 18, 2017 9:45, edited 4 times in total.
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: Simulation of Glitches (GFX)

Post by Tourist Trap »

mrminecrafttnt wrote:
Illegal function call at line 46. Maybe some issue with the width, height parameters of GET? Or something?
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Simulation of Glitches (GFX)

Post by mrminecrafttnt »

Tourist Trap wrote:
mrminecrafttnt wrote:
Illegal function call at line 46. Maybe some issue with the width, height parameters of GET? Or something?
Fixed! :)
Muttonhead
Posts: 139
Joined: May 28, 2009 20:07

Re: Simulation of Glitches (GFX)

Post by Muttonhead »

still not work: i see only glitches
:P
nice
mrminecrafttnt
Posts: 131
Joined: Feb 11, 2013 12:23

Re: Simulation of Glitches (GFX)

Post by mrminecrafttnt »

Muttonhead wrote:still not work: i see only glitches
:P
nice
It was not working correclty but now.. ;)
thesanman112
Posts: 538
Joined: Jul 15, 2005 4:13

Re: Simulation of Glitches (GFX)

Post by thesanman112 »

gotta make it full screen....hehehehe
Post Reply