✅ Coordinates of Avalonia vs Scratch

Hey there: ok, so I have a window with a width of 480 and height of 360. I am using a Scratch Project and I am trying to convert it to an Avalonia Project, but the thing is I can´t find a way to make exact coordinates. I don´t know how the coordinates of avalonia work. And what is the big difference betweeen the centered coordinate system (from Scratch) (where 0|0 is in the middle) and avalonia, because I can´t find a way to "convert" it right :(. Thanks for help in advance :).
9 Replies
Jimmacle
Jimmacle4w ago
scratch like MIT scratch? you basically never want to use exact coordinates in GUI applications, it's not responsive to window size or other layout changes
Jimmacle
Jimmacle4w ago
but if you must, this is probably want you want https://docs.avaloniaui.net/docs/reference/controls/canvas
Canvas | Avalonia Docs
REFERENCE - Built-in Controls
Daiko Games
Daiko GamesOP4w ago
But what is the best thing to do in my situation. Is it Canvas or something else - I rrly rrly don‘t understand. Yes MIT Scratch :-/. @Jimmacle
Jimmacle
Jimmacle4w ago
i don't really know what your situation is user interface elements should use relative layouts like grids/panels/etc if you want to put game sprites in the window that you move around by exact amounts then canvas is what you want
Daiko Games
Daiko GamesOP4w ago
The thing is the coordinates are different. Scratch uses a centered coordinate System, sprites can Move but I can implement that once I understand the difference on what I have to change to the coordinates. Is there really nothing specified for specific points?
Jimmacle
Jimmacle4w ago
there are things specified, in the documentation i linked
Daiko Games
Daiko GamesOP4w ago
Ok I will look into that. Hopefully with that I can find out what the big differences are 0_0 thx btw
Jimmacle
Jimmacle4w ago
i mean, the only difference is that you specify the positions relative to the edges of the canvas rather than the center
Daiko Games
Daiko GamesOP4w ago
O_O litreally that is the thing i have been trying to find out for the past few days 🙂 i will look into it thx IT WORKS, thanks you just helped me A LOT, 🙂 i am making a converter btw. that converts Scratch Projects to Avalonia - this step was really essential thanks 🙂 i know i didn´t state that lol, anyways I will close this help 🙂 thanks mate 🙂 @Jimmacle

Did you find this page helpful?