Posted: 10th Jan 2003 20:45
Thanks
Posted: 11th Jan 2003 19:31
This is very good!
Posted: 23rd Jan 2003 21:06
Please send me the shader examples: [url=mailto:regulyistvan@hotmail.com]regulyistvan@hotmail.com[/url]
Posted: 23rd Jan 2003 22:27
huh?

This post is not about shaders. I do not yet have GFX card capable of handling them, so I cannot experiment with them, a pity that.

Oh, I see what you've done, you have tagged this request on the end of a number of posts in different forums, whether they relate to shaders or not.

That's not a good idea.
Posted: 4th Feb 2003 1:52
OK, try this, I think this will now work in DB standard, there's not much difference between this and the first version posted above.

+ Code Snippet
sync on : sync rate 60
randomize timer()
set text opaque

bw = bitmap width(0)
bh = bitmap height(0)

rem --- make a sample image on bitmap 0
DrawSomething(0,0)
sync

create bitmap 1, bw, bh

t = 1
do
  rem --- make a sample image in bitmap 1
  DrawSomething(1,t)
  t = t + 1 : if t = 3 then t = 0

  set current bitmap 0
  ink rgb(255,255,255),0
  center text bw / 2, bh - 32, " Press any key! "
  sync
  wait key

  ShatterWipe(1,10,8,10)
  sync
loop

end

function DrawSomething(bmp,t)
  set current bitmap bmp : cls 0
  bw = bitmap width(bmp) : bh = bitmap height(bmp)
  for i = 1 to 1000
    ink rgb(rnd(255),rnd(255),rnd(255)),0
    if t = 0 then dot rnd(bw),rnd(bh)
    if t = 1 then line rnd(bw),rnd(bh),rnd(bw),rnd(bh)
    if t  = 2
      r = rnd(40) + 10
      ellipse rnd(bw),rnd(bh),r,r
    endif
  next i
endfunction


function ShatterWipe(bmp,columns,rows,speed)
  remstart
    bmp = source bitmap to be displayed in bitmap 0 (bmp size must equal bitmap 0)

    columns, rows = number of divisions in bitmap. It's best to use values
    that can easily divide into width and height of bitmap (min 4, max 20)

    speed = how fast you want the blocks to fly
  remend

  if bitmap exist(bmp) and bmp > 0
    bw = bitmap width(0) : bh = bitmap height(0)

    if bw = bitmap width(bmp) and bh = bitmap height(bmp)
      if columns < 4 then columns = 4
      if columns > 20 then columns = 20
      if rows < 4 then rows = 4
      if rows > 20 then rows = 20
      if speed < 1 then speed = 1

      spritetotal = columns * rows
      spritewidth = bw / columns
      spriteheight = bh / rows
      offsetx = spritewidth / 2
      offsety = spriteheight / 2
      dim xd(spritetotal) : dim yd(spritetotal)

      sx = 0 : sy = 0
      for i = 1 to spritetotal
        s = 65536 - i

        rem --- set sprite
        get image s, sx, sy, sx + spritewidth, sy + spriteheight, 1
        sprite s, sx+offsetx, sy+offsety, s : offset sprite s, offsetx, offsety
        set sprite s, 1, 0

        inc sx, spritewidth
        if sx >= bw
          sx = 0
          sy = sy + spriteheight
        endif

        rem --- set direction speed and rotation speed of sprite
        repeat : xd(i) = (rnd(speed*2) - speed) : until abs(xd(i)) > speed / 2
        repeat : yd(i) = (rnd(speed*2) - speed) : until abs(yd(i)) > speed / 2
      next i

      copy bitmap bmp,0
      spritesoffscreen = 0

      rem <-- Play sound here

      rem --- Ok, here we go! Loops until all blocks are off screen
      repeat
        for i = 1 to spritetotal
          s = 65536-i

          if sprite exist(s)
            rem --- update sprite position
            sx = sprite x(s) + xd(i)
            sy = sprite y(s) + yd(i)
            sprite s, sx, sy, s

            rem --- if sprite off screen then delete it
            if sx > (bw + offsetx) or sx < -offsetx or sy > (bh + offsety) or sy < -offsety
              delete sprite s
              delete image s
              spritesoffscreen = spritesoffscreen + 1
            endif

          endif
        next i

        sync
      until spritesoffscreen = spritetotal

      rem --- clean up and exit
      undim yd() : undim xd()

    endif
  endif

endfunction


I had to drop the following:
1) Rotating the sprites, because DB standard does not support this.
2) The Draw Sprites Last command, I believe sprites are always drawn last in DB standard (I can't remember).
3) Any references of Inc (or Dec) these two commands are not present in DB standard (well, version 1.0 anyway).

As for other wipes, I only created this wipe because I was stuck for something to do at the time, so I havn't made any others since, sorry. Perhaps next time when I have'nt anything to do
Posted: 4th Feb 2003 2:16
...oh and:
4) Select, Case and Endselect, replaced with if's in the DrawSomething() function.
Posted: 4th Feb 2003 22:28
Hmmm, I suspect its the use of -offsetx and -offsety, so I'll take any references to those out. They were only there for the rotation version.

I don't have a working copy of original DarkBasic any more (broke the cd) so its a bit tricky to test for compatabilty.

However, let's see if this works (fingers crossed):
+ Code Snippet
sync on : sync rate 60
randomize timer()
set text opaque

bw = bitmap width(0)
bh = bitmap height(0)

rem --- make a sample image on bitmap 0
DrawSomething(0,0)
sync

create bitmap 1, bw, bh

t = 1
do
  rem --- make a sample image in bitmap 1
  DrawSomething(1,t)
  t = t + 1 : if t = 3 then t = 0

  set current bitmap 0
  ink rgb(255,255,255),0
  center text bw / 2, bh - 32, " Press any key! "
  sync
  wait key

  ShatterWipe(1,10,8,10)
  sync
loop

end

function DrawSomething(bmp,t)
  set current bitmap bmp : cls 0
  bw = bitmap width(bmp) : bh = bitmap height(bmp)
  for i = 1 to 1000
    ink rgb(rnd(255),rnd(255),rnd(255)),0
    if t = 0 then dot rnd(bw),rnd(bh)
    if t = 1 then line rnd(bw),rnd(bh),rnd(bw),rnd(bh)
    if t  = 2
      r = rnd(40) + 10
      ellipse rnd(bw),rnd(bh),r,r
    endif
  next i
endfunction


function ShatterWipe(bmp,columns,rows,speed)
  remstart
    bmp = source bitmap to be displayed in bitmap 0 (bmp size must equal bitmap 0)

    columns, rows = number of divisions in bitmap. It's best to use values
    that can easily divide into width and height of bitmap (min 4, max 20)

    speed = how fast you want the blocks to fly
  remend

  if bitmap exist(bmp) and bmp > 0
    bw = bitmap width(0) : bh = bitmap height(0)

    if bw = bitmap width(bmp) and bh = bitmap height(bmp)
      if columns < 4 then columns = 4
      if columns > 20 then columns = 20
      if rows < 4 then rows = 4
      if rows > 20 then rows = 20
      if speed < 1 then speed = 1

      spritetotal = columns * rows
      spritewidth = bw / columns
      spriteheight = bh / rows
      leftedge = 0 - spritewidth
      topedge = 0 - spriteheight
      dim xd(spritetotal) : dim yd(spritetotal)

      sx = 0 : sy = 0
      for i = 1 to spritetotal
        s = 65536 - i

        rem --- set sprite
        get image s, sx, sy, sx + spritewidth, sy + spriteheight, 1
        sprite s, sx, sy, s
        set sprite s, 1, 0

        inc sx, spritewidth
        if sx >= bw
          sx = 0
          sy = sy + spriteheight
        endif

        rem --- set direction speed and rotation speed of sprite
        repeat : xd(i) = (rnd(speed*2) - speed) : until abs(xd(i)) > speed / 2
        repeat : yd(i) = (rnd(speed*2) - speed) : until abs(yd(i)) > speed / 2
      next i

      copy bitmap bmp,0
      spritesoffscreen = 0

      rem <-- Play sound here

      rem --- Ok, here we go! Loops until all blocks are off screen
      repeat
        for i = 1 to spritetotal
          s = 65536-i

          if sprite exist(s)
            rem --- update sprite position
            sx = sprite x(s) + xd(i)
            sy = sprite y(s) + yd(i)
            sprite s, sx, sy, s

            rem --- if sprite off screen then delete it
            if sx > bw or sx < leftedge or sy > bh or sy < topedge
              delete sprite s
              delete image s
              spritesoffscreen = spritesoffscreen + 1
            endif

          endif
        next i

        sync
      until spritesoffscreen = spritetotal

      rem --- clean up and exit
      undim yd() : undim xd()

    endif
  endif

endfunction


...if not, don't worry, we'll get this thing to work