Page 1 of 2
Linux 2d drawing tutorials
Posted: Mon Dec 06, 2004 4:29 pm
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:
Posted: Mon Dec 06, 2004 5:08 pm
by The_Pharao
can you give a link to those games?
Posted: Mon Dec 06, 2004 6:26 pm
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 !!

Posted: Tue Dec 07, 2004 11:05 pm
by nessie
So anyway, getting back to the turotrials, anybody have any ideas........anybody........hello

Posted: Wed Dec 08, 2004 7:16 am
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.
Posted: Wed Dec 08, 2004 9:16 am
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:
Posted: Wed Dec 08, 2004 11:54 am
by olejr
You have the sdl-devel package installed??
Posted: Wed Dec 08, 2004 4:25 pm
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 !!
Posted: Wed Dec 08, 2004 4:58 pm
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 !?
Posted: Wed Dec 08, 2004 6:26 pm
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..
Posted: Wed Dec 08, 2004 7:43 pm
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())
Posted: Wed Dec 08, 2004 8:01 pm
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?
Posted: Wed Dec 08, 2004 8:48 pm
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..
Posted: Wed Dec 08, 2004 11:50 pm
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 !!
Posted: Thu Dec 09, 2004 12:52 am
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..
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..