Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FreeBasic forum and examples/previews quicklist
#31
Win2k comes with DX6, I think... depends on the SP. Which version of DX is needed?
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#32
i just did the first completely selfwritten "game" in freebasic hehe... nah j/k, i was doing some work on qbgfx that is a 60% qb gfx commands legacy library, more or less the smaller brother of sterlings upcoming qb gfx lib and had to test it so i did that stupid game you all know tron:

Code:
'$include: 'inc\qbgfx.bi'

type player
  x as integer
  y as integer
  vx as integer
  vy as integer
  col as integer
  lkey as integer
  rkey as integer
end type

dim p(0 to 1) as player

cls

screen 320, 200, 16, 0
gcls 0

p(0).x = 30
p(0).y = 100
p(0).vx = 1
p(0).vy = 0
p(0).col = gcolor(255,0,0)
p(0).lkey=asc("k")
p(0).rkey=asc("l")
p(1).x =290
p(1).y = 100
p(1).vx = -1
p(1).vy=0
p(1).col = gcolor(0,255,0)
p(1).lkey=asc("a")
p(1).rkey=asc("d")


do

  key$ = inkey$

  for i = 0 to 1

    if asc(key$)=p(i).lkey then
      p(i).vx = -p(i).vx
      swap p(i).vx, p(i).vy
    end if

    if(asc(key$)=p(i).rkey) then
      p(i).vy = -p(i).vy
      swap p(i).vx, p(i).vy
    end if


    p(i).x = p(i).x+p(i).vx
    p(i).y = p(i).y+p(i).vy

    if(p(i).y < 0) then p(i).y = 199
    if(p(i).y > 199) then p(i).y = 0
    if(p(i).x < 0) then p(i).x = 319
    if(p(i).x > 319) then p(i).x = 0

    if(point(p(i).x, p(i).y ) <> 0) then
      print "player" + str(i+1) + " has lost"
      end
    end if

    pset p(i).x, p(i).y, p(i).col
  next i

  'call me nasty plz
  for i = 0 to 1000000
  next i

  flip
loop while key$<>chr$(27)

you can download that crap plus the source at http://ratatoskr.bad-logic.com/fb/tron.

if you want to compile it yourself you have to download libqbgfx.a and libsdlgfx.a from that site. just copy them into the lib directory of fb. next thing you'll need is qbgfx.bi, again download copy to inc directory.

then a simple fbc32 tron.bas and everything should work fine.

note for running that crap you need sdl.dll either in the directory the exe lies or in c:\windows\system32

greetings
quote="NecrosIhsan"]
[Image: yagl1.png]
[/quote]
Reply
#33
Quote:Nah, "DX" makes sense. The library computers are all pentium 4's with win2k, so they probably don't have dx.

Well then, any thoughts?

Aw... Marzec. SDL :*(

So every PSET locks and unlocks after that? Then again, I don't see any way other than SDL to do a good keyboard handler.

Good Job!!
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#34
hey forgive me about using sdl, but ptc has so many build in restrictions conceringn the message queue i'd have to manipulate the ptc source itself. got no time for that.

on that locking thing. well you could try the following. make the backbuffer software, that reduces the speeddecrease that comes with locking. though i don't think it will be really noticeable. sdl is not bad after all, just don't use 8-bit modes cause they suck and cause i say so hehe....

stay tuned for sterlings fullblown qb gfx implementation, i guess this will really be kwel (if he ever finishes it)
quote="NecrosIhsan"]
[Image: yagl1.png]
[/quote]
Reply
#35
It would be wise for you to add another command like Lockpage, unlockpage so that per pixel renders need not be slow. Or just make a function that returns the SDL_surface for pixel manipulations.

After making my first simple SDL proggie and it working like slower than the VGA lib I made in just plain FB code, I'm really not looking forward in using SDL in the future except for input.

It's a pity its slow on my system cuz SDL by far is very easy to learn. :*(

I hope Sterling would finish it. :*)

BTW, what is the status of your SDL port? I may not be able to use it but guys with better vid cards would have a better time coding 2d and 3d with SDL.
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#36
Rel:
Have you opened a page of your site lately?
Some stupid has thrashed your logo!
Antoni
Reply
#37
Yeah, someone oughta get that dastardly... handsome... bastard...
Reply
#38
Rel, the problem is not SDL, DX surface locking/unlocking is too slow if you do that per pixel, Sterling is implementing GET/PUT for the gfx lib, so you could allocate an array as you are doing now with tinyPTC, do all rendering on that array and then blit/PUT it on the back-buffer, doing next a call to FLIP (you can't draw directly to frame buffer in DX, primary surface locking can fail in some cards). So there will be the same number of surface locks as in tinyPTC, no slowdown.

Btw, you can use inkey$ already, only difference is that for extended key codes the first char returned will be 255, not 0 - 0 is the null-term char, can't be part of strings.
Reply
#39
Inline ASM. Woot!!!!
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#40
DirectDraw test, using function pointers (just added them yesterda y ;): http://freebasic.bad-logic.com/downloads/ddrawtest.zip

Press ESC to exit..

Code looks hard to read and it really is, DX even with OO isn't too simple, with COM interfaces used ala C then.. nm
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)