Back to [APK_DOTNET_MAUI]
All graphics functions are in this file.
It's made with static members and functions instead of using a singleton.
So consider that before each member and function there is the word "static", but not here in the docs.
Use that instead of drawing directly with the MAUI engine, so that one only has to change this file when the rendering engine changes.
The MAUI GraphicsView component will be accessed with this canvas variable.
Don't use it outside of the GFX class. This holds all MAUI draw functions.
The display (respective GraphicsView) width (X) and height (Y).
This is used to draw only on the field of the lower screenSize parameter.
(It's used to make the playfield square.)
e.g. if screenSize.X > screenSize.Y then adjustScreen.X will be (screenSize.X - screenSize.Y)/2,
so that you can adjust the X coordinate to the center of the screen. adjustSize.Y is 0 then.
This will be this from the class instance calling initializeValues.
It's used only for DrawImage and because everything here is static.
This dictionary holds all the images which were already loaded once, so that it must not load the images in every draw call. The key is the path to the image.
This function gets called in the engine before the Draw function of cGame is called. It initializes all the above values.
- caller: set to "this" in the IDrawable.
- c: the MAUI canvas given in the draw function.
- graphicsWidth: Width of the viewport
- graphicsHeight: Height of the viewport
Returns screenSize
Returns adjustScreen
Set the MAUI canvas stroke color and size.
Use this before you draw any lines or something with border.
You must only use it once until color or size changes.
Sets the font used in DrawText(), and its color and size.
You must only set this once until font, color or size changes.
Draws the text text with the font, color and size set with setFont() centered in the rectangle from x, y to x+w, y+h.
Only use in IGame.onDraw() - Function
Draws a line from x1, y1 to x2, y2 with the color and line width set with setStroke.
Only use in IGame.onDraw() - Function
Draws a NOT FILLED rectangle from x, y to x+w, y+h with a border with the line width and color set with setStroke.
Only use in IGame.onDraw() - Function
Draws a rectangle from x, y to x+w, y+h, filled with the color fillcolor.
Only use in IGame.onDraw() - Function
Draws a NOT FILLED rectangle from x, y to x+w, y+h with the color and line width set with setStroke and round corners with the radius cornerRadius.
Only use in IGame.onDraw() - Function
Draws a rectangle from x, y to x+w, y+h filled with the color fillcolor and round corners with the radius cornerRadius.
Only use in IGame.onDraw() - Function
Draws a NOT filled circle with the color and line thickness set with setStroke at x, y with radius radius.
Draws a filled circle with the fillcolor at x, y with radius radius.
Only use in IGame.onDraw() - Function
Draws a "chess playfield" with fieldCountXY * fieldCountXY fields (X same as Y) from startx, starty to startx+width, starty+height in the colors color1 and color2.
Only use in IGame.onDraw() - Function
Draws the image at x, y in size w, h. If w or h are < 0 then it will use the size of the image respectively.
Only use in IGame.onDraw() - Function
DO NOT USE THIS FUNCTION. USE THE ONE BELOW.
Loads the image at imagepath into the imageDict dictionary if it is not already loaded.
Draws the image from the imageDict dictionary with key imagepath at x, y in the size w, h. If w or h is < 0 then it will use the image size respectively.
Only use in IGame.onDraw() - Function
Clears all the images in the dictImages-Dictionary.
Returns how many images are in the dictImages-Dictionary.