public static void DrawHollowRectangle(SpriteBatch batch, Rectangle sourceRect, Color color, int border = 1) { Texture2D fill = AeEngine.Singleton().TextureManager.GetFillTexture(); Rectangle rect; rect.X = sourceRect.X; rect.Y = sourceRect.Y; rect.Width = sourceRect.Width; rect.Height = border; batch.Draw(fill, rect, color); rect.X = sourceRect.X; rect.Y = (sourceRect.Y + sourceRect.Height - 1); rect.Width = sourceRect.Width; rect.Height = border; batch.Draw(fill, rect, color); rect.X = sourceRect.X; rect.Y = sourceRect.Y; rect.Width = border; rect.Height = sourceRect.Height; batch.Draw(fill, rect, color); rect.X = sourceRect.X + sourceRect.Width; rect.Y = sourceRect.Y; rect.Width = border; rect.Height = sourceRect.Height; batch.Draw(fill, rect, color); }
public static void DrawRectangle(SpriteBatch batch, int x, int y, int width, int height, Color color) { Texture2D fill = AeEngine.Singleton().TextureManager.GetFillTexture(); Rectangle dest; dest.X = x; dest.Y = y; dest.Width = width; dest.Height = height; batch.Draw(fill, dest, color); }
public AeEntity() { Engine = AeEngine.Singleton(); Transform = new AeTransform(); CollisionHull = new AeAABB(); Components = new List <AeComponent>(); Entities = new List <IAeEntity>(); _privateComponents = new List <AeComponent>() { Transform, CollisionHull }; }
public Texture2D CreateFilledRectangle(int width, int height, Color color) { string uniqueName = "ProceduralObject" + "00" + proceduralObjectCounter++; Color[] myColor = new Color[width * height]; // TODO thjis caused a memory leak and crashed in a soak test of about 30 mins. Fix this shit. Texture2D tex = new Texture2D(AeEngine.Singleton().GameReference.GraphicsDevice, width, height, false, SurfaceFormat.Color); for (int i = 0; i < myColor.Length; i++) { myColor[i] = color; } tex.SetData <Color>(myColor); return(LoadProceduralTexture(uniqueName, tex)); }
public bool IsTouched(AeAABB boundingBox) { //todo position adjustment relative to game/screen resolution int gameResolutionWidth = AeEngine.Singleton().Graphics.GraphicsSettings.GameResolutionWidth; int gameResolutionHeight = AeEngine.Singleton().Graphics.GraphicsSettings.GameResolutionHeight; int screenResolutionWidth = AeEngine.Singleton().Graphics.GraphicsSettings.ScreenResolutionWidth; int screenResolutionHeight = AeEngine.Singleton().Graphics.GraphicsSettings.ScreenResolutionHeight; foreach (var touch in _touchCollection) { float touchModifierX = gameResolutionWidth / (float)screenResolutionWidth; float touchModifierY = gameResolutionHeight / (float)screenResolutionHeight; var position = touch.Position; position.X *= touchModifierX; position.Y *= touchModifierY; if (boundingBox.Overlaps(new Vector2(position.X, position.Y))) { return(true); } } return(false); }
public Vector2?GetFirstTouchPosition() { if (_touchCollection.Count == 0) { return(null); } var touch = _touchCollection.FirstOrDefault(); if (touch != null && touch.State == TouchLocationState.Moved) { int gameResolutionWidth = AeEngine.Singleton().Graphics.GraphicsSettings.GameResolutionWidth; int gameResolutionHeight = AeEngine.Singleton().Graphics.GraphicsSettings.GameResolutionHeight; int screenResolutionWidth = AeEngine.Singleton().Graphics.GraphicsSettings.ScreenResolutionWidth; int screenResolutionHeight = AeEngine.Singleton().Graphics.GraphicsSettings.ScreenResolutionHeight; float touchModifierX = gameResolutionWidth / (float)screenResolutionWidth; float touchModifierY = gameResolutionHeight / (float)screenResolutionHeight; var position = touch.Position; position.X *= touchModifierX; position.Y *= touchModifierY; return(position); } return(null); }
public AeComponent() { Engine = AeEngine.Singleton(); }
public Resources(AeEngine engine) { _engine = engine; }
public AeAnimation(string pathToTexture, AeAnimator parent, AeAnimationFrame[] frames = null) : this(AeEngine.Singleton().TextureManager.LoadTexture(pathToTexture), parent, frames) { }
public AeState() : base() { Engine = AeEngine.Singleton(); Camera = new AeCamera(); CameraEnabled = true; }