Exemple #1
0
        public PlanetCute(Vector3i size)
            : base(null)
        {
            m_num_cells = size;
            m_cells     = new Cell[size.Product()];
            m_z_count   = new int[size.Xy.Product()];
            for (int i = 0; i < m_z_count.Length; ++i)
            {
                m_z_count[i] = 0;
            }
            TextureInfo = BlocksMap;
            Vector2 pixel_size = CalcSizeInPixels();

            SpriteSize     = pixel_size / pixel_size.X;
            m_cell_size    = SpriteSize;
            m_cell_size.Y *= (80.0f / pixel_size.Y);
            m_stack_height = SpriteSize.Y * (40.0f / pixel_size.Y);
        }
Exemple #2
0
        public IsometricScene(Vector3i size)
            : base(null)
        {
            TileMap = new TextureInfo(new Texture2D("/Application/Sample/GameEngine2D/FeatureCatalog/data/iso-64x64-outside.png", false), new Vector2i(10, 16));
            TileMap.Texture.SetFilter(TextureFilterMode.Nearest);

            ExampleImage = new TextureInfo(new Texture2D("/Application/Sample/GameEngine2D/FeatureCatalog/data/iso-64x64-outside-example.png", false));
            ExampleImage.Texture.SetFilter(TextureFilterMode.Nearest);

            X = new Vector2(2.0f, 1.0f).Normalize();
            Y = new Vector2(-2.0f, 1.0f).Normalize();

            // make sure width of a tile is 1
            float scale = Y.ProjectOnLine(Math._00, Math._10).Length() * 2.0f;

            X /= scale;
            Y /= scale;

            ToIso   = new Matrix3(X.Xy0, Y.Xy0, Math._001);
            FromIso = ToIso.Inverse();

            m_edit_z        = 0;
            m_second_object = false;
            m_blocks_list   = new List <RawSpriteTile>();

            m_num_cells = size;
            m_cells     = new Cell[size.Product()];
            TextureInfo = TileMap;

            ScheduleUpdate();

            BlendMode       = BlendMode.None;
            m_selected_tile = new Vector2i(4, 10);

            m_tile_select_camera = new Camera2D(Director.Instance.GL, Director.Instance.DrawHelpers);
            m_tile_select_camera.SetViewFromViewport();

            m_gui_camera = new Camera2D(Director.Instance.GL, Director.Instance.DrawHelpers);

//			Director.Instance.DebugFlags &= ~DebugFlags.DrawGrid; // shows the default grid (expensive)
        }