Using incbin

BlitzMax Forums/BlitzMax Beginners Area/Using incbin

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

How do you use incbin on both images and text files? I'm really confused what you're meant to do with it.

' This code uses inc-bin to get a small red image (5x5) in size and is meant to show the image on the screen.

Import brl.ramstream

Incbin "stars.png"

Global stars=LoadImage( "incbin::stars.png" )


Graphics 800, 600

While Not KeyHit(KEY_ESCAPE)	
      ' Clear the screen...

      Cls

      ' Store mouse position in these global variables...

      mx = MouseX ()
      my = MouseY ()

	DrawImage stars, mx, my

Wend


And how do you use incbin for text files? The below example is obviousily wrong, but the document and manual does not give any instructions or sample code on how to use it.

The text file just has three names, each on a seperate line (e.g. Tom, @#!*, Harry)

Import brl.ramstream

Incbin "names.txt"

Global names=ReadFile( "incbin::names.txt" )

Graphics 800, 600

While Not KeyHit(KEY_ESCAPE)	

   ' Clear the screen...	
	Cls
	
	' Store mouse position in these global variables...
	
	mx = MouseX ()
	my = MouseY ()
	
	DrawText names, mx, my

Wend
End


Any chance someone can put up a short tutorial or explain how to use incbin?

Many thanks!