Linux 2d drawing tutorials

Linux specific forum
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Linux 2d drawing tutorials

Post by nessie »

Hello,

Does anyone know where there are some tutorials for 2d drawing in linux or possibly some source. I know Paul at reelmedia has released some games for download but there isn't any source, so all it done was wet my appetite a little more :roll:
The_Pharao
User
User
Posts: 57
Joined: Sun Jan 04, 2004 2:11 pm

Post by The_Pharao »

can you give a link to those games?
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

Hostile Skies:
http://www.reelmedia.org/hs/

Tributoids:
http://www.reelmedia.org/tributoids/

Lady's Garden:
http://www.reelmedia.org/lady/

I compiled on both Windows and Linux to see how easy it was to compile code cross platform. Obviously it works great !! :)
Image Image
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

So anyway, getting back to the turotrials, anybody have any ideas........anybody........hello :cry:
The_Pharao
User
User
Posts: 57
Joined: Sun Jan 04, 2004 2:11 pm

Post by The_Pharao »

well, look at the sprite.pb example code. or at the waponezII.pb example code.
basically, 2d drawing with purebasic is the same under windows and linux.
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

I've looked at them, and PB under Linux isn't like PB under Windows otherwise I wouldn't be asking. If I use a bit of code that works under windows, I get an sdl parchute being deployed under Linux. :roll:
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

You have the sdl-devel package installed??
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

Do I 8O as you can see, I'm newer than a new thing when it comes to Linux, but that wasn't my descision. Anyway, when I run some code on a Win32 system it runs just fine. but when I run it on Linux I get the error : Fatal signal: Segmentation Fault (SDL Parachute Deployed)

so is the fault with the code or is the fault with SDL. or could it be something else !!
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Ok, try to compile the SDL.pb example in the examples directory.

If that is failing too, it's because you do not have SDL_Dev package installed.

What linux distribution are you using !?
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Only time I've come across this error was when I tried to compile
some code with SDL sound,on a machine without soundcard..
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

The SDL.pb run just fine, and although the server doesn't have a soundcard fitted, the code itself doesn't use sound. Here's the code

Code: Select all

; German forum: 
; Author: Rings + Ses007
; Date: 23. July 2002


Procedure FlashText(Text.s,XPos,YPos,FontName.s,Fontsize,DelayTime, FontColour)

LoadFont(1, FontName, Fontsize)
 
For i=1 To 255 Step 3
   StartDrawing(ScreenOutput())
   UseFont(1)
   DrawingMode(1)
   DrawingFont(FontID())
   FrontColor((Red(FontColour)/255*i), (Green(FontColour)/255*i), (Blue(FontColour)/255*i))
   Locate (XPos,YPos)
   DrawText(Text)
   StopDrawing()
   FlipBuffers()
   If IsScreenActive()
     ClearScreen(0,0,0)
   EndIf
  Delay(1)
Next i
Delay(DelayTime)
 
 
For i=255 To 1 Step -6
 
   StartDrawing(ScreenOutput())
   UseFont(1)
   DrawingMode(1)
   DrawingFont(FontID())
   FrontColor((Red(FontColour)/255*i), (Green(FontColour)/255*i), (Blue(FontColour)/255*i))
   Locate (XPos,YPos)
   DrawText(Text)
   StopDrawing()
   FlipBuffers()
   If IsScreenActive()
     ClearScreen(0,0,0)
   EndIf

  Delay(1)
Next

CloseFont(1)
EndProcedure


If InitSprite() = 0
MessageRequester("Fehler", "Konnte DirectX nicht finden", 0)
End
EndIf


OpenScreen(800, 600, 16, "Netter Effeckt")

FlashText("It ...", 250, 300, "ARIAL", 40, 2000, RGB(0, 0, 255))

FlashText("... could be ...", 250, 300, "ARIAL", 40, 2000, RGB(0, 255, 255))

FlashText("... done by ...", 250, 300, "ARIAL", 40, 2000, RGB(255, 125, 255))

FlashText("Purebasic", 250, 300, "ARIAL", 60, 3000, RGB(255, 255, 255))

End

As you can see, it's just displaying some text and it runs in windows with no trouble. I'm Running Red Hat 9.0
[Edit]

SDL doesn't like the command Drawingfont(fontid())
The_Pharao
User
User
Posts: 57
Joined: Sun Jan 04, 2004 2:11 pm

Post by The_Pharao »

Code: Select all

sh-3.00$ pbcompiler test.pb

******************************************
PureBasic Linux x86 v3.91
******************************************

Loading external modules...
Starting compilation...
69 lines processed.
Creating the executable.

- Feel the ..PuRe.. Power -

sh-3.00$ Fatal signal: Segmentation Fault (SDL Parachute Deployed)

sh-3.00$                      
mmmm.... your code doesn't work here either. fred should have a look at this i guess.

@Paul:
did you get my code?
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

Taken from the PB v3.91 (Linux) TODO:

2DDrawing:
DrawingMode(): not supported
DrawImage(): not supported

*EDIT: And I can find the LoadFont() Command in the help file
BUT it say: Windows, AmigaOS at the bottom..

*EDIT2: Have a look here:viewtopic.php?t=11848&highlight=loadfont
Seems the fontname and stuff in linux are a bit different..

Anyway.. That's what wrong in your source. LoadFont() fails,
and then there's no FontID() etc..
nessie
User
User
Posts: 60
Joined: Mon Jul 07, 2003 1:19 pm
Location: Glasgow / Scotland
Contact:

Post by nessie »

you are right, however, can someone give me a small example of drawing some large sized text on the screen, as I just can't get my head rounf the fontname and size !!!
I can get it displaying text but can't change the size of the text.
Author Message
@ olejr : thanks for pointing me in the right direction

& @ fred: any update on this as it was reported over 4 months ago !!
olejr
Enthusiast
Enthusiast
Posts: 152
Joined: Sun Jul 11, 2004 7:48 pm
Location: Lillehammer, No(r)way
Contact:

Post by olejr »

If you do something like:

Code: Select all

Fontrequester("", "", 0)
..
..
FlashText("SomeString", 250, 300, SelectedFontName(), SelectedFontSize(), 2000. RGB(0, 0, 255))
..
Then you pass a proper name/size in anyway..

To bad it doesn't work.. :cry:

The name/size is simply ignored....!?

PS. v3.92 is in (closed) beta, so (I hope) it won't be to long before it's out..
Post Reply