RosettaCodeData/Task/Draw-a-pixel/FreeBASIC/draw-a-pixel.basic

29 lines
641 B
Plaintext

' version 27-06-2018
' compile with: fbc -s console
' or: fbc -s gui
Screen 13 ' Screen 18: 320x200, 8bit colordepth
'ScreenRes 320, 200, 24 ' Screenres: 320x200, 24bit colordepth
If ScreenPtr = 0 Then
Print "Error setting video mode!"
End
End If
Dim As UInteger depth, x = 100, y = 100
' what is color depth
ScreenInfo ,,depth
If depth = 8 Then
PSet(x, y), 40 ' palette, index 40 = RGB(255, 0, 0)
Else
PSet(x, y), RGB(255, 0, 0) ' red
End If
' empty keyboard buffer
While Inkey <> "" : Wend
WindowTitle IIf(depth = 8, "Palette","True Color") + ", hit any key to end program"
Sleep
End