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; }
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; }
public Field(Texture texture, bool colisable) { this.texture = texture; this.colisable = colisable; }
public ClickHandler GetClickHandlerTile(Texture text) { ClickHandlerTileCreator.Instance.Texture = text; return ClickHandlerTileCreator.Instance; }
public Creature(Point Location, Texture Avatar, string name) { this.Avatar = Avatar; this.Location = Location; this.Name = name; }
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; }
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); } }
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; }
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; }
public void EditFieldTexture(int x, int y, Texture txt) { GetField(x, y).Texture = txt; }
private void listViewBaseTiles_SelectedIndexChanged(object sender, EventArgs e) { ListView.SelectedListViewItemCollection coll; coll = listViewBaseTiles.SelectedItems; if (coll.Count > 0) { TextureReplaced = coll[0].Tag as Texture; } }
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); } } }