Questions:
1- how to make it continuously update the display? right now it's static.
2- how to ensure it's properly centered regardless of screen resolution?
3- do you like it? feel free to add cool effects or features.
Sorry for the messy, messy code. It's just an experiment....
Code: Select all
ExamineDesktops() : screenwidth=DesktopWidth(0) : screenheight=DesktopHeight(0)
Global f$ ; (79*23)
Procedure.s BuildPixelString(String$, Char$="*", Length.i=0, font.i=#PB_Ignore) ;;; by infratec
Protected Result$, Line$
Img = CreateImage(#PB_Any, 1, 1)
StartDrawing(ImageOutput(Img))
DrawingFont(FontID(font))
StringWidth = TextWidth(String$)
StringHeight = TextHeight(String$)
StopDrawing()
Img = CreateImage(#PB_Any, StringWidth, StringHeight)
StartDrawing(ImageOutput(Img))
DrawingFont(FontID(font))
DrawText(1, 0, String$, $FFFFFF)
For y = 0 To StringHeight - 1
Line$ = ""
For x = 0 To StringWidth - 1
If Point(x, y) = 0
Line$ + " "
Else
Line$ + Char$
EndIf
Next x
If Length
Line$ = LSet(Line$, Length, " ")
EndIf
Result$ + Line$ + #CRLF$
Next y
StopDrawing()
ProcedureReturn Result$
EndProcedure
Procedure pixelON(X,Y)
ProcedureReturn Asc(Mid(f$,Y*79+X,1))
EndProcedure
LoadFont(0, "Consolas", 16)
now$ = " " + FormatDate("%hh:%ii",Date())
f$ = BuildPixelString(now$, "*", 79, 0) ;; Disclosure
f$ = RemoveString(f$, #CRLF$)
InitSprite() : OpenCryptRandom()
Define.i DefSize=66*24, C = $52BF52 + $111111, Cellsize = 16, Quit = 0
OpenWindow(0, 0, 0, screenwidth, screenheight, "DigitOcean", #PB_Window_BorderLess | #PB_Window_Invisible )
OpenWindowedScreen(WindowID(0),0,0,screenwidth,screenheight,1,0,0)
CreateSprite(0, screenwidth, screenheight, #PB_Sprite_AlphaBlending)
LoadFont(9,"Consolas",10)
StartDrawing(SpriteOutput(0)) : DrawingFont(FontID(9))
DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient | #PB_2DDrawing_Transparent )
For a = 0 To DefSize-Cellsize Step 16
For b = 0 To DefSize-Cellsize Step 16
; color = random(C)*1.3+(a+b)*3
color = C*0.8 + Random ((a+b)*8)
; BackColor(RGBA(Red(color)-$23, Green(color)-$23, Blue(color)-$23, 255))
FrontColor(RGBA(Red(color)-$23, Green(color)-$23, Blue(color)-$23, 190))
; LinearGradient(a, b, a+30, b+30)
If PixelON(a/16,b/16) = 42 : DrawText(a+1,b+1+132, RSet(Hex(CryptRandom(255)),2,"0") ) : EndIf
Next
Next
StopDrawing() : HideWindow(0,0)
Repeat
Repeat
ev = WindowEvent()
If EventwParam() = #VK_ESCAPE : Quit = 1 : EndIf
If ev = #PB_Event_CloseWindow : Quit = 1 : EndIf
Until ev = 0
DisplaySprite(0, 0, -4)
FlipBuffers()
Until Quit = 1