public static void DrawRectangle(IRenderConfiguration renderConfig, Vector2 position, Vector2 size, Color FillColor) { ScreenQuad.RenderQuad(position, size, FillColor, 0, Texture.SingleWhite.NativeTexture, renderConfig); }
public override void Render(IRenderConfiguration renderConfig, RenderManager renderManager, IMaterial materialToUse) { base.Render(renderConfig, renderManager, materialToUse); Performance.StartAppendAggreate("Setup"); Matrix worldViewProj = WorldMatrix * renderManager.ViewTarget.ViewMatrix * renderManager.ViewTarget.ProjectionMatrix; materialToUse.ApplyParameters(worldViewProj); Performance.EndAppendAggreate("Setup"); Performance.StartAppendAggreate("Render Mesh"); //SkeletalMesh.Render(); Performance.EndAppendAggreate("Render Mesh"); /*SkeletalMesh.SetAnimationTime(AnimationTime); * for (int i = 0; i < SkeletalMesh.MeshParts.Count; i++) * { * RenderMeshPart(SkeletalMesh.MeshParts[i], renderManager, renderConfig, materialToUse); * } * * for (int i = 0; i < SkeletalMesh.RootBone.ChildBones.Length; i++) * { * //DrawBone(SkeletalMesh.RootBone.ChildBones[i], renderManager, renderConfig); * }*/ }
public StaticMesh(IRenderConfiguration setRenderConfig) { IsCollisionOnly = false; renderConfig = setRenderConfig; DiffuseTexture = null; Material = null; }
public static void RenderRectangle(IRenderConfiguration renderConfig, RectangleF destRect, Color col, int BorderWidth = 1) { if (renderConfig == null) { throw new ArgumentNullException(nameof(renderConfig)); } Vector2 Scale = renderConfig.Scale; Vector2 ScaledOffset = renderConfig.ScaledOffset; destRect = new RectangleF(ScaledOffset.X + (int)(destRect.X * Scale.X), ScaledOffset.Y + (int)(destRect.Y * Scale.Y), (int)(destRect.Width * Scale.X), (int)(destRect.Height * Scale.Y)); Rectangle singleRect = new Rectangle(0, 0, 1, 1); Rectangle leftRect = new Rectangle((int)destRect.X, (int)destRect.Y, BorderWidth, (int)destRect.Height); Rectangle topRect = new Rectangle((int)destRect.X, (int)destRect.Y, (int)destRect.Width, BorderWidth); Rectangle rightRect = new Rectangle((int)destRect.X + (int)destRect.Width - BorderWidth, (int)destRect.Y, BorderWidth, (int)destRect.Height); Rectangle bottomRect = new Rectangle((int)destRect.X, (int)destRect.Y + (int)destRect.Height - BorderWidth, (int)destRect.Width, BorderWidth); renderConfig.PrimitiveRenderManager.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullNone); renderConfig.PrimitiveRenderManager.SpriteBatch.Draw(Texture.SingleWhite.nativeTexture, leftRect, singleRect, col); renderConfig.PrimitiveRenderManager.SpriteBatch.Draw(Texture.SingleWhite.nativeTexture, topRect, singleRect, col); renderConfig.PrimitiveRenderManager.SpriteBatch.Draw(Texture.SingleWhite.nativeTexture, rightRect, singleRect, col); renderConfig.PrimitiveRenderManager.SpriteBatch.Draw(Texture.SingleWhite.nativeTexture, bottomRect, singleRect, col); renderConfig.PrimitiveRenderManager.SpriteBatch.End(); }
/// <summary> /// Draws a text at the specified position nested in a begin/end. Suitable for quick text drawing. /// Automatically fits the text into the specifiec space. /// </summary> public static void DrawStringDirect(IRenderConfiguration renderConfig, SpriteFont font, string text, float x, float y, float width, float height, Color color, UITextAlignHorizontal horizontalAlignment = UITextAlignHorizontal.Center, UITextAlignVertical verticalAlignment = UITextAlignVertical.Center) { DrawStringDirectInternal(renderConfig, font, text, x, y, width, height, color, horizontalAlignment, verticalAlignment); }
/// <summary> /// Draw all renderProxies using the specified renderConfig and renderManager. /// </summary> /// <returns>The draw.</returns> /// <param name="renderConfig">Render config.</param> /// <param name="renderManager">Render manager.</param> public int Draw(IRenderConfiguration renderConfig, RenderManager renderManager, int renderCount, int maxRenderCount) { BoundingFrustum frustum = renderManager.ViewTarget?.CameraFrustum; if (frustum == null) { return(0); } if (PerformDepthSorting == true) { Performance.Push("Perform DepthSorting"); WorldOriginForDepthSorting = renderManager.ViewTarget?.CameraLocation ?? Vector3.Zero; proxies.Sort((x, y) => { float distanceSqr = Vector3.DistanceSquared(x.WorldMatrix.Translation, WorldOriginForDepthSorting); float distance2Sqr = Vector3.DistanceSquared(y.WorldMatrix.Translation, WorldOriginForDepthSorting); return(distance2Sqr.CompareTo(distanceSqr)); }); Performance.Pop(); } Performance.PushAggregate("Setup"); Performance.PushAggregate("Setup Texture"); Performance.PushAggregate("SetVertexBuffer"); Performance.PushAggregate("DrawPrimitives"); Material.SetupEffectForRenderPass(this); int renderedProxies = 0; for (int i = 0; i < proxies.Count; i++) { if (maxRenderCount != -1 && renderCount > maxRenderCount) { break; } if (frustum.Contains(proxies[i].BoundingBox) == ContainmentType.Disjoint) { continue; } proxies[i].Render(renderConfig, renderManager, Material); renderCount++; renderedProxies++; } Performance.PopAggregate("DrawPrimitives"); Performance.PopAggregate("SetVertexBuffer"); Performance.PopAggregate("Setup Texture"); Performance.PopAggregate("Setup"); return(renderedProxies); }
public UILabel(IRenderConfiguration renderConfig, string setText, SpriteFont setFont = null) : base(renderConfig) { Text = setText; Font = setFont ?? renderConfig.PrimitiveRenderManager.EngineFont; TextAlignHorizontal = UITextAlignHorizontal.Center; TextAlignVertical = UITextAlignVertical.Center; AutoScaleFont = false; }
public StaticMeshUnitCube(IRenderConfiguration setRenderConfig) : base(setRenderConfig) { PrimitiveType = PrimitiveType.TriangleList; PrimitiveCount = 12; VertexPositionColor[] verts = new VertexPositionColor[36]; // Front verts[0] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Red); verts[1] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Red); verts[2] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Red); verts[3] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Red); verts[4] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Red); verts[5] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Red); // Back verts[6] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Blue); verts[7] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Blue); verts[8] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Blue); verts[9] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Blue); verts[10] = new VertexPositionColor(new Vector3(-1, -1, -1), Color.Blue); verts[11] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Blue); // Left verts[12] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Purple); verts[13] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Purple); verts[14] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Purple); verts[15] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Purple); verts[16] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Purple); verts[17] = new VertexPositionColor(new Vector3(-1, -1, -1), Color.Purple); // Right verts[18] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Indigo); verts[19] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Indigo); verts[20] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Indigo); verts[21] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Indigo); verts[22] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Indigo); verts[23] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Indigo); // Top verts[24] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Green); verts[25] = new VertexPositionColor(new Vector3(1, 1, 1), Color.Green); verts[26] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Green); verts[27] = new VertexPositionColor(new Vector3(1, 1, -1), Color.Green); verts[28] = new VertexPositionColor(new Vector3(-1, 1, 1), Color.Green); verts[29] = new VertexPositionColor(new Vector3(-1, 1, -1), Color.Green); // Bottom verts[30] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Yellow); verts[31] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Yellow); verts[32] = new VertexPositionColor(new Vector3(1, -1, 1), Color.Yellow); verts[33] = new VertexPositionColor(new Vector3(1, -1, -1), Color.Yellow); verts[34] = new VertexPositionColor(new Vector3(-1, -1, -1), Color.Yellow); verts[35] = new VertexPositionColor(new Vector3(-1, -1, 1), Color.Yellow); VertexBuffer = new VertexBuffer(renderConfig.GraphicsDevice, VertexPositionColor.VertexDeclaration, 36, BufferUsage.WriteOnly); VertexBuffer.SetData(verts); }
public PrimitiveRenderManager(IRenderConfiguration setRenderConfig) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } renderConfig = setRenderConfig; SpriteBatch = new SpriteBatch(renderConfig.GraphicsDevice); }
public UIButton(IRenderConfiguration setRenderConfig, string setText, SpriteFont setFont, UIButtonStyle setButtonStyle = UIButtonStyle.None) : base(setRenderConfig, setText, setFont) { Padding = 5; ButtonStyle = setButtonStyle; isPressed = false; BorderColor = Color.Black; BorderWidth = 1; Focusable = true; }
public UIWindow(IRenderConfiguration renderConfig) : base(renderConfig) { X = Y = 0; Width = renderConfig.ScreenSize.X; Height = renderConfig.ScreenSize.Y; WidthSizeMode = UISizeMode.Fit; HeightSizeMode = UISizeMode.Fit; }
public MouseCursor(IRenderConfiguration setRenderConfig, Cursor setCurrentCursor) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } renderConfig = setRenderConfig; Position = Vector2.Zero; IsVisible = true; CurrentCursor = setCurrentCursor; }
/// <summary> /// Draws a text at the specified position without a begin/end. Suitable for multiple draw events. /// </summary> public static void DrawString(IRenderConfiguration renderConfig, SpriteFont font, string text, float x, float y, Color color) { if (renderConfig == null) { throw new ArgumentNullException(nameof(renderConfig)); } Vector2 Scale = renderConfig.Scale; Vector2 ScaledOffset = renderConfig.ScaledOffset; renderConfig.PrimitiveRenderManager.SpriteBatch.DrawString(font, text, new Vector2(ScaledOffset.X + (x * Scale.X), ScaledOffset.Y + (y * Scale.Y)), color, 0, Vector2.Zero, new Vector2(Scale.X, Scale.Y), SpriteEffects.None, 1.0f); }
public InputManager(IRenderConfiguration setRenderConfig) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } renderConfig = setRenderConfig; prevMousePos = new Vector2(-1, -1); MouseState mouseState = Mouse.GetState(); prevWheelValue = mouseState.ScrollWheelValue; }
public MyStaticMesh(IRenderConfiguration renderConfig) : base(renderConfig) { VertexBuffer = new VertexBuffer(renderConfig.GraphicsDevice, VertexPositionColor.VertexDeclaration, 3, BufferUsage.WriteOnly); VertexPositionColor vec1 = new VertexPositionColor(new Vector3(-1.5f, 0, 0), Color.Red); VertexPositionColor vec2 = new VertexPositionColor(new Vector3(0, 2, 0), Color.Blue); VertexPositionColor vec3 = new VertexPositionColor(new Vector3(1.5f, -3, 0), Color.Green); VertexBuffer.SetData <VertexPositionColor>(new VertexPositionColor[] { vec1, vec2, vec3 }); PrimitiveType = PrimitiveType.TriangleList; PrimitiveCount = 1; }
public UITextureButton(IRenderConfiguration renderConfig, string setText, SpriteFont setFont, Graphics2D.Texture releaseButtonTexture, Graphics2D.Texture pressedButtonTexture) : base(renderConfig, setText, setFont) { backgroundClicked = pressedButtonTexture; backgroundNotClicked = releaseButtonTexture; Width = 0; Height = 0; if (backgroundNotClicked != null) { Width = backgroundNotClicked.Width; Height = backgroundNotClicked.Width; } }
internal static void RenderQuad(Vector2 screenPosition, Vector2 size, Color col, float rotation, Texture2D texture, IRenderConfiguration currentRenderConfig) { if (renderConfig == null) { throw new InvalidOperationException(nameof(renderConfig) + " must not be null (call Initialize first)"); } if (currentRenderConfig != renderConfig) { renderConfig = currentRenderConfig; RenderConfigDidUpdate(); } renderConfig.GraphicsDevice.SetVertexBuffer(vbuffer); Matrix worldMat = Matrix.Identity; if (rotation > 0) { worldMat = Matrix.CreateScale(size.X, size.Y, 0) * Matrix.CreateTranslation(-size.X * 0.5f, -size.Y * 0.5f, 0) * Matrix.CreateRotationZ(rotation) * Matrix.CreateTranslation(size.X * 0.5f, size.Y * 0.5f, 0) * Matrix.CreateTranslation(screenPosition.X, screenPosition.Y, 0); } else { worldMat = Matrix.CreateScale(size.X, size.Y, 0) * Matrix.CreateTranslation(screenPosition.X, screenPosition.Y, 0); } quadEffect.World = worldMat; quadEffect.Texture = texture; quadEffect.DiffuseColor = col.ToVector3(); quadEffect.Alpha = (float)col.A / 255.0f; renderConfig.GraphicsDevice.BlendState = blendState; renderConfig.GraphicsDevice.SamplerStates[0] = SamplerState.AnisotropicClamp; for (int i = 0; i < quadEffect.CurrentTechnique.Passes.Count; i++) { quadEffect.CurrentTechnique.Passes[i].Apply(); renderConfig.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } }
public Texture(IRenderConfiguration setRenderConfig, Texture2D setNativeTexture) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } if (setNativeTexture == null) { throw new ArgumentNullException(nameof(setNativeTexture)); } renderConfig = setRenderConfig; nativeTexture = setNativeTexture; Width = nativeTexture.Width; Height = nativeTexture.Height; }
public UIImage(IRenderConfiguration renderConfig, Texture setImage) : base(renderConfig) { resizeImageToFill = false; image = setImage; ImageContentGravity = UIImageContentGravity.Center; ImageScaleMode = UIImageContentScaleMode.Stretch; if (image != null) { Width = Image.Width; Height = Image.Height; } }
/*private void RenderMeshPart(SkeletalMeshPart part, * RenderManager renderManager, * Graphics2D.IRenderConfiguration renderConfig, * Material materialToUse) * { * SkinnedEffect skinEff = part.Material.Effect as SkinnedEffect; * if (skinEff == null) * { * return; * } * * skinEff.WeightsPerVertex = 1; * * skinEff.AmbientLightColor = Vector3.One; * skinEff.FogEnabled = false; * * skinEff.SetBoneTransforms(part.BoneMatrics); * * skinEff.World = WorldMatrix; * skinEff.View = renderManager.ViewTarget.ViewMatrix; * skinEff.Projection = renderManager.ViewTarget.ProjectionMatrix; * * skinEff.Parameters["WorldViewProj"].SetValue(WorldMatrix * * renderManager.ViewTarget.ViewMatrix * * renderManager.ViewTarget.ProjectionMatrix); * part.Material.Effect.CurrentTechnique.Passes[0].Apply(); * * if (part.DiffuseTexture != null) * { * part.Material.Effect.Parameters["Texture"].SetValue(part.DiffuseTexture); * part.Material.Effect.CurrentTechnique.Passes[0].Apply(); * } * * renderConfig.GraphicsDevice.SetVertexBuffer(part.VertexBuffer); * renderConfig.GraphicsDevice.DrawPrimitives(part.PrimitiveType, 0, part.PrimitiveCount); * }*/ private void DrawBone(RuntimeBone bone, RenderManager renderManager, IRenderConfiguration renderConfig) { /*if (effect == null) * { * effect = new BasicEffect(renderConfig.GraphicsDevice); * } * * VertexPositionColor v1 = new VertexPositionColor(); * v1.Color = Color.Red; * v1.Position = bone.CombinedTransform.Translation; * * VertexPositionColor v2 = new VertexPositionColor(); * v2.Color = Color.Blue; * v2.Position = bone.ParentBone.CombinedTransform.Translation; * * Vector3 midPoint = v1.Position + ((v2.Position - v1.Position) * 0.5f); * Vector3 screenPos = renderConfig.GraphicsDevice.Viewport.Project(midPoint, * renderManager.ViewTarget.ProjectionMatrix, * renderManager.ViewTarget.ViewMatrix, * WorldMatrix); * renderConfig.PrimitiveRenderManager.SpriteBatch.Begin(); * renderConfig.PrimitiveRenderManager.SpriteBatch.DrawString(renderConfig.PrimitiveRenderManager.EngineFont, * bone.BoneName, * new Vector2(screenPos.X, screenPos.Y), * Color.Yellow); * renderConfig.PrimitiveRenderManager.SpriteBatch.End(); * * effect.TextureEnabled = false; * effect.VertexColorEnabled = true; * effect.FogEnabled = false; * effect.LightingEnabled = false; * * effect.Parameters["WorldViewProj"].SetValue(WorldMatrix * * renderManager.ViewTarget.ViewMatrix * * renderManager.ViewTarget.ProjectionMatrix); * * effect.CurrentTechnique.Passes[0].Apply(); * * renderConfig.GraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.LineList, * new VertexPositionColor[] { v1, v2 }, 0, 1); * * for (int i = 0; i < bone.ChildBones.Length; i++) * { * DrawBone(bone.ChildBones[i], renderManager, renderConfig); * }*/ }
public virtual void Init(IRenderConfiguration setRenderConfig) { Contract.Requires(setRenderConfig != null); mouseCursorWasVisible = false; isMouseCaptured = false; RenderConfig = setRenderConfig; ContentManager = new ContentManager(AlkaronCoreGame.Core.Content.ServiceProvider, "Content"); SceneGraph = new SceneGraph(this); RenderManager = new RenderManager(RenderConfig); Init3D(); InitUI(); RenderManager.Start(); }
public UITextField(IRenderConfiguration renderConfig, SpriteFont setFont = null, string setText = "") : base(renderConfig) { firstKeyRepeat = true; lastPressedKey = Keys.None; blinkTimeStartTotalSeconds = -1; lastPressedKeyTimestamp = -1; cursorPos = 0; Text = setText; Font = setFont ?? renderConfig.PrimitiveRenderManager.EngineFont; Padding = 10; renderCursor = false; Focusable = true; if (string.IsNullOrEmpty(Text) == false) { cursorPos = Text.Length; } }
public Texture(IRenderConfiguration setRenderConfig, string contentFilename) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } if (contentFilename == null) { throw new ArgumentNullException(nameof(contentFilename)); } renderConfig = setRenderConfig; using (var stream = AlkaronCoreGame.Core.AlkaronContent.OpenContentStream(contentFilename)) { nativeTexture = Texture2D.FromStream(renderConfig.GraphicsDevice, stream); } Width = nativeTexture.Width; Height = nativeTexture.Height; }
public Texture(IRenderConfiguration setRenderConfig, int width, int height, byte[] data = null) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } renderConfig = setRenderConfig; Width = width; Height = height; if (renderConfig.RequiresPowerOfTwoTextures) { width = (int)NextPowerOfTwo((uint)width); height = (int)NextPowerOfTwo((uint)height); } nativeTexture = new Texture2D(renderConfig.GraphicsDevice, width, height, false, SurfaceFormat.Color); SetData(data); }
public UIMessageBox(IRenderConfiguration renderConfig) : base(renderConfig) { BackgroundColor = new Color(Color.White, 0.0f); dismissButton = new UIButton(renderConfig, "Ok", AlkaronCoreGame.Core.DefaultFont, UIButtonStyle.Flat); dismissButton.OnPointerUpInside += DismissButton_OnPointerUpInside; headerLabel = new UILabel(renderConfig, "", AlkaronCoreGame.Core.DefaultFont); headerLabel.BackgroundColor = new Color(Color.Gray, 1.0f); textLabel = new UILabel(renderConfig, "", AlkaronCoreGame.Core.DefaultFont); textLabel.TextAlignVertical = UITextAlignVertical.Top; backgroundPanel = new UIPanel(renderConfig); backgroundPanel.BackgroundColor = new Color(Color.Gray, 0.9f); AddComponent(backgroundPanel); backgroundPanel.AddComponent(headerLabel); backgroundPanel.AddComponent(textLabel); backgroundPanel.AddComponent(dismissButton); }
internal static void Initialize(IRenderConfiguration setRenderConfig) { renderConfig = setRenderConfig; quadDecl = new VertexDeclaration(new VertexElement[] { new VertexElement(0, VertexElementFormat.Vector4, VertexElementUsage.Position, 0), new VertexElement(16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), }); vertices = new ScreenQuadVertex[4]; vertices[0] = new ScreenQuadVertex { Position = new Vector4(0, 0, 0, 1), TexCoord = new Vector2(0, 0) }; vertices[1] = new ScreenQuadVertex { Position = new Vector4(1, 0, 0, 1), TexCoord = new Vector2(1, 0) }; vertices[2] = new ScreenQuadVertex { Position = new Vector4(0, 1, 0, 1), TexCoord = new Vector2(0, 1) }; vertices[3] = new ScreenQuadVertex { Position = new Vector4(1, 1, 0, 1), TexCoord = new Vector2(1, 1) }; blendState = BlendState.AlphaBlend; vbuffer = new VertexBuffer(renderConfig.GraphicsDevice, quadDecl, 4, BufferUsage.WriteOnly); vbuffer.SetData <ScreenQuadVertex>(vertices); quadEffect = new BasicEffect(renderConfig.GraphicsDevice); quadEffect.FogEnabled = false; quadEffect.LightingEnabled = false; quadEffect.TextureEnabled = true; quadEffect.DiffuseColor = new Vector3(1, 1, 1); quadEffect.World = Matrix.Identity; quadEffect.Projection = Matrix.CreateOrthographicOffCenter(0, renderConfig.ScreenSize.X, renderConfig.ScreenSize.Y, 0, 0, -500); quadEffect.View = Matrix.Identity; }
/// <summary> /// Draws a text at the specified position nested in a begin/end. Suitable for quick single line drawing. /// </summary> public static void DrawStringDirect(IRenderConfiguration renderConfig, SpriteFont font, string text, float x, float y, Color color, float scale, float deg_rotation = 0) { if (renderConfig == null) { throw new ArgumentNullException(nameof(renderConfig)); } Vector2 Scale = renderConfig.Scale; Vector2 ScaledOffset = renderConfig.ScaledOffset; float radRotation = deg_rotation * ((float)Math.PI / 180.0f); Vector2 pos = new Vector2(ScaledOffset.X + (x * Scale.X), ScaledOffset.Y + (y * Scale.Y)); Vector2 scaleVec = new Vector2(Scale.X * scale, Scale.Y * scale); renderConfig.PrimitiveRenderManager.SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.AnisotropicWrap, DepthStencilState.None, RasterizerState.CullCounterClockwise); renderConfig.PrimitiveRenderManager.SpriteBatch.DrawString(font, text, pos, color, radRotation, Vector2.Zero, scaleVec, SpriteEffects.None, 1.0f); renderConfig.PrimitiveRenderManager.SpriteBatch.End(); }
public UIBaseComponent(IRenderConfiguration setRenderConfig) { if (setRenderConfig == null) { throw new ArgumentNullException(nameof(setRenderConfig)); } widthSizeMode = UISizeMode.Fixed; heightSizeMode = UISizeMode.Fixed; isPerformingLayout = false; suppressPerformLayout = false; customLayoutHooks = new Dictionary <string, ModifyLayout>(); components = new List <UIBaseComponent>(); animations = new List <UIAnimation>(); renderConfig = setRenderConfig; parentComponent = null; Focusable = false; PositionAnchor = UIPositionAnchor.TopLeft; BackgroundColor = new Color(1.0f, 1.0f, 1.0f, 0.0f); UserInteractionEnabled = true; Visible = true; Alpha = 1.0f; Rotation = 0.0f; }
public RenderManager(IRenderConfiguration setRenderConfig) { maxFPS = -1; ViewTarget = null; nextViewTarget = null; renderThread = null; renderThreadActive = false; lockObj = new Object(); renderProxyStagingArea = new List<BaseRenderProxy>(); renderPasses = new List<RenderPass>(); renderConfig = setRenderConfig; CreateRenderTarget(); CreateEffectLibrary(); CreateMaterialLibrary(); frameCounter = 0; frameCalcStart = System.Diagnostics.Stopwatch.GetTimestamp(); MaxRenderCount = -1; }
public override void Init(IRenderConfiguration setRenderConfig) { base.Init(setRenderConfig); }