I have some programming experience, as a child and a teenager I spent countless hours with GML with gamemaker 7, lua in 2008 roblox studio, I was taught VB.NET 2010 in middle school and as an adult I've messed around with both C and Pico8, although I wouldn't say I am a programmer by any stretch of the imagination, simply that I know how to bodge things together looking at an API reference manual..
Which leads me to my question, reading the documentation for HW, I can see that everything is based on events similar to VB.NET, but when reading through the documentation, the examples for the event-based code seem to be contridictory and mention legacy functions.
For example, here I have wrote a very basic paint program, however if you have a high enough DPI mouse, the application cannot reference the input quickly enough to draw a continious line as well as the increase of the size of the radius is not very stable.
Code: Select all
@DISPLAY {Title = "Whiteboard", X = #LEFT, Y = #TOP, Width = 640, Height = 480, Color = #WHITE, Sizeable = False}
SetFormStyle(#NORMAL)
SetFillStyle(#FILLCOLOR)
StartTimer(1)
X=64
Y=64
R=5
Function logic()
X=MouseX()
Y=MouseY()
If IsKeyDown("A") Or IsKeyDown("a") Then R = R + 1
If IsKeyDown("S") Or IsKeyDown("s") And R > 5 Then R = R - 1
;COLOUR
If IsKeyDown("C") Or IsKeyDown("c")
COLOUR = ColorRequest("Select a colour")
If COLOUR = -1
Print("Requester cancelled!")
EndIf
If IsKeyDown("N") Or IsKeyDown("n") Then Cls(#WHITE)
EndIf
EndFunction
Function redrawdisplay()
If IsLeftMouse() = True Then Circle(X,Y,R,COLOUR)
If IsRightMouse() = True Then Circle(X,Y,R,#WHITE)
EndFunction
Function p_MainLoop()
logic()
redrawdisplay()
EndFunction
SetInterval(1,p_MainLoop,1)
While IsKeyDown("ESC") = False
WaitEvent()
Wend
Any information would be greatly appricated.
[EDITED 2023/09/12 : Fixed a poor copy and paste job of code]