Ejemplo n.º 1
0
        public BmFont(Texturing texturingManager, string name)
        {
            System.Console.WriteLine("Loading BmFont \"" + name + "\"");

            texId = texturingManager.LoadTexture(fontDir + name + ".png");
            string[] lines = System.IO.File.ReadAllLines(fontDir + name + ".fnt");

            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i].Trim();

                //Comments
                if (line.StartsWith("#"))
                {
                    continue;
                }

                string[] args = line.Split(' ');

                if (args[0].Equals("common"))
                {
                    parseCommon(args);
                }
                else if (args[0].Equals("char"))
                {
                    parseCharacter(args);
                }
                else if (args[0].Equals("kerning"))
                {
                    parseKerning(args);
                }
            }
        }
Ejemplo n.º 2
0
        void OnWorldInfoReceived(WorldStats worldStats)
        {
            this.worldStats   = worldStats;
            WorldInfoRecieved = true;

            Texture2D texture2D = Texturing.TextureFromColourMap(worldStats.colourWorld, WorldGenerator.worldPartSize, WorldGenerator.worldPartSize);

            meshRenderer.material.mainTexture = texture2D;

            UpdateTerrainChunk();
        }
Ejemplo n.º 3
0
 private void glControl_Load(object sender, EventArgs e)
 {
     glControl.MakeCurrent();
     GL.Enable(EnableCap.Texture2D);
     GL.ClearColor(Color.FromArgb(200, 200, 200));
     renderer  = new Renderer();
     texturing = new Texturing();
     camera    = new Camera(new Vector2(0, 0), 1.0);
     for (int i = 0; i < 52; i++)
     {
         texIds.Add(texturing.LoadTexture("Resources/tiles/" + i + ".png"));
     }
     t          = new System.Timers.Timer(1000.0 / 60.0);
     t.Elapsed += t_Elapsed;
     t.Start();
 }
Ejemplo n.º 4
0
    public void RendWorld()
    {
        WorldStats   worldStats = GenerateWorld(Vector2.zero);
        WorldDisplay display    = FindObjectOfType <WorldDisplay>();

        if (drawMode == DrawMode.NoiseWorld)
        {
            display.DrawTexture(Texturing.TextureFromHeightMap(worldStats.heightWorld));
        }
        else if (drawMode == DrawMode.ColourWorld)
        {
            display.DrawTexture(Texturing.TextureFromColourMap(worldStats.colourWorld, worldPartSize, worldPartSize));
        }
        else if (drawMode == DrawMode.Mesh)
        {
            display.DrawMesh(MeshGenerator.GenerateTerrainMesh(worldStats.heightWorld, meshHeightMultiplier, meshHeightCurve, ValueLevelOfDetail), Texturing.TextureFromColourMap(worldStats.colourWorld, worldPartSize, worldPartSize));
        }
        else if (drawMode == DrawMode.FallMap)
        {
            display.DrawTexture(Texturing.TextureFromHeightMap(FallGenerator.GenerateFall(worldPartSize)));
        }
    }
Ejemplo n.º 5
0
 public void RemoveSprite(Texturing.SpriteTexture sprite)
 {
     if (!allSprites.Contains(sprite)) return;
     allSprites.Remove(sprite);
 }
Ejemplo n.º 6
0
 public void AddSprite(Texturing.SpriteTexture sprite)
 {
     allSprites.Add(sprite);
 }