public void AddPrototype(string path,bool isbase)
 {
     string name =Path.GetFileName(path);
     Texture t = new Texture(name.GetHashCode(), 0, Path.Combine(path,avatar), isbase);
     prototypes[name] = new Creature(new System.Drawing.Point(0, 0), t,name);
     prototypes[name].Path = path;
 }
Example #2
0
        public void Draw(float x, float y, Texture t)
        {
            GL.BindTexture(TextureTarget.Texture2D, t.TextureName);
            x *= SIZE;
            y *= SIZE;
            GL.Begin(BeginMode.Quads);
            GL.PushMatrix();

            int i = 0;
            /*
            GL.TexCoord2(1, 1);

            GL.Vertex2(x, y);
            GL.TexCoord2(1, 0);
            GL.Vertex2(x, y + SIZE);
            GL.TexCoord2(0, 0);
            GL.Vertex2(x + SIZE, y + SIZE);
            GL.TexCoord2(0, 1);
            */
            GL.TexCoord2(0, 1);

            GL.Vertex2(x, y);
            GL.TexCoord2(0, 0);
            GL.Vertex2(x, y + SIZE);
            GL.TexCoord2(1, 0);
            GL.Vertex2(x + SIZE, y + SIZE);
            GL.TexCoord2(1, 1);

            GL.Vertex2(x + SIZE, y);
            GL.End();
            GL.PopMatrix();
        }
 public void AddPrototypeWithLoad(string path, bool isbase)
 {
     string name = Path.GetFileName(path);
     if (prototypes.ContainsKey(name))
     {
         prototypes[name].Remove();
     }
     Texture t = new Texture(name.GetHashCode(), 0, Path.Combine(path, avatar), isbase);
     t.Load();
     prototypes[name] = new Creature(new System.Drawing.Point(0, 0), t, name);
     prototypes[name].Path = path;
 }
Example #4
0
 public Field(Texture texture, bool colisable)
 {
     this.texture = texture;
     this.colisable = colisable;
 }
Example #5
0
 public ClickHandler GetClickHandlerTile(Texture text)
 {
     ClickHandlerTileCreator.Instance.Texture = text;
     return ClickHandlerTileCreator.Instance;
 }
Example #6
0
 public Creature(Point Location, Texture Avatar, string name)
 {
     this.Avatar = Avatar;
     this.Location = Location;
     this.Name = name;
 }
Example #7
0
        private void loadSpecials()
        {
            Texture start = new Texture(START, 0, Path.Combine(basepath, specialTextures, startPositionTexture), true);
            start.Load();

            specials[START] = start;

            Texture trigger = new Texture(TRIGGER, 0, Path.Combine(basepath, specialTextures, triggerImage), true);
            trigger.Load();
            specials[TRIGGER] = trigger;
        }
Example #8
0
 private void loadTextures(string path,bool basic)
 {
     string texturefolder = Path.Combine(path, texturesPath);
     string texturefile = Path.Combine(path, texturesFile);
     try
     {
         using (StreamReader sr = new StreamReader(texturefile))
         {
             while (!sr.EndOfStream)
             {
                 string[] line = sr.ReadLine().TrimEnd('\r', '\t', ' ', '\n').Split(' ');
                 int id = Convert.ToInt32(line[0]);
                 textures[id] = new Texture(id, 0, Path.Combine(texturefolder, line[1]),basic);
             }
         }
     }
     catch (FileNotFoundException ex)
     {
         throw new MapLoadException("Cannot find tails.txt (" + path + ")", ex);
     }
     catch (IndexOutOfRangeException ex)
     {
         throw new MapLoadException("Incorrect format", ex);
     }
     catch (Exception ex)
     {
         throw new MapLoadException("Exception during loading a map", ex);
     }
 }
Example #9
0
 private void LoadBackground()
 {
     Texture background = new Texture(BACKGROUND, 0, Path.Combine(mapfolder, Map.background), true);
     background.Load();
     specials[BACKGROUND] = background;
     backgraundOn = true;
     backBit = background.Bmp;
 }
Example #10
0
        public void SetBackground(string filename)
        {
            Bitmap temp = new Bitmap(filename);
            backBit = temp;//Utils.InteligentResize(temp);
            if (backgraundOn)
            {
                specials[BACKGROUND].Remove();

            }
            Texture txt = new Texture(BACKGROUND, 0, filename, true);
            txt.Load();
            specials[BACKGROUND] = txt;
            backgraundOn = true;
        }
Example #11
0
 public void EditFieldTexture(int x, int y, Texture txt)
 {
     GetField(x, y).Texture = txt;
 }
Example #12
0
 private void listViewBaseTiles_SelectedIndexChanged(object sender, EventArgs e)
 {
     ListView.SelectedListViewItemCollection coll;
     coll = listViewBaseTiles.SelectedItems;
     if (coll.Count > 0)
     {
         TextureReplaced = coll[0].Tag as Texture;
     }
 }
Example #13
0
 private void buttonAddTile_Click(object sender, EventArgs e)
 {
     using (AddTile at = new AddTile())
     {
         if (at.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Texture t = new Texture(getNewId()+1, 0, null, false);
             EditorEngine.Instance.Map.textures[t.IdTexture] = t;
             t.Bmp = at.picture;
             t.Load();
             il.Images.Add(t.Bmp);
             ListViewItem item = new ListViewItem("Own", indexImage++);
             item.Tag = t;
             listViewTiles.Items.Add(item);
         }
     }
 }