Ejemplo n.º 1
0
 public void Initialize()
 {
     //map = new Map(@"C:\Repo\randomthing\MapEditor\MapEditor\bin\Debug\maps\test");
     if (initialized)
         return;
     initialized = true;
     Camera = new Camera();
     Camera.Height = glControl.Height;
     Camera.Widht = glControl.Width;
     mouseController = new MouseController();
     creaturesManager = new CreaturesManager();
     SetupOpengl();
     //creaturesManager.LoadPrototypes();
     triggerManager = new TriggersManager();
     if (InitializedEngine != null) InitializedEngine(this, EventArgs.Empty);
 }
Ejemplo n.º 2
0
 public void Draw(Camera cam, SpriteBatch batch)
 {
     Rectangle drawRect = cam.ViewSpace;
     int minX = drawRect.X / tileSize;
     int minY = drawRect.Y / tileSize;
     int maxX = (drawRect.Width + drawRect.X) / tileSize + 1;
     int maxY = (drawRect.Height + drawRect.Y) / tileSize + 1;
     for (int layer = 0; layer < 3; layer++)
         for (int x = minX; x < maxX; x++)
             for (int y = minY; y < maxY; y++)
                 if (isValid(layer, x, y))
                 {
                     if (layer == activeLayer || activeLayer == 3)
                         _layers[layer][x, y].Draw(0.3f + layer / 5.0f, batch, Color.White);
                     else
                         _layers[layer][x, y].Draw(0.3f + layer / 5.0f, batch, Color.Gray);
                 }
     if (activeLayer == 3)
     {
         for (int x = minX; x < maxX; x++)
             for (int y = minY; y < maxY; y++)
             {
                 if (isValidOrNull(0, x, y) && _spawns[x, y] != null && _spawns[x, y].objectID != -1)
                     batch.DrawString(font, _spawns[x, y].objectID.ToString(), new Vector2(tileSize * x, tileSize * y), Color.Red, 0, Vector2.Zero, 0.5f, SpriteEffects.None, 0.6f);
             }
     }
 }
Ejemplo n.º 3
0
 protected override void Initialize()
 {
     batch = new SpriteBatch(GraphicsDevice);
     cam = new Camera(new Vector2(0, 0), new Rectangle(this.Bounds.X,this.Bounds.Y,this.Bounds.Width,this.Bounds.Height));
     //map = new Map(content, 100, 100);
     Application.Idle += delegate { Invalidate(); };
     _drawState = new SamplerState();
     _drawState.Filter = TextureFilter.Point;
 }