示例#1
0
 public Minima()
 {
     GameObjectManager = new GameObjectManager();
     SystemManager     = new SystemManager();
     ObjectBuffer      = new ObjectBuffer();
     _mutex            = new Mutex();
     _instance         = this;
 }
示例#2
0
        public GameObject(string name)
        {
            Id   = new ObjectID();
            Name = name;

            _components = new Dictionary <Type, GameComponent>();
            Minima.GetInstance().GameObjectManager.AddGameObject(this);
        }
示例#3
0
        public override void OnUpdate(GameObject gameObject)
        {
            var a = gameObject.GetComponent <RenderComponent>();
            var b = gameObject.GetComponent <TransformComponent>();
            var s = (Sprite)a.Drawable;

            if (s.GetGlobalBounds().Intersects(Minima.GetInstance().Camera.GetView().Viewport))
            {
                //if (IsInView(b.LocalPosition, s.TextureRect))
                a.Drawable.Draw(Minima.GetInstance().Window, b._it.Transform);
            }
        }
示例#4
0
        internal void Update()
        {
            OnUpdateStart();
            var objects = Minima.GetInstance().ObjectBuffer.GetGameObjects(Components.ToArray());

            for (var index = 0; index < objects.Count; index++)
            {
                var a = Minima.GetInstance().GameObjectManager.GetGameObjectByID(objects[index]);
                OnUpdate(a);
            }

            OnUpdateEnd(objects);
        }
示例#5
0
        public void Draw()
        {
            RenderStates states = new RenderStates()
            {
                BlendMode = BlendMode.None,
                Transform = Transform.Identity,
                Texture   = _texture,
                Shader    = null
            };

            _batch.Draw(Minima.GetInstance().Window, states);
            var s = new Sprite();

            s.TextureRect = new IntRect(0, 0, 10, 10);
            s.Draw(Minima.GetInstance().Window, new RenderStates()
            {
                BlendMode = BlendMode.None,
                Transform = Transform.Identity,
                Texture   = _texture,
                Shader    = null
            });
            _batch.Clear();
        }
示例#6
0
 public override void OnUpdateStart()
 {
     Minima.GetInstance().Window.Clear(Color.Black);
 }
示例#7
0
 internal void Init(GameObject gameObject)
 {
     Minima.GetInstance().ObjectBuffer.AddGameObject(this.GetType(), gameObject);
 }