Task

Create a window and draw a pixel in it, subject to the following:

  the window is 320 x 240
  the color of the pixel must be red (255,0,0)
  the position of the pixel is x = 100, y = 100
' 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