Here are the examples of the csharp api Microsoft.Xna.Framework.Game.Draw(Microsoft.Xna.Framework.GameTime) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
59 Examples
19
Source : Game1.cs
with MIT License
from craftworkgames
with MIT License
from craftworkgames
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
_spriteBatch.Begin();
_spriteBatch.DrawString(_spriteFont, "Hello MonoGame!", new Vector2(100, 100), Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from craftworkgames
with MIT License
from craftworkgames
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
// background
var sourceRectangle = new Rectangle(0, 0, _viewportAdapter.VirtualWidth, _viewportAdapter.VirtualHeight);
sourceRectangle.Offset(_camera.Position * new Vector2(0.1f));
_spriteBatch.Begin(samplerState: SamplerState.PointWrap, transformMatrix: _viewportAdapter.GetScaleMatrix());
_spriteBatch.Draw(_backgroundTexture, Vector2.Zero, sourceRectangle, Color.White);
_spriteBatch.DrawString(_font, $"{_score}", Vector2.One, Color.White);
_spriteBatch.End();
// enreplacedies
_spriteBatch.Begin(samplerState: SamplerState.PointClamp, blendState: BlendState.AlphaBlend, transformMatrix: _camera.GetViewMatrix());
_enreplacedyManager.Draw(_spriteBatch);
_spriteBatch.End();
_spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : GameMain.cs
with MIT License
from craftworkgames
with MIT License
from craftworkgames
protected override void Draw(GameTime gameTime)
{
_world.Draw(gameTime);
base.Draw(gameTime);
}
19
Source : GameMain.cs
with MIT License
from craftworkgames
with MIT License
from craftworkgames
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
_fpsCounter.Draw(gameTime);
Window.replacedle = $"{_currentDemo?.Name} {_fpsCounter.FramesPerSecond}";
base.Draw(gameTime);
_currentDemo?.OnDraw(gameTime);
_guiSystem.Draw(gameTime);
}
19
Source : MainGame.cs
with MIT License
from craftworkgames
with MIT License
from craftworkgames
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
_spriteBatch.Begin(samplerState: SamplerState.PointClamp);
_spriteBatch.FillRectangle(Linear.X, Linear.Y, Size.X, Size.X, Color.Red);
_spriteBatch.FillRectangle(Quadratic.X, Quadratic.Y, Size.X, Size.X, Color.Green);
_spriteBatch.FillRectangle(Exponential.X, Exponential.Y, Size.X, Size.X, Color.Blue);
_spriteBatch.FillRectangle(Bounce.X, Bounce.Y, Size.X, Size.X, Color.DarkOrange);
_spriteBatch.FillRectangle(Back.X, Back.Y, Size.X, Size.X, Color.Purple);
_spriteBatch.FillRectangle(Elastic.X, Elastic.Y, Size.X, Size.X, Color.Yellow);
_spriteBatch.DrawString(_bitmapFont, $"{_tweener.AllocationCount}", Vector2.One, Color.WhiteSmoke);
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game.cs
with MIT License
from dotnet-ad
with MIT License
from dotnet-ad
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
var borders = new Color(1.0f, 1.0f, 1.0f, 0.2f);
// Full texture
spriteBatch.Draw(this.sheet.Texture, new Vector2(0, 0));
spriteBatch.DrawRectangle(this.sheet.Texture.Bounds, borders);
// Animation
spriteBatch.Draw(this.anim, new Vector2(64, 64 + this.sheet.Texture.Height));
this.font.Draw(spriteBatch, new Vector2(12, 12 + this.sheet.Texture.Height), $"{animIndex}", Color.White);
// Frames in full texture
for (int ia = 0; ia < anim.Frames.Length; ia++)
{
var a = anim.Frames[ia];
spriteBatch.DrawRectangle(a.Area, borders);
spriteBatch.DrawCross(a.Area.Location.ToVector2() + a.Origin.ToVector2(), borders);
this.font.Draw(spriteBatch, a.Area.Location.ToVector2() + new Vector2(4, 4), $"{ia}", borders);
}
//Mouse
const int mouseGrid = 16;
var mx = (this.state.X / mouseGrid) * mouseGrid;
var my = (this.state.Y / mouseGrid) * mouseGrid;
spriteBatch.DrawLine(0, my, this.GraphicsDevice.Viewport.Width, my, Color.Green);
spriteBatch.DrawLine(mx, 0, mx, this.GraphicsDevice.Viewport.Height, Color.Blue);
this.font.Draw(spriteBatch, new Vector2(mx, my) + new Vector2(32,32), $"({mx},{my})", borders);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Sample.cs
with MIT License
from dotnet-ad
with MIT License
from dotnet-ad
protected override void Draw(GameTime gameTime)
{
graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
this.spriteBatch.Begin();
this.arm.Draw(this.spriteBatch);
this.spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Engine.cs
with MIT License
from egordorichev
with MIT License
from egordorichev
protected override void Draw(GameTime gameTime) {
var t = DateTime.Now.Millisecond;
StateRenderer.Render();
base.Draw(gameTime);
RenderTime = DateTime.Now.Millisecond - t;
}
19
Source : FrmMapRender2.cs
with MIT License
from Elem8100
with MIT License
from Elem8100
protected override void Draw(GameTime gameTime)
{
opacity = MathHelper.Clamp(opacity, 0f, 1f);
if (opacity <= 0)
{
this.GraphicsDevice.Clear(Color.Black);
}
else
{
if (prepareCapture)
{
Capture(gameTime);
}
this.GraphicsDevice.Clear(Color.Black);
if (this.mapData != null)
{
DrawScene(gameTime);
DrawTooltipItems(gameTime);
}
this.ui.Draw(gameTime.ElapsedGameTime.TotalMilliseconds);
this.tooltip.Draw(gameTime, renderEnv);
if (opacity < 1f)
{
this.renderEnv.Sprite.Begin(blendState: BlendState.NonPremultiplied);
var rect = new Rectangle(0, 0, this.renderEnv.Camera.Width, this.renderEnv.Camera.Height);
this.renderEnv.Sprite.FillRectangle(rect, new Color(Color.Black, 1 - opacity));
this.renderEnv.Sprite.End();
}
}
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from fairygui
with MIT License
from fairygui
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(new Color(0xFF333333));
// TODO: Add your drawing code here
base.Draw(gameTime);
}
19
Source : GameExample.cs
with MIT License
from Felsir
with MIT License
from Felsir
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
//First we render the game, as one would normally.
//the rendertarget is the one in the Monolights clreplaced, it is used to process the light effect later.
GraphicsDevice.SetRenderTarget(_monoLights.Colormap);
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
spriteBatch.Draw(_diffuse, new Rectangle(0, 0, 640, 480), Color.White);
spriteBatch.End();
//Next we draw the game again, except the graphics use the normalmap data.
GraphicsDevice.SetRenderTarget(_monoLights.Normalmap);
spriteBatch.Begin();
spriteBatch.Draw(_normal, new Rectangle(0,0,640,480), Color.White);
spriteBatch.End();
//Finally draw the combined scene.
//the rendertarget is now 'null' to draw to the backbuffer. You can also draw to a rendertarget of your own if you want to postprocess it.
_monoLights.Draw(null, spriteBatch, new Rectangle(0,0,640,480));
//The last drawcall is any HUD stuff, things that are not affected by the lights.
spriteBatch.Begin();
DrawDebugtext(spriteBatch);
spriteBatch.End();
//Debug: show the rendertargets in the Monolights clreplaced.
if(_drawDebugTargets)
_monoLights.DrawDebugRenderTargets(spriteBatch);
//used to calculate the framerate.
++_drawCount;
base.Draw(gameTime);
}
19
Source : PhysicsGame.cs
with MIT License
from george7378
with MIT License
from george7378
protected override void Draw(GameTime gameTime)
{
// Preplaced 1: Draw the shadow map
GraphicsDevice.SetRenderTarget(_shadowMapRenderTarget);
GraphicsDevice.Clear(Color.White);
DrawSceneShadowMap();
// Preplaced 2: Draw the scene
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);
DrawScene();
base.Draw(gameTime);
}
19
Source : TerrainGame.cs
with MIT License
from george7378
with MIT License
from george7378
protected override void Draw(GameTime gameTime)
{
// Preplaced 1: Draw the water refraction map
GraphicsDevice.SetRenderTarget(_waterRefractionMapTarget);
GraphicsDevice.Clear(Color.Black);
DrawTerrain(false, new Vector4(-_waterClipPlane.Normal, _waterClipPlane.D + 1));
// Preplaced 2: Draw the water reflection map
GraphicsDevice.SetRenderTarget(_waterReflectionMapTarget);
GraphicsDevice.Clear(Color.CornflowerBlue);
DrawTerrain(false, new Vector4(_waterClipPlane.Normal, _waterClipPlane.D), _waterReflectionMatrix);
// Preplaced 3: Draw the scene
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.CornflowerBlue);
DrawTerrain();
DrawWaterPlane();
base.Draw(gameTime);
}
19
Source : Game1.cs
with BSD 3-Clause Clear License
from hozuki
with BSD 3-Clause Clear License
from hozuki
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
// https://stackoverflow.com/questions/33977226/drawing-bezier-curves-in-monogame-xna-produces-scratchy-lines ?
_drawingContext.FillGeometry(_brush1, _pathGeometry1);
_drawingContext.FillGeometry(_brush2, _pathGeometry2);
_drawingContext.FillGeometry(_brush3, _pathGeometry3);
_drawingContext.FillGeometry(_brush4, _ellipseGeometry4);
_drawingContext.FillGeometry(_brush5, _roundedRectangleGeometry5);
_drawingContext.FillGeometry(_brush6, _ellipseGeometry6);
_drawingContext.PushTransform();
_drawingContext.Translate(0, _font.Size);
_drawingContext.FillGeometry(_brush6, _fontPathGeometry7);
_drawingContext.PopTransform();
var fps = 1 / gameTime.ElapsedGameTime.TotalSeconds;
Window.replacedle = "FPS: " + fps.ToString("0.00");
base.Draw(gameTime);
}
19
Source : Game1.cs
with BSD 3-Clause Clear License
from hozuki
with BSD 3-Clause Clear License
from hozuki
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
_spriteBatch.Begin();
_spriteBatch.Draw(_graphics.BackBuffer, Vector2.Zero, Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with BSD 3-Clause Clear License
from hozuki
with BSD 3-Clause Clear License
from hozuki
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.Black);
// TODO: Add your drawing code here
spriteBatch.Begin();
const string content = "This is line 1\nGreetings everyone\nHashtag # works yay\n还有中文测试";
const float left1 = 0, left2 = 400;
spriteBatch.DrawString(_spriteFont, "Mouse location: " + _mouseState.Position, new Vector2(left1, 0), Color.White);
spriteBatch.DrawString(_spriteFont, "Max bounds: " + _maxBounds, new Vector2(left2, 0), Color.White);
spriteBatch.DrawString(_spriteFont, "Fixed line height:", new Vector2(left1, 60), Color.Blue);
var size1 = spriteBatch.DrawString(_spriteFont, content, new Vector2(left1, 100), _maxBounds, 1, 30, Color.White);
spriteBatch.DrawString(_spriteFont, "Measured size: " + size1, new Vector2(left1, 240), Color.Green);
spriteBatch.DrawString(_spriteFont, "Minimized line height:", new Vector2(left2, 60), Color.Yellow);
var size2 = spriteBatch.DrawString(_spriteFont, content, new Vector2(left2, 100), _maxBounds, new Vector2(1, 1), Color.White);
spriteBatch.DrawString(_spriteFont, "Measured size: " + size2, new Vector2(left2, 240), Color.Green);
var fps = 1 / (float)gameTime.ElapsedGameTime.TotalSeconds;
spriteBatch.DrawString(_spriteFont, "FPS: " + fps.ToString("0.00"), new Vector2(left1, 300), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with BSD 3-Clause Clear License
from hozuki
with BSD 3-Clause Clear License
from hozuki
protected override void Draw(GameTime gameTime) {
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
var videoTexture = _videoPlayer.GetTexture();
_spriteBatch.Begin();
var destRect = new Rectangle(0, 0, WindowWidth, WindowHeight);
_spriteBatch.Draw(videoTexture, destRect, Color.White);
_spriteBatch.End();
_spriteBatch.Begin(blendState: BlendState.NonPremultiplied);
_spriteBatch.Draw(_helpTexture, Vector2.Zero, Color.White);
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : HotloadGame.cs
with MIT License
from jackmott
with MIT License
from jackmott
protected override void Draw(GameTime gameTime)
{
hotloader.Draw(spriteBatch, gameTime);
base.Draw(gameTime);
}
19
Source : Client.cs
with Apache License 2.0
from JohnLamontagne
with Apache License 2.0
from JohnLamontagne
protected override void Draw(GameTime gameTime)
{
Engine.Services.Get<LightManagerService>().Component.BeginDraw();
GraphicsDevice.Clear(Color.Black);
_spriteBatch.Begin(SpriteSortMode.FrontToBack, null, null, null, null, null, _camera.GetTransformation());
Engine.Services.Get<SceneManager>().Draw(gameTime, _spriteBatch);
// The cursor should always be the foremost visible
_spriteBatch.Draw(_cursorSprite, _cursorPos, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1);
_spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with GNU General Public License v3.0
from JonMagon
with GNU General Public License v3.0
from JonMagon
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin();
try
{
gameMap.DrawMap(camera);
}
catch (Exception ex)
{
MessageBox.Show($"{ex.Message}{Environment.NewLine}This application will be terminated.",
"Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
Exit();
}
var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
frameCounter.Update(deltaTime);
var fps = string.Format("FPS: {0}", (int)frameCounter.AverageFramesPerSecond);
spriteBatch.DrawString(spriteFontBig, fps, new Vector2(WINDOW_WIDTH - 70, 10), Color.Yellow);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : ImageAnimationPreviewWindow.cs
with Mozilla Public License 2.0
from lastbattle
with Mozilla Public License 2.0
from lastbattle
protected override void Draw(GameTime gameTime)
{
float frameRate = 1 / (float)gameTime.ElapsedGameTime.TotalSeconds;
int TickCount = Environment.TickCount;
float delta = gameTime.ElapsedGameTime.Milliseconds / 1000f;
MouseState mouseState = Mouse.GetState();
int mouseXRelativeToMap = mouseState.X - mapShiftX;
int mouseYRelativeToMap = mouseState.Y - mapShiftY;
// Clear prior drawings
GraphicsDevice.Clear(Color.Black);
/////////////////////// DRAW ANIMATION ///////////////////////
spriteBatch.Begin(
SpriteSortMode.Deferred,
BlendState.NonPremultiplied, null, null, null, null, Matrix.CreateScale(renderAnimationScaling));
// Animation
dxDrawableItem.Draw(spriteBatch, null, gameTime,
mapShiftX, mapShiftY, 0, 0,
RENDER_WIDTH, RENDER_HEIGHT, renderAnimationScaling, RenderResolution.Res_All,
TickCount);
if (dxDrawableItem.LastFrameDrawn != null)
{
IDXObject lastFrameDrawn = dxDrawableItem.LastFrameDrawn;
// Boundary box
Rectangle rectBox = new Rectangle(
lastFrameDrawn.X - mapShiftX,
lastFrameDrawn.Y - mapShiftY,
lastFrameDrawn.Width,
lastFrameDrawn.Height);
DrawBorder(spriteBatch, rectBox, 1, Color.White);
}
spriteBatch.End();
/////////////////////// ///////////////////////
/////////////////////// DRAW DEBUG TEXT ///////////////////////
spriteBatch.Begin(
SpriteSortMode.Deferred,
BlendState.NonPremultiplied, null, null, null, null, Matrix.CreateScale(renderTextScaling));
// Debug at the top right corner
StringBuilder sb = new StringBuilder();
sb.Append("FPS: ").Append(frameRate).Append(Environment.NewLine);
sb.Append("Mouse : X ").Append(mouseXRelativeToMap).Append(", Y ").Append(mouseYRelativeToMap).Append(Environment.NewLine);
sb.Append("RMouse: X ").Append(mouseState.X).Append(", Y ").Append(mouseState.Y);
spriteBatch.DrawString(font_DebugValues, sb.ToString(), new Vector2(RENDER_WIDTH - 170, 10), Color.White);
// Current image render information
if (dxDrawableItem.LastFrameDrawn != null)
{
IDXObject lastFrameDrawn = dxDrawableItem.LastFrameDrawn;
string imageRenderInfoText = string.Format("[Path: {0}]{7}[Origin: x = {1}, y = {2}]{8}[Dimension: W = {3}, H = {4}]{9}[Delay: {5}]{10}[Scale: {6}x]",
dxDrawableItem.LastFrameDrawn.Tag as string,
lastFrameDrawn.X, lastFrameDrawn.Y, lastFrameDrawn.Width, lastFrameDrawn.Height, lastFrameDrawn.Delay, Math.Round(renderAnimationScaling, 2),
Environment.NewLine, Environment.NewLine, Environment.NewLine, Environment.NewLine);
spriteBatch.DrawString(font_DebugValues, imageRenderInfoText, new Vector2((RENDER_WIDTH /2) - 100, RENDER_HEIGHT - 100), Color.White);
}
// Keyboard navigation info
if (gameTime.TotalGameTime.TotalSeconds < 3)
spriteBatch.DrawString(font,
string.Format("Press [Left] [Right] [Up] [Down] for navigation.{0} [+ -] for zoom", Environment.NewLine),
new Vector2(20, 10), Color.White);
spriteBatch.End();
/////////////////////// ///////////////////////
base.Draw(gameTime);
}
19
Source : SpineAnimationWindow.cs
with Mozilla Public License 2.0
from lastbattle
with Mozilla Public License 2.0
from lastbattle
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
wzSpineObject.state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
wzSpineObject.state.Apply(wzSpineObject.skeleton);
wzSpineObject.skeleton.UpdateWorldTransform();
skeletonRenderer.Begin();
skeletonRenderer.Draw(wzSpineObject.skeleton);
skeletonRenderer.End(); // draws the texture object
//GraphicsDevice.VertexTextures[0].
wzSpineObject.bounds.Update(wzSpineObject.skeleton, true);
/*MouseState mouse = Mouse.GetState();
if (headSlot != null)
{
headSlot.G = 1;
headSlot.B = 1;
if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
{
BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
if (hit != null)
{
headSlot.G = 0;
headSlot.B = 0;
}
}
}*/
spriteBatch.Begin(SpriteSortMode.Immediate, // spine :( needs to be drawn immediately to maintain the layer orders
//SpriteSortMode.Deferred,
BlendState.NonPremultiplied, null, null, null, null, this.matrixScale);
if (gameTime.TotalGameTime.TotalSeconds < 3)
spriteBatch.DrawString(font,
string.Format("Press [Left] [Right] [Up] [Down] [Shift] for navigation.{0}{1}",
Environment.NewLine,
wzSpineObject.spineAnimationItem.SkeletonData.Skins.Count() > 1 ? "[Page up] [Page down] to swap between skins." : string.Empty),
new Vector2(20, 10),
Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : MapSimulator.cs
with Mozilla Public License 2.0
from lastbattle
with Mozilla Public License 2.0
from lastbattle
protected override void Draw(GameTime gameTime)
{
float frameRate = 1 / (float)gameTime.ElapsedGameTime.TotalSeconds;
int TickCount = currTickCount;
//float delta = gameTime.ElapsedGameTime.Milliseconds / 1000f;
MouseState mouseState = this.oldMouseState;
int mouseXRelativeToMap = mouseState.X - mapShiftX;
int mouseYRelativeToMap = mouseState.Y - mapShiftY;
//System.Diagnostics.Debug.WriteLine("Mouse relative to map: X {0}, Y {1}", mouseXRelativeToMap, mouseYRelativeToMap);
int mapCenterX = mapBoard.CenterPoint.X;
int mapCenterY = mapBoard.CenterPoint.Y;
int shiftCenteredX = mapShiftX - mapCenterX;
int shiftCenteredY = mapShiftY - mapCenterY;
//GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 1.0f, 0); // Clear the window to black
GraphicsDevice.Clear(Color.Black);
spriteBatch.Begin(
SpriteSortMode.Immediate, // spine :( needs to be drawn immediately to maintain the layer orders
//SpriteSortMode.Deferred,
BlendState.NonPremultiplied, null, null, null, null, this.matrixScale);
//skeletonMeshRenderer.Begin();
// Back Backgrounds
backgrounds_back.ForEach(bg =>
{
bg.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
});
// Map objects
foreach (List<BaseDXDrawableItem> mapItem in mapObjects)
{
foreach (BaseDXDrawableItem item in mapItem)
{
item.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
}
// Portals
foreach (PortalItem portalItem in mapObjects_Portal)
{
portalItem.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
// Reactors
foreach (ReactorItem reactorItem in mapObjects_Reactors)
{
reactorItem.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
// Life (NPC + Mobs)
foreach (MobItem mapMob in mapObjects_Mobs) // Mobs
{
mapMob.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
foreach (NpcItem mapNpc in mapObjects_NPCs) // NPCs (always in front of mobs)
{
mapNpc.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
// Front Backgrounds
backgrounds_front.ForEach(bg =>
{
bg.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapCenterX, mapCenterY,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
});
// Borders
// Create any rectangle you want. Here we'll use the replacedleSafeArea for fun.
//Rectangle replacedleSafeRectangle = GraphicsDevice.Viewport.replacedleSafeArea;
//DrawBorder(spriteBatch, replacedleSafeRectangle, 1, Color.Black);
DrawVRFieldBorder(spriteBatch);
//////////////////// UI related here ////////////////////
// Tooltips
if (mapObjects_tooltips.Count > 0)
{
foreach (TooltipItem tooltip in mapObjects_tooltips) // NPCs (always in front of mobs)
{
if (tooltip.TooltipInstance.CharacterToolTip != null)
{
Rectangle tooltipRect = tooltip.TooltipInstance.CharacterToolTip.Rectangle;
if (tooltipRect != null) // if this is null, show it at all times
{
Rectangle rect = new Rectangle(
tooltipRect.X - shiftCenteredX,
tooltipRect.Y - shiftCenteredY,
tooltipRect.Width, tooltipRect.Height);
if (bShowDebugMode)
{
DrawBorder(spriteBatch, rect, 1, Color.White); // test
spriteBatch.DrawString(font_DebugValues, "X: " + rect.X + ", Y: " + rect.Y, new Vector2(rect.X, rect.Y), Color.White);
}
if (!rect.Contains(mouseState.X, mouseState.Y))
continue;
}
}
tooltip.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, mapBoard.CenterPoint.X, mapBoard.CenterPoint.Y,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
}
}
// Minimap
if (miniMap != null)
{
miniMap.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
mapShiftX, mapShiftY, minimapPos.X, minimapPos.Y,
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution,
TickCount);
miniMap.CheckMouseEvent(shiftCenteredX, shiftCenteredY, mouseState);
}
if (gameTime.TotalGameTime.TotalSeconds < 4)
spriteBatch.DrawString(font_navigationKeysHelper,
string.Format("[Left] [Right] [Up] [Down] [Shift] for navigation.{0}[F5] for debug mode{1}[Alt+Enter] Full screen{2}[PrintSc] Screenshot",
Environment.NewLine, Environment.NewLine, Environment.NewLine),
new Vector2(20, Height - 140), Color.White);
if (!bSaveScreenshot && bShowDebugMode)
{
StringBuilder sb = new StringBuilder();
sb.Append("FPS: ").Append(frameRate).Append(Environment.NewLine);
sb.Append("Mouse : X ").Append(mouseXRelativeToMap).Append(", Y ").Append(mouseYRelativeToMap).Append(Environment.NewLine);
sb.Append("RMouse: X ").Append(mouseState.X).Append(", Y ").Append(mouseState.Y);
spriteBatch.DrawString(font_DebugValues, sb.ToString(),
new Vector2(Width - 170, 10), Color.White); // use the original width to render text
}
// Cursor [this is in front of everything else]
mouseCursor.Draw(spriteBatch, skeletonMeshRenderer, gameTime,
0, 0, 0, 0, // pos determined in the clreplaced
RenderWidth, RenderHeight, RenderObjectScaling, mapRenderResolution, TickCount);
spriteBatch.End();
//skeletonMeshRenderer.End();
// Save screenshot if render is activated
DoScreenshot();
base.Draw(gameTime);
}
19
Source : ExampleGame.cs
with Mozilla Public License 2.0
from lastbattle
with Mozilla Public License 2.0
from lastbattle
protected override void Draw (GameTime gameTime) {
GraphicsDevice.Clear(Color.Black);
state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
state.Apply(skeleton);
skeleton.UpdateWorldTransform();
skeletonRenderer.Begin();
skeletonRenderer.Draw(skeleton);
skeletonRenderer.End();
bounds.Update(skeleton, true);
MouseState mouse = Mouse.GetState();
if (headSlot != null) {
headSlot.G = 1;
headSlot.B = 1;
if (bounds.AabbContainsPoint(mouse.X, mouse.Y)) {
BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
if (hit != null) {
headSlot.G = 0;
headSlot.B = 0;
}
}
}
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from MaKiPL
with MIT License
from MaKiPL
protected override void Draw(GameTime gameTime)
{
ModuleHandler.Draw(gameTime);
base.Draw(gameTime);
if (!Extended.bRequestedBackBuffer) return;
var tex = new Texture2D(_graphics.GraphicsDevice, _graphics.GraphicsDevice.Viewport.Width, _graphics.GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color);
var b = new byte[tex.Width * tex.Height * 4];
_graphics.GraphicsDevice.GetBackBufferData(b);
tex.SetData(b);
Extended.BackBufferTexture = tex;
Extended.bRequestedBackBuffer = false;
Extended.bBackBufferAvailable = true;
Extended.postBackBufferDelegate();
}
19
Source : Game1.cs
with Mozilla Public License 2.0
from Martenfur
with Mozilla Public License 2.0
from Martenfur
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(UIController.Backgroud);
UIController.Draw();
SceneController.Draw();
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from Martenfur
with MIT License
from Martenfur
protected override void Draw(GameTime gameTime)
{
GameMgr.Draw(gameTime);
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from Martenfur
with MIT License
from Martenfur
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(_backgroundColor);
SpriteBatch.Begin(SpriteSortMode.FrontToBack);
_lawn.Draw();
SpriteBatch.End();
base.Draw(gameTime);
}
19
Source : SimulatorGame.cs
with MIT License
from miyu
with MIT License
from miyu
protected override void Draw(GameTime gameTime) {
base.Draw(gameTime);
Console.WriteLine((int)(1000 / gameTime.ElapsedGameTime.TotalMilliseconds) + " " + gameTime.ElapsedGameTime.TotalMilliseconds);
GraphicsDevice.Clear(Color.White);
spriteBatch.Begin(SpriteSortMode.Deferred, null, transformMatrix: Matrix.CreateScale((float)configuration.DisplayHeight / configuration.FieldHeight));
for (var i = 0; i < agents.Length; i++) {
var agent = agents[i];
foreach (var pair in agent.ActiveConnectionStates) {
var other = pair.Key;
if (agent.BluetoothAdapterId.CompareTo(other.BluetoothAdapterId) < 0)
continue;
var neighborBluetoothAdapter = agent.BluetoothAdapter.NeighborsByAdapterId[other.BluetoothAdapterId];
if (neighborBluetoothAdapter.IsConnected)
spriteBatch.DrawLine(agent.Position, other.Position, Color.Gray);
}
}
for (var i = 0; i < agents.Length; i++) {
var lum = (epoch - agents[i].Value) * 240 / epoch;
var color = new Color(lum, lum, lum);
if (epoch == agents[i].Value && agents[i].Value > 0) color = Color.Red;
if (epoch == agents[i].Value + 1 && agents[i].Value > 0) color = Color.Lime;
if (epoch == agents[i].Value + 2 && agents[i].Value > 0) color = Color.MediumAquamarine;
if (epoch == agents[i].Value + 3 && agents[i].Value > 0) color = Color.Magenta;
if (epoch == agents[i].Value + 4 && agents[i].Value > 0) color = Color.Orange;
DrawCenteredCircleWorld(agents[i].Position, configuration.AgentRadius, color);
}
//spriteBatch.DrawLine(new Vector2(0, 50), new Vector2(100, 50), Color.Red);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from mystborn
with MIT License
from mystborn
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
if (_state != null)
_state.Draw(spriteBatch);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
base.Draw(gameTime);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
spriteBatch.DrawString(font, "ESC - Exit", new Vector2(8, 8), Color.Gold);
spriteBatch.DrawString(font, "WASD - Translate Red Sprite", new Vector2(8, 8 + font.LineSpacing), Color.Gold);
spriteBatch.DrawString(font, "Arrow Keys - Translate Blue Sprite", new Vector2(8, 8 + (font.LineSpacing * 2)), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "Camera Controls: [WASD - Translate] [Arrow Keys - Rotate] [Left Mouse Button to Pick]", new Vector2(8, 8), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), string.Format("Selected Object: {0}", selected == null ? "None" : selected.Name), new Vector2(8, 22), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "ESC - Exit", new Vector2(8, 36), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Immediate);
base.Draw(gameTime);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
ShipSourceRect = new Rectangle((int)ShipAnimationPlayer.CurrentCell.X, (int)ShipAnimationPlayer.CurrentCell.Y, 64, 64);
spriteBatch.Draw(Ship, new Rectangle((int)ShipPos.X, (int)ShipPos.Y, 32, 32), ShipSourceRect, Color.White, shipRotation, new Vector2(64, 64) / 2, SpriteEffects.None, 0);
Explosion1SourceRect = new Rectangle((int)Explosion1AnimationPlayer.CurrentCell.X, (int)Explosion1AnimationPlayer.CurrentCell.Y, 204, 204);
spriteBatch.Draw(Explosion1, new Rectangle(0, 0, bangSize, bangSize), Explosion1SourceRect, Color.White);
Explosion2SourceRect = new Rectangle((int)Explosion2AnimationPlayer.CurrentCell.X, (int)Explosion2AnimationPlayer.CurrentCell.Y, 204, 204);
spriteBatch.Draw(Explosion2, new Rectangle(GraphicsDevice.Viewport.Width- bangSize, 0, bangSize, bangSize), Explosion2SourceRect, Color.White);
Explosion3SourceRect = new Rectangle((int)Explosion3AnimationPlayer.CurrentCell.X, (int)Explosion3AnimationPlayer.CurrentCell.Y, 204, 204);
spriteBatch.Draw(Explosion3, new Rectangle(0, GraphicsDevice.Viewport.Height- bangSize, bangSize, bangSize), Explosion3SourceRect, Color.White);
Explosion4SourceRect = new Rectangle((int)Explosion4AnimationPlayer.CurrentCell.X, (int)Explosion4AnimationPlayer.CurrentCell.Y, 409, 409);
spriteBatch.Draw(Explosion4, new Rectangle(GraphicsDevice.Viewport.Width- bangSize, GraphicsDevice.Viewport.Height- bangSize, bangSize, bangSize), Explosion4SourceRect, Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
// Set up RT's
GraphicsDevice.SetRenderTargets(backBuffer, depthBuffer);
GraphicsDevice.Clear(Color.CornflowerBlue);
base.Draw(gameTime);
//Resolve targets.
GraphicsDevice.SetRenderTarget(null);
ppManager.Draw(gameTime, backBuffer, depthBuffer);
line = 0;
int x = 8;
spriteBatch.Begin();
spriteBatch.Draw(Content.Load<Texture2D>("Textures/HUD/HUDBackground"), new Rectangle(0, 0, 250, lineHeight * lineCount), Color.White);
WriteLine("Post Processing", x, Color.Gold);
WriteLine($"[F1 ] - Bloom On: {bloom.Enabled}",x, bloom.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F2 ] - God Rays On: {GodRays.Enabled}", x, GodRays.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F3 ] - Depth of Field On: {dof.Enabled}", x, dof.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F4 ] - Fog On: {fog.Enabled}", x, fog.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F5 ] - Heat Haze On: {haze.Enabled}", x, haze.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F6 ] - Radial Blur On: {radialBlur.Enabled}", x,radialBlur.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F7 ] - Ripple On: {ripple.Enabled}", x, ripple.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F8 ] - Sun On: {sun.Enabled}", x, sun.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F9 ] - Sepia On: {sepia.Enabled}", x, sepia.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F10] - Grey Scale On: {greyScale.Enabled}", x, greyScale.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F11] - Invert Color On: {invert.Enabled}", x, invert.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[F12] - DeRezed On: {deRezed.Enabled}", x, deRezed.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[D1 ] - Color Filter ON: {colorFilter.Enabled}", x, colorFilter.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[D2 ] - Bleach ON: {bleach.Enabled}", x, bleach.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[D3 ] - Scan Lines ON: {scanLines.Enabled}", x, scanLines.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"[D4 ] - FXAA ON: {fxaa.Enabled}", x, fxaa.Enabled ? Color.Yellow : Color.Gold);
WriteLine($"", x, Color.Gold);
WriteLine($"", x, Color.Gold);
WriteLine($"[ESC] - Exit", x, Color.Gold);
line = 0;
x += 255;
if (selectedEffect != null)
{
spriteBatch.Draw(Content.Load<Texture2D>("Textures/HUD/HUDBackground"), new Rectangle(255, 0, 250, lineHeight * 9), Color.White);
WriteLine($"[{selectedEffect.GetType().Name}]", x, Color.Gold);
WriteLine($"[SPC] - Toggle Enabled", x, selectedEffect.Enabled ? Color.LimeGreen : Color.Green);
if (selectedEffect.Enabled)
{
if (selectedEffect == bloom)
{
WriteLine($"[G ] Galre On: {bloom.Glare}", x, bloom.Glare ? Color.LimeGreen : Color.Green);
WriteLine($"[Y/H] Bloom Threshold +- : {bloom.BloomThreshold}", x, Color.LimeGreen);
WriteLine($"[U/J] Blur Amount +- : {bloom.BlurAmount}", x, Color.LimeGreen);
}
if (selectedEffect == GodRays)
{
WriteLine($"[R/F] Light Source Size +-: {GodRays.LightSourceSize}", x, Color.LimeGreen);
WriteLine($"[T/G] Density +-: {GodRays.Density}", x, Color.LimeGreen);
WriteLine($"[Y/H] Decay +-: {GodRays.Decay}", x, Color.LimeGreen);
WriteLine($"[U/J] Weight +-: {GodRays.Weight}", x, Color.LimeGreen);
WriteLine($"[I/K] Exposure +-: {GodRays.Exposure}", x, Color.LimeGreen);
WriteLine($"[O/L] Bright Threshold +-: {GodRays.BrightThreshold}", x, Color.LimeGreen);
}
if (selectedEffect == dof)
{
WriteLine($"[R/F] Disc Radius +- : {dof.DiscRadius}", x, Color.LimeGreen);
WriteLine($"[T/G] Focal Distance +- : {dof.FocalDistance}", x, Color.LimeGreen);
WriteLine($"[Y/H] Focal Range +- : {dof.FocalRange}", x, Color.LimeGreen);
}
if (selectedEffect == fog)
{
WriteLine($"[R/F] - Fog Distance +- : {fog.FogDistance}", x, Color.LimeGreen);
WriteLine($"[T/G] - Fog Range +- : {fog.FogRange}", x, Color.LimeGreen);
WriteLine($"[Y/H] - Fog Color (R) +- : {fog.FogColor.ToVector4().X}", x, Color.LimeGreen);
WriteLine($"[U/J] - Fog Color (G) +- : {fog.FogColor.ToVector4().Y}", x, Color.LimeGreen);
WriteLine($"[I/K] - Fog Color (B) +- : {fog.FogColor.ToVector4().Z}", x, Color.LimeGreen);
WriteLine($"[O/L] - Fog Color (A) +- : {fog.FogColor.ToVector4().W}", x, Color.LimeGreen);
}
if (selectedEffect == haze)
{
WriteLine($"[H ] - High On: {haze.High}", x, haze.High ? Color.LimeGreen : Color.Green);
}
if (selectedEffect == radialBlur)
{
WriteLine($"[R/F] - Sale +=: {radialBlur.Scale}", x, Color.LimeGreen);
}
if (selectedEffect == ripple)
{
WriteLine($"[T/G] - Distortion +=: {ripple.Distortion}", x, Color.LimeGreen);
WriteLine($"[Y/H] - Screen Position X +=: {ripple.ScreenPosition.X}", x, Color.LimeGreen);
WriteLine($"[U/J] - Screen Position Y +=: {ripple.ScreenPosition.Y}", x, Color.LimeGreen);
}
if (selectedEffect == colorFilter)
{
WriteLine($"[R/F] - Bright +=: {colorFilter.Bright}", x, Color.LimeGreen);
WriteLine($"[T/G] - Saturation +=: {colorFilter.Saturation}", x, Color.LimeGreen);
WriteLine($"[Y/H] - Burn +=: {colorFilter.Burn}", x, Color.LimeGreen);
WriteLine($"[U/J] - Color (R) +- : {colorFilter.Color.ToVector3().X}", x, Color.LimeGreen);
WriteLine($"[I/K] - Color (G) +- : {colorFilter.Color.ToVector3().Y}", x, Color.LimeGreen);
WriteLine($"[O/L] - Color (B) +- : {colorFilter.Color.ToVector3().Z}", x, Color.LimeGreen);
}
if (selectedEffect == bleach)
{
WriteLine($"[R/F] - Opacity +=: {bleach.Opacity}", x, Color.LimeGreen);
}
if (selectedEffect == scanLines)
{
WriteLine($"[R/F] - Noise Intensity +=: {scanLines.NoiseIntensity}", x, Color.LimeGreen);
WriteLine($"[T/G] - Line Intensity +=: {scanLines.LineIntensity}", x, Color.LimeGreen);
WriteLine($"[Y/H] - Line Count +=: {scanLines.LineCount}", x, Color.LimeGreen);
}
if (selectedEffect == deRezed)
{
WriteLine($"[R/F] - Number Of Tiles +=: {deRezed.NumberOfTiles}", x, Color.LimeGreen);
}
if (selectedEffect == fxaa)
{
WriteLine($"[R/F] - Technique: {fxaa.TechniqueUsed}", x, Color.LimeGreen);
WriteLine($"[T/G] - Contrast Threshold +=: {fxaa.ContrastThreshold}", x, Color.LimeGreen);
WriteLine($"[Y/H] - Relative Threshold +=: {fxaa.RelativeThreshold}", x, Color.LimeGreen);
WriteLine($"[U/J] - Subpixel Blending +=: {fxaa.SubpixelBlending}", x, Color.LimeGreen);
WriteLine($"[I] - Split Screen: {fxaa.RenderHalfScreen}", x, Color.LimeGreen);
WriteLine($"[O/L] - Split At : {fxaa.Vline}", x, Color.LimeGreen);
}
}
}
line = (lineCount + 2) * lineHeight;
WriteLine("", 8, Color.Gold);
WriteLine("Camera Controls: [WASD - Translate] [Arrow Keys - Rotate]", 8, Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
//spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
//spriteBatch.Draw(testNoise, new Rectangle(0, 0, 256, 256), new Rectangle(0, 0, 128, 128), Color.White);
//spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "Camera Controls: [WASD - Translate] [Arrow Keys - Rotate]", new Vector2(8, 8), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "[F1] - Textured", new Vector2(8, 24), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "[F2] - Wireframe showing clip map and heights", new Vector2(8, 40), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "[F3] - Wireframe showing clip map flat", new Vector2(8, 56), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "ESC - Exit", new Vector2(8, 72), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(camera.ClearColor);
// TODO: Add your drawing code here
base.Draw(gameTime);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "Camera Controls: [WASD - Translate] [Arrow Keys - Rotate]", new Vector2(8, 8), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), $"Hatching Density [R/F] +- {cube.HatchDencity}", new Vector2(8, 22), Color.Gold);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "ESC - Exit", new Vector2(8, 36), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
//spriteBatch.Begin();
//spriteBatch.Draw(t, window.ScissorRectangle, new Color(0, 100, 0, 128));
//spriteBatch.Draw(t, window.txtTest.ScissorRectangle, new Color(0,100,0,128));
//spriteBatch.End();
if (lastWindow != null)
{
lastWindow.Visible = true;
lastWindow = null;
}
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
if(ShowLightAndShader[2] || ShowLightAndShader[5])
GraphicsDevice.Clear(Color.Black);
else
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
lines = 0;
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
WriteLine("WASD - Translate Camera", Color.Gold);
WriteLine("Arrow Keys - Rotate Camera", Color.Gold);
if (ShowLightAndShader[0])
{
WriteLine("IJKLUO - Translate Light", Color.Gold);
WriteLine("F1/F2 - Alter Ambient Intensity", Color.Gold);
WriteLine("Esc - Exit", Color.Gold);
WriteLine($"Light Position: {light.Position}", Color.Gold);
WriteLine($"Lignt Intensity: {AmbientIntensity}", Color.Gold);
}
else if (ShowLightAndShader[1])
{
WriteLine("IJKLUO - Translate Light", Color.Gold);
WriteLine("F1/F2 - Alter Ambient Intensity", Color.Gold);
WriteLine("F3/F4 - Alter Diffuse Intensity", Color.Gold);
WriteLine("F5/F6 - Alter Specular Intensity", Color.Gold);
WriteLine("Space - Alter Current Light", Color.Gold);
WriteLine("Esc - Exit", Color.Gold);
WriteLine($"Light Position: {lights[currentLightEdit].Position}", Color.Gold);
WriteLine($"Ambient Light Intensity: {AmbientIntensity}", Color.Gold);
WriteLine($"Diffuse Light Intensity: {lights[currentLightEdit].LightIntensity}", Color.Gold);
WriteLine($"Specular Intensity: {lights[currentLightEdit].SpecularIntensity}", Color.Gold);
WriteLine($"Current Light: {(currentLightEdit + 1)}", Color.Gold);
}
else if (ShowLightAndShader[5])
{
WriteLine("Translate Light: I,K,J,L,U,O", Color.Gold);
WriteLine("Translate Camera: W,A,S,D", Color.Gold);
}
WriteLine("---------------------------------------", Color.Gold);
WriteLine($"D1 - Toggle Light & Shade I {ShowLightAndShader[0]}", Color.Gold);
WriteLine($"D2 - Toggle Light & Shade II {ShowLightAndShader[1]}", Color.Gold);
WriteLine($"D3 - Toggle Light & Shade III {ShowLightAndShader[2]}", Color.Gold);
WriteLine($"D4 - Toggle Light & Shade V {ShowLightAndShader[3]}", Color.Gold);
WriteLine($"D5 - Toggle Light & Shade VI {ShowLightAndShader[4]}", Color.Gold);
WriteLine($"D6 - Toggle Light & Shade VIII {ShowLightAndShader[5]}", Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "Camera Controls: [WASD - Translate] [Arrow Keys - Rotate]", new Vector2(8, 8), Color.Gold);
//spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), string.Format("Water Sparkle: {0}", water.Sparkle), new Vector2(8, 22), Color.Gold);
//spriteBatch.DrawString(Content.Load<SpriteFont>("Fonts/hudFont"), "ESC - Exit", new Vector2(8, 36), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
WriteText($"[SPC] - Toggle Time Advance {!skySphere.ReaTime} " + GetSysTime(), new Vector2(5, 0), Color.White);
WriteText("World Time: " + skySphere.GetTime(), new Vector2(5, font.LineSpacing * 2), Color.White);
WriteText("System Time: " + GetSysTime(), new Vector2(5, font.LineSpacing * 3), Color.White);
WriteText("[WASD] - Translate Camera, [Arrow Keys] Rotate Camera", new Vector2(5, font.LineSpacing * 4), Color.White);
WriteText("[ESC] - Exit", new Vector2(5, font.LineSpacing * 5), Color.White);
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.Black);
// TODO: Add your drawing code here
base.Draw(gameTime);
line = 0;
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullCounterClockwise);
WriteLine("Camera Controls: [WASD - Translate] [Arrow Keys - Rotate]", Color.Gold);
WriteLine($"[F1] - Toggle NVIDIA FIre {Fire3D.Enabled}", Color.Gold);
WriteLine($"[F2] - Toggle Old School CPU Fire {Fire.Enabled}", Color.Gold);
WriteLine($"[F3] - Toggle Old School GPU Fire {Fire2.Enabled}", Color.Gold);
WriteLine($"[F4] - Toggle Old School GPU Fire Box {Fire2.Enabled}", Color.Gold);
WriteLine($"-----------------------------------------------", Color.Gold);
if (Fire3D.Enabled)
{
WriteLine($"[R/F] - Flame Noise Frequency +- {Fire3D.NoiseFrequency}", Color.Gold);
WriteLine($"[T/G] - Flame Noise Strength +- {Fire3D.NoiseStrength}", Color.Gold);
WriteLine($"[Y/H] - Flame Offset +- {Fire3D.FlameOffSet}", Color.Gold);
WriteLine($"[U/J] - Flame Animation Speed +- {Fire3D.AnimationSpeed}", Color.Gold);
WriteLine($"[I/K] - Flame Color (R) +- : {Fire3D.Color.ToVector4().X}", Color.LimeGreen);
WriteLine($"[O/L] - Flame Color (G) +- : {Fire3D.Color.ToVector4().Y}", Color.LimeGreen);
WriteLine($"[P/;] - Flame Color (B) +- : {Fire3D.Color.ToVector4().Z}", Color.LimeGreen);
}
if (Fire.Enabled || Fire2.Enabled || Fire3.Enabled)
{
WriteLine($"Fire Type: " + ((Fire2.Enabled || false) ? "GPU" : "CPU"), Color.Gold);
WriteLine($"[R/F] Toggle Oxygen: {Fire.Oxygen}", Color.Gold);
WriteLine($"[T/G] Toggle Min Fuel: {Fire.MinFuel}", Color.Gold);
WriteLine($"[Y/H] Toggle Max Fuel: {Fire.MaxFuel}", Color.Gold);
if (Fire.FlameRampreplacedet != null)
WriteLine($"[D1]: {Fire.FlameRampreplacedet}", Color.Gold);
else
WriteLine($"[D1]: None", Color.Gold);
WriteLine($"Show Debug: {Fire.ShowDebug}", Color.Gold);
}
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your drawing code here
base.Draw(gameTime);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
spriteBatch.DrawString(font, "Esc - Quit", new Vector2(8, 8), Color.Gold);
spriteBatch.DrawString(font, "WASD - Translate Camera", new Vector2(8, 8 + font.LineSpacing), Color.Gold);
spriteBatch.DrawString(font, "Arrow Keys - Rotate Camera", new Vector2(8, 8 + (font.LineSpacing * 2)), Color.Gold);
spriteBatch.End();
}
19
Source : Game1.cs
with MIT License
from NemoKradXNA
with MIT License
from NemoKradXNA
protected override void Draw(GameTime gameTime)
{
lightingManager.PreSceneDrawSetUp(gameTime);
// Draw all the items in the scene, they need to use the deferred Model Render shader.
base.Draw(gameTime);
lightingManager.PostSceneDraw(gameTime);
#region Debug & HUD
// Debug, show shadow map...
if (lightingManager.DebugShadowMaps)
{
if (lightingManager.ShadowLights != null && lightingManager.ShadowLights.Count > 0 && lightingManager.ShadowCasters != null && lightingManager.ShadowCasters.Count > 0)
{
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
// We have lights to cast shadows, objects that will block light, and objects to receive the shadows...
int s = 512;
int m = 0;
foreach (BaseLight light in lightingManager.ShadowLights)
{
spriteBatch.Draw(light.ShadowMap, new Rectangle(s * m++, 0, s, s), Color.White);
}
spriteBatch.End();
}
}
// Deferred Render debug
if (lightingManager.DebugLighting) // && GameComponentHelper.InEditor)
{
int w = GraphicsDevice.Viewport.Width / 5;
int h = GraphicsDevice.Viewport.Height / 5;
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
//spriteBatch.Draw(t, new Rectangle(0, 0, w * 6, h + 2), Color.White);
spriteBatch.Draw(camera.RenderTarget, new Rectangle(1, 1, w, h), Color.White);
spriteBatch.Draw(camera.SpecularGlowReflectionMap, new Rectangle(w + 2, 1, w, h), Color.White);
spriteBatch.Draw(camera.NormalBuffer, new Rectangle((w * 2) + 3, 1, w, h), Color.White);
GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
spriteBatch.Draw(camera.DepthBuffer, new Rectangle((w * 3) + 5, 1, w, h), Color.White);
spriteBatch.Draw(lightingManager.lightMap, new Rectangle((w * 4) + 7, 1, w, h), Color.White);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
spriteBatch.DrawString(debugFont, "Color Map", new Vector2((w / 2) - 100, h), Color.White);
spriteBatch.DrawString(debugFont, "SGR Map", new Vector2(w + 2 + (w / 2) - 100, h), Color.White);
spriteBatch.DrawString(debugFont, "Bump Map", new Vector2((w * 2) + (w / 2) - 100, h), Color.White);
spriteBatch.DrawString(debugFont, "Depth Map", new Vector2((w * 3) + (w / 2) - 100, h), Color.White);
spriteBatch.DrawString(debugFont, "Light Map", new Vector2((w * 4) + (w / 2) - 100, h), Color.White);
spriteBatch.End();
}
int top = 8;
int lineHeight = infoFont.LineSpacing;
if (lightingManager.DebugLighting || lightingManager.DebugShadowMaps)
top += (GraphicsDevice.Viewport.Height / 5) + debugFont.LineSpacing;
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
spriteBatch.DrawString(infoFont, $"[WASD] - Translate Camera", new Vector2(8, top), Color.Gold);
spriteBatch.DrawString(infoFont, $"[Arrow Keys] - Rotate Camera", new Vector2(8, top + lineHeight), Color.Gold);
spriteBatch.DrawString(infoFont, $"[R/F] - Directional Shadow Offset +- {lightingManager.deferredDirectionalShadowMapMod} ", new Vector2(8, top + lineHeight * 2), Color.Gold);
spriteBatch.DrawString(infoFont, $"[T/G] - Cone Shadow Offset +- {lightingManager.deferredConeShadowMapMod} ", new Vector2(8, top + lineHeight * 3), Color.Gold);
spriteBatch.DrawString(infoFont, $"[SPC] - Toggle Hord/Soft Shadows", new Vector2(8, top + lineHeight * 4), Color.Gold);
spriteBatch.DrawString(infoFont, $"[F1] - Toggle Shadows", new Vector2(8, top + lineHeight * 5), Color.Gold);
spriteBatch.End();
#endregion
}
19
Source : TrackViewer.cs
with GNU General Public License v3.0
from openrails
with GNU General Public License v3.0
from openrails
protected override void Draw(GameTime gameTime)
{
// Even if there is nothing new to draw for main window, we might still need to draw for the shadow textures.
if (DrawTrackDB != null && Properties.Settings.Default.showInset)
{
drawAreaInset.DrawShadowTextures(DrawTrackDB.DrawTracks, DrawColors.colorsNormal.ClearWindowInset);
}
// if there is nothing to draw, be done.
if (--skipDrawAmount > 0)
{
return;
}
GraphicsDevice.Clear(DrawColors.colorsNormal.ClearWindow);
if (DrawTrackDB == null) return;
spriteBatch.Begin();
//spriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None);
//GraphicsDevice.SamplerStates[0].MagFilter = TextureFilter.Point;
//GraphicsDevice.SamplerStates[0].MinFilter = TextureFilter.Point;
//GraphicsDevice.SamplerStates[0].MipFilter = TextureFilter.Point;
if (drawTerrain != null) { drawTerrain.Draw(DrawArea); }
drawWorldTiles.Draw(DrawArea);
DrawArea.DrawTileGrid();
if (drawTerrain != null) { drawTerrain.DrawPatchLines(DrawArea); }
DrawTrackDB.DrawRoads(DrawArea);
DrawTrackDB.DrawTracks(DrawArea);
DrawTrackDB.DrawTrackHighlights(DrawArea, true);
DrawTrackDB.DrawJunctionAndEndNodes(DrawArea);
if (Properties.Settings.Default.showInset)
{
drawAreaInset.DrawBackground(DrawColors.colorsNormal.ClearWindowInset);
//drawTrackDB.DrawTracks(drawAreaInset); //replaced by next line
drawAreaInset.DrawShadowedTextures();
DrawTrackDB.DrawTrackHighlights(drawAreaInset, false);
drawAreaInset.DrawBorder(Color.Red, DrawArea);
drawAreaInset.DrawBorder(Color.Black);
}
if (DrawMultiplePaths != null ) DrawMultiplePaths.Draw(DrawArea);
if (DrawPATfile != null && Properties.Settings.Default.showPATfile) DrawPATfile.Draw(DrawArea);
if (PathEditor != null && Properties.Settings.Default.showTrainpath) PathEditor.Draw(DrawArea);
drawEditorAction.Draw(PathEditor);
DrawTrackDB.DrawRoadTrackItems(DrawArea);
DrawTrackDB.DrawTrackItems(DrawArea);
DrawTrackDB.DrawItemHighlights(DrawArea);
CalculateFPS(gameTime);
statusBarControl.Update(this, DrawArea.MouseLocation);
drawScaleRuler.Draw();
drawLongitudeLareplacedude.Draw(DrawArea.MouseLocation);
drawLabels.Draw(DrawArea);
DebugWindow.DrawAll();
spriteBatch.End();
base.Draw(gameTime);
skipDrawAmount = maxSkipDrawAmount;
}
19
Source : Game1.cs
with Mozilla Public License 2.0
from RHY3756547
with Mozilla Public License 2.0
from RHY3756547
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.RenderState.DepthBufferEnable = true;
GraphicsDevice.RenderState.DepthBufferWriteEnable = true;
GraphicsDevice.RenderState.AlphaBlendEnable = true;
m_Terrain.Draw(GraphicsDevice);
base.Draw(gameTime);
}
19
Source : Game.cs
with Mozilla Public License 2.0
from RHY3756547
with Mozilla Public License 2.0
from RHY3756547
protected override void Draw(GameTime gameTime){
base.Draw(gameTime);
Screen.Draw(gameTime);
}
19
Source : Game1.cs
with MIT License
from RonenNess
with MIT License
from RonenNess
protected override void Draw(GameTime gameTime)
{
// clear screen
GraphicsDevice.Clear(Color.CornflowerBlue);
// draw scene
root.Draw();
// rotate inner node on X axis
node.RotationZ = node.RotationZ + 0.01f;
// scale node container
nodeContainer.ScaleZ = (1.0f + (float)System.Math.Cos(gameTime.TotalGameTime.TotalSeconds * 2f) / 4f);
// move top node left and right
nodeContainerContainer.PositionX = (float)System.Math.Sin(gameTime.TotalGameTime.TotalSeconds) * 4f;
// call base draw
base.Draw(gameTime);
}
See More Examples