i'm trying to figure is there a way to read a whole text file and just print it "drawtext()" it on the screen so it will be displayed exactly as it is in the text file...
here is a text file for a test:
Code: Select all
hello this is a test....
how are you doing?
hello this is a test
this is a teast To Read file text
And print it on screen
end :)
Code: Select all
#Window_Main = 0
#Screen_Width = 800
#Screen_Height = 600
InitKeyboard()
InitSprite()
OpenWindow(#Window_Main, 0, 0, #Screen_Width, #Screen_Height, "Snake", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window_Main), 0, 0, #Screen_Width, #Screen_Height, #True, 0, 0)
Procedure.s FileToVar(File$)
ReadFile(0, File$)
While Not Eof(0)
VarString$ + ReadString(0) + #CRLF$ ; #CRLF$ is a line break
Wend
ProcedureReturn VarString$
EndProcedure
buffer.s = FileToVar("test2.txt")
Repeat
; Repeat
; Define Event = WindowEvent()
; Select Event
; Case #PB_Event_CloseWindow
; End
; EndSelect
; Until Event = 0
If StartDrawing(ScreenOutput())
DrawText(0,0,buffer)
StopDrawing()
EndIf
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
