Author Topic: Helloworld for Freebasic  (Read 2768 times)

0 Members and 1 Guest are viewing this topic.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Helloworld for Freebasic
« on: January 27, 2007 »
here is.

I saw drawimage ( does it mean it is same as blitzbasic when used bitmap sprites?) as I just wondering as it doesnt show drawimage example in freebasic.

cheers

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Helloworld for Freebasic
« Reply #1 on: January 27, 2007 »
That's a solid fist try Graham :) Nice job, in fact you can have some Karma for that.

As far as image drawing is concerned, there are some functions in the freebasic graphics lib to do that for you.

Alpha etc is very easy to do.

This example was taken from the feeebasic help manual (press F1 in the editor), I've modified it slightly so that you need to press a key to exit..

Code: [Select]
OPTION explicit

   '' set screen mode
   SCREEN 15, 32
   
   '' allocate and draw to an image buffer
   DIM image_buffer AS ANY PTR
   image_buffer = ImageCreate( 64, 64, RGBA( 64, 160, 0, 255 ) )
   CIRCLE image_buffer, ( 32, 32 ), 28, RGBA( 255, 0, 0, 128 ),,,,F
   
   '' blit image buffer to screen
   PUT( 160, 120 ), image_buffer, PSET
   PUT( 180, 140 ), image_buffer, ALPHA
   
   '' free image buffer memory
   ImageDestroy( image_buffer )
   

   while inkey$=""
   wend
   end 0
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Helloworld for Freebasic
« Reply #2 on: January 31, 2007 »
it would be nice if freebasic have drawimage like blitzbasic even thought freebasic does have load of library such as SDL( I dont like it for some reason) and allergo( which is good)

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Helloworld for Freebasic
« Reply #3 on: January 31, 2007 »
Well, the good thing is that there is a library that you feel comfortable with using. If you like Allegro then more power to you. SDL is quite a popular library too. Optimus made a great demo with it called Keftedes.
Shockwave ^ Codigos
Challenge Trophies Won: