protected override void LoadContent() { base.LoadContent(); _systemReady = true; try { FromInternal("{error}", "Error.derpyeyes"); FromInternal("{notex}", "Error.notexture"); FromInternal("{achievement}", "Data.achievements"); FromInternal("{bits}", "UI.bitcollection"); FromInternal("{load}", "Loading.loadingscreen_filler"); var Effect = new Objects.Graphics.BasicEffectObject("{basic_effect}"); var smallFont = new FontObject("{smallfont}", @"fonts\celestia_redux"); _fonts["{smallfont}"] = smallFont; var largeFont = new FontObject("{largefont}", @"fonts\celestia_redux_large"); _fonts["{largefont}"] = largeFont; _frameCapture = new TargetObject("{screen}", GraphicsDevice, EngineGlobals.Settings.WindowWidth, EngineGlobals.Settings.WindowHeight); _empty = CreatePixelTexture("{empty}", Color.Transparent); _singleWhite = CreatePixelTexture("{single}"); } catch (System.Exception ex) { EquestriEngine.ErrorMessage = ex.Message; } LoadTextures(); LoadFonts(); LoadEffects(); LoadSkeletons(); }
public TextureCollection LoadFromLoadList(Objects.Graphics.Misc.TextureLoadList list) { if (!_systemReady) { throw new EngineException("System not ready for creation", true); } TextureCollection collection = new TextureCollection(); foreach (var kvp in list.Entries) { switch (kvp.Value[1].ToString()) { case "Atlas": var atlas = new TextureAtlas(kvp.Key, kvp.Value[0].ToString(), kvp.Value[2]); _textures[atlas.Name] = atlas; collection.Add(atlas.Name, atlas); break; case "Texture": var texture = new TextureObject(kvp.Key, kvp.Value[0].ToString()); _textures[texture.Name] = texture; collection.Add(texture.Name, texture); break; case "Target": var target = CreateTargetObject(kvp.Key, (int)((int[])kvp.Value[2])[0], (int)((int[])kvp.Value[2])[1]); _textures[target.Name] = target; collection.Add(target.Name, target); break; } } LoadTextures(); return(collection); }
public void Draw(TextureObject textureObject, Rectangle destRect, Rectangle?sourceRect, Color color, float rotation, Vector2 origin, int effects, float depth) { SpriteEffects sfx; switch (effects) { case 1: sfx = SpriteEffects.FlipHorizontally; break; case 2: sfx = SpriteEffects.FlipVertically; break; case 3: sfx = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; break; default: sfx = SpriteEffects.None; break; } base.Draw(textureObject.Texture, destRect, sourceRect, color, rotation, origin, sfx, depth); }
public unsafe int LoadAsPOT(ReadOnlySpan <Color4> pixels) { if (!TextureObject.IsEmpty) { ThrowAlreadyLoaded(); } // Round up the length at first because it may throw an exception. var lengthPowerOfTwo = MathTool.RoundUpToPowerOfTwo(pixels.Length); _to = TextureObject.Create(); _length = lengthPowerOfTwo; TextureObject.Bind1D(_to); SetTextureParams(); // Allocate memory of power of two TextureObject.Image1D(lengthPowerOfTwo, (Color4 *)null, TextureInternalFormat.Rgba32f, 0); fixed(Color4 *ptr = pixels) { // Send pixels of actual length TextureObject.SubImage1D(0, pixels.Length, ptr, 0); } TextureObject.Unbind1D(); return(lengthPowerOfTwo); }
static (IHostScreen Screen, FBO Fbo, TextureObject DepthTex, Vector2i Size) Create(int width, int height) { var screen = Engine.GetValidCurrentContext(); var size = new Vector2i(width, height); var depth = TextureObject.Empty; var fbo = FBO.Empty; try { depth = TextureObject.Create(); TextureObject.Bind2D(depth); TextureObject.DepthImage2DUninitialized(size); TextureObject.Parameter2DMinFilter(TextureShrinkMode.NearestNeighbor, TextureMipmapMode.None); TextureObject.Parameter2DMagFilter(TextureExpansionMode.NearestNeighbor); TextureObject.Parameter2DWrapS(TextureWrapMode.ClampToBorder); TextureObject.Parameter2DWrapT(TextureWrapMode.ClampToBorder); fbo = FBO.Create(); FBO.Bind(fbo, FBO.Target.FrameBuffer); FBO.SetTexture2DBuffer(depth, FBO.Attachment.DepthAttachment); GL.DrawBuffer(DrawBufferMode.None); GL.ReadBuffer(ReadBufferMode.None); FBO.ThrowIfInvalidStatus(); FBO.Unbind(FBO.Target.FrameBuffer); return(Screen : screen, Fbo : fbo, DepthTex : depth, Size : size); } catch { TextureObject.Delete(ref depth); FBO.Delete(ref fbo); throw; } }
public void UnloadTexture(TextureObject texture, bool disposed) { if (disposed) { _content.Unload(texture.Texture); } _textures.Remove(texture.Name); }
public LogoScreen(TextureObject logo, Data.UI.DrawableGameScreen next) : base(true) { EngineGlobals.GameReference.ClearColor = Color.Black; _logoColor = Color.Black; _logo = logo; nextScreen = next; }
public LogoScreen(TextureObject logo, Data.UI.GameScreen next = null) : base(true, false) { EquestriEngine.ClearColor = Color.Black; _logoColor = Color.Black; _logo = logo; nextScreen = next; }
public override void Update(GameTime gameTime) { if (isUpdate) { switch (attributeType) { case Attribute.Rotation: foreach (LevelObject lo in this.list) { if (lo is InteractiveObject) { InteractiveObject io = (InteractiveObject)lo; io.fixture.Body.Rotation += this.step; } if (lo is CollisionObject) { CollisionObject co = (CollisionObject)lo; co.fixture.Body.Rotation += this.step; } if (lo is TextureObject) { TextureObject to = (TextureObject)lo; to.rotation += this.step; } } break; case Attribute.Position: foreach (LevelObject lo in this.list) { if (lo is InteractiveObject) { InteractiveObject io = (InteractiveObject)lo; io.fixture.Body.Position += this.stepV; } if (lo is CollisionObject) { CollisionObject co = (CollisionObject)lo; co.fixture.Body.Position += this.stepV; } if (lo is TextureObject) { TextureObject to = (TextureObject)lo; to.position += this.stepV; } } break; } endValue--; } if (endValue <= 0) { isUpdate = false; } }
protected override void LoadContent() { spriteBatch = new Equestribatch(GraphicsDevice); //_skelebatch = new EquestriSkeleBatch(GraphicsDevice); errorTexture = AssetManager.GetTexture("{error}"); smallFont = AssetManager.GetFont("{smallfont}"); TextureObjectFactory.Device_Ref = GraphicsDevice; base.LoadContent(); }
private void FromInternal(string texName, string imageName) { using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("EquestriEngine.Resources." + imageName + ".png")) { var temp = Microsoft.Xna.Framework.Graphics.Texture2D.FromStream(GraphicsDevice, stream); var newTex = new TextureObject(texName, temp); _textures[texName] = newTex; } }
public override void Init() { entryComplete = displayComplete = delayComplete = exitComplete = false; _bits = EngineGlobals.GameReference.AssetManager.GetTexture("{bits}"); _fontDisplay = EngineGlobals.GameReference.AssetManager.GetFont("{largefont}"); Show(); }
public override void LoadContent() { //_messageBoxWindow = Systems.AssetManager.GetTexture("message_box"); _messageBoxWindowTexture = EngineGlobals.GameReference.AssetManager.CreateTextureObjectFromFile("message_box", @"Graphics\UI\MessageBox"); _nameBoxWindowTexture = EngineGlobals.GameReference.AssetManager.CreateTextureObjectFromFile("name_box", @"Graphics\UI\namebox"); _continueArrowTexture = EngineGlobals.GameReference.AssetManager.CreateTextureObjectFromFile("continue_arrow", @"Graphics\UI\textbox_arrow"); _messageBoxFont = EngineGlobals.GameReference.AssetManager.GetFont("{largefont}"); name = "Fluttershy"; }
public override void LoadContent() { if (fadeBlack) { _background = EngineGlobals.AssetManager.CreatePixelTexture("{background}", Color.Black); } else { _background = EngineGlobals.AssetManager.GetTexture("{load}"); } }
// Update is called once per frame public void Update() { RotateSpeed = -((MaxRotateSpeed - MinRotateSpeed) / MaxSpeed) * MoveSpeed + MaxRotateSpeed; if (Rest) { TextureObject.GetComponent <SpriteRenderer>().material = RestMaterial; } else { TextureObject.GetComponent <SpriteRenderer>().material = ActiveMateiral; } }
public override void Init() { _windowTarget = EngineGlobals.GameReference.AssetManager.CreateTargetObject("{achievementgenerator" + instanceNumber + "}", WIDGET_WIDTH, WIDGET_HEIGHT); _displayFont = EngineGlobals.GameReference.AssetManager.GetFont("{smallfont}"); _windowTexture = EngineGlobals.GameReference.AssetManager.CreatePixelTexture("{awind_texture}"); _achievementTexture = EngineGlobals.GameReference.AssetManager.GetTexture("{achievement}"); _windowTarget.RunTarget(GenerateWidget); Show(); }
public override void LoadContent() { pony1 = EquestriEngine.AssetManager.CapturedFrame; Objects.Graphics.Misc.TextureLoadList list; Objects.Graphics.Misc.TextureLoadList.LoadList(out list, "debug_BattleScreen"); EquestriEngine.AssetManager.LoadFromLoadList(list); #if DEBUG _battleStage = EquestriEngine.AssetManager.GetTexture("{debug_stage}"); #endif base.LoadContent(); _controller.Init(); }
public override void LoadContent() { pony1 = EngineGlobals.AssetManager.CapturedFrame; TextureLoadList list; TextureLoadList.LoadList(out list, "debug_BattleScreen"); EngineGlobals.AssetManager.LoadFromLoadList(list); #if DEBUG _battleStage = EngineGlobals.AssetManager.GetTexture("{debug_stage}"); #endif _controller.Init(); }
public Homework GenerateHomework(float threshold) { GameObject nextButton = new TextureObject(MediaManager.textures["next button"], new Vector2(0, 650)); GameObject prevButton = new TextureObject(MediaManager.textures["prev button"], new Vector2(600, 650)); Paper[] papers = new Paper[problems.Length]; for (int i = 0; i < problems.Length; i++) { papers[i] = problems[i].generatePaper(threshold); } Homework ret = new Homework(nextButton, prevButton, papers); return(ret); }
public TextureObject CreateTextureObjectFromTarget(string name, TargetObject target) { if (!_systemReady) { throw new EngineException("System not ready for creation", true); } if (!_textures.ContainsKey(name)) { TextureObject newTexture = new TextureObject(name, target.Texture); _textures[name] = newTexture; return(newTexture); } else { return(_textures[name]); } }
public TextureObject CreateTextureObjectFromFile(string name, string file) { if (!_systemReady) { throw new Data.Exceptions.EngineException("System not ready for creation", true); } if (!_textures.ContainsKey(name)) { TextureObject newTexture = new TextureObject(name, file); _textures[name] = newTexture; return(newTexture); } else { return(_textures[name]); } }
public TextureObject CreateTextureObjectFromTarget(string name, Microsoft.Xna.Framework.Graphics.RenderTarget2D target) { if (!_systemReady) { throw new EngineException("System not ready for creation", true); } if (!_textures.ContainsKey(name)) { TextureObject newTexture = new TextureObject(name, target, true); _textures[name] = newTexture; return(newTexture); } else { return(_textures[name]); } }
public MaterialManager(string fileName) { matObjectList = new List <MaterialObject>(); textureObjectList = new List <TextureObject>(); using (StreamReader textureSR = new StreamReader(fileName)) { while (textureSR.Peek() > -1) { string line = textureSR.ReadLine(); string[] result = line.Split(new string[] { "\n", "\r\n", "," }, StringSplitOptions.RemoveEmptyEntries); TextureObject texObject = new TextureObject(result[0], "Textures/" + result[1]); textureObjectList.Add(texObject); SortTextures(texObject); //new Thread(() => { SortTextures(texObject); }).Start(); } } }
public Textures(string FileName, string PackageName = "") { if (FileName.FileExists() == false) { throw new System.IO.FileNotFoundException(FileName); } BaseDirectory = FileName.GetDirectoryFromFileLocation(); XElement xelement = XElement.Load(FileName); this.Name = xelement.Element("name").Value; this.AuthorName = xelement.Element("author").Value; this.ID = xelement.Element("id").Value; this.Description = xelement.Element("description").Value; this.UpdateDate = xelement.Element("date").Value; this.PackageName = PackageName; IEnumerable <XElement> TextureObjects = xelement.Elements().Where(x => x.Name.ToString() == "textures"); foreach (var TextureObject in TextureObjects.Elements().Where(x => x.Name.ToString() == "texture")) { TextureInfo _NewTexture = new Assets.TextureInfo(); _NewTexture.ID = TextureObject.Element("id").Value; _NewTexture.Name = TextureObject.Element("name").Value; _NewTexture.FileName = TextureObject.Element("filename").Value; if (System.IO.File.Exists(this.BaseDirectory.EnsureDirectoryFormat() + _NewTexture.FileName) == false) { this.LoadErrors.Add("Error Locating Image File", this.BaseDirectory.EnsureDirectoryFormat() + _NewTexture.FileName); continue; } _NewTexture.Description = TextureObject.Element("description").Value; _NewTexture.DisplayName = TextureObject.Element("displayname").Value; _NewTexture.AnimationSeq = TextureObject.Element("animationseq").Value.ToInt(); _NewTexture.AnimationGroup = TextureObject.Element("animationgroup").Value; _NewTexture.AnimationDisplayTime = TextureObject.Element("animationdisplaytime").Value.ToInt(); _NewTexture.Image = new CompressibleImage(System.Drawing.Image.FromFile(this.BaseDirectory.EnsureDirectoryFormat() + _NewTexture.FileName), System.Drawing.Imaging.ImageFormat.Png); AllTextures.Add(_NewTexture.Name, _NewTexture); } }
public override void LoadContent() { //_messageBoxWindow = Systems.AssetManager.GetTexture("message_box"); if (_messageBoxWindowTexture == null) { _messageBoxWindowTexture = new TextureObject("message_box", @"Graphics\UI\MessageBox"); _nameBoxWindowTexture = new TextureObject("name_box", @"Graphics\UI\namebox"); _continueArrowTexture = new TextureObject("continue_arrow", @"Graphics\UI\textbox_arrow"); } _messageBoxFont = EquestriEngine.AssetManager.GetFont("{largefont}"); boxOrigin = new Vector2(_messageBoxWindowTexture.Width / 2, _messageBoxWindowTexture.Height / 2); name = "Fluttershy"; if (name != null) { _nameBoxWindow = EquestriEngine.AssetManager.CreateTargetObject("{namebox_texture}", (int)_messageBoxFont.Measure(name).X + 50, 74); _nameBoxWindow.RunTarget(DrawNameBox, Color.Transparent); } base.LoadContent(); }
private void SortTextures(TextureObject texObj) { //checks to see if there is something in the list already for a comarison if (matObjectList.Count > 0) { for (int i = 0; i < matObjectList.Count; i++) { if (matObjectList[i].GetMatTag == texObj.GetTextureTag) { matObjectList[i].AddTexture(texObj); return; } } matObjectList.Add(new MaterialObject(texObj.GetTextureTag)); matObjectList[matObjectList.Count - 1].AddTexture(texObj); } //if we get here, we can assume that we are at the start of the list and we need to create an entry into the matrial manager else { matObjectList.Add(new MaterialObject(texObj.GetTextureTag)); matObjectList[0].AddTexture(texObj); } }
public unsafe void Load(ReadOnlySpan <Color4> pixels) { if (!TextureObject.IsEmpty) { ThrowAlreadyLoaded(); } if (pixels.IsEmpty) { return; } _to = TextureObject.Create(); _length = pixels.Length; TextureObject.Bind1D(_to); SetTextureParams(); fixed(Color4 *ptr = pixels) { TextureObject.Image1D(pixels.Length, ptr, TextureInternalFormat.Rgba32f, 0); } TextureObject.Unbind1D(); }
public override void LoadContent() { _bubbles = new TextureObject("{bubz}", @"Graphics\UI\menu_bubbles"); _pixel = new TextureObject("{bubz}", @"Graphics\UI\menu_bubbles"); }
private void EventView_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) { EventView.SelectedNode = EventView.GetNodeAt(e.X, e.Y); if (EventView.SelectedNode == null) { return; } if (EventView.SelectedNode.Tag is Layer) { Layer l = (Layer)EventView.SelectedNode.Tag; Editor.Default.selectLayer(l); propertyGrid1.SelectedObject = l; } if (EventView.SelectedNode.Tag is Event) { Event ev = (Event)EventView.SelectedNode.Tag; Editor.Default.selectLevelObject(ev); selectedEvent = ev; propertyGrid1.SelectedObject = ev; Camera.Position = ev.position; } if (EventView.SelectedNode.Tag is InteractiveObject) { InteractiveObject lo = (InteractiveObject)EventView.SelectedNode.Tag; Editor.Default.selectLevelObject(lo); selectedLevelObject2 = lo; Event ev = (Event)EventView.SelectedNode.Parent.Tag; selectedEvent = ev; propertyGrid1.SelectedObject = lo; Camera.Position = lo.position; } if (EventView.SelectedNode.Tag is CollisionObject) { CollisionObject lo = (CollisionObject)EventView.SelectedNode.Tag; Editor.Default.selectLevelObject(lo); selectedLevelObject2 = lo; Event ev = (Event)EventView.SelectedNode.Parent.Tag; selectedEvent = ev; propertyGrid1.SelectedObject = lo; Camera.Position = lo.position; } if (EventView.SelectedNode.Tag is SoundObject) { SoundObject so = (SoundObject)EventView.SelectedNode.Tag; Editor.Default.selectLevelObject(so); selectedLevelObject2 = so; Event ev = (Event)EventView.SelectedNode.Parent.Tag; selectedEvent = ev; propertyGrid1.SelectedObject = so; } if (EventView.SelectedNode.Tag is TextureObject) { TextureObject to = (TextureObject)EventView.SelectedNode.Tag; Editor.Default.selectLevelObject(to); selectedLevelObject2 = to; Event ev = (Event)EventView.SelectedNode.Parent.Tag; selectedEvent = ev; propertyGrid1.SelectedObject = to; } } }
public void Draw(TextureObject textureObject, Rectangle destRect, Rectangle?sourceRect, Color color) { base.Draw(textureObject.Texture, destRect, sourceRect, color); }