c# - Draw Rectangle in MonoGame -
How do you draw shapes in mono games, such as rectangular and circles, save a preceding shape in the content folder?
DrawRectangle () and DrawEllipse () are for Windows Forms and do not work in OpenGL, which is what I am using.
"text">
Using 3D primitives and 2D projection
is a simple example with explanation I have a 10x10 I define the rectangle and set the world matrix to make it look like a 2D projection: Note: Then I draw the whole thing: D There your rectangle is there! Now it Or as mentioned in the above steps, you can use a shider instead ... I'm coming first and need to scanning this shider: < P> As you can see in the post a superheripas not only pulls the oval but other sizes and perhaps the circles (I did not test) so that you can take an interest in it. Eventually, you will want some sections / methods to hide all of these details so that you just Tip: By posting you will get more answers for monogame-related questions : D BasicEffect that draws your primitive
su Protected Override Zero Load Contents () {_vertexPositionColors = new [] {New Vertxposition Collar (New Vector 3 (0, 0, 1), Color. White), New VertixPopiapolar (New Vector 3 (10, 0, 1), Color. White), New VertexPaPaPolar (new vector 3 (0, 10, 1), color. White), new vortexation collar (new vector 3 (0, 10, 1), color. White)}; _basicEffect = new basic incomplete ( Graphics device); _basicEffect.World = Matrix.CreateOrthographicOffCenter (0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1); }
Secure Override Zero Draw (GameTime GameTime) {GraphicsDevice.Clear (Color.CornflowerBlue); Infotechnical EffectsTechnic = _basicEffect.Techniques [0]; ImpactPasswordPrintPashControl = EffectTechnic.pass; Foresh (Effect with Effect Pass Pass) {Pass. Applicable (); Graphics Device. Drawer Pritimitivs (Premit Type. Linestrip, _WorTexProject Corollor, 0, 4); } Base.Draw (gametime); }
DrawCircle () .
Comments
Post a Comment