public void Resize(Size size) { if (curstate != null) { curstate.OnResize(size); } }
public void Resize(Size size, bool fixviewport = false) { destDrawArea = size; if (fixviewport) { _ViewPort.Width = (int)((float)_ViewPort.Height / (float)size.Height * (float)size.Width); } UpdateDrawInfo(); NeedUpdateAll(this.sceneroot); NeedUpdateAll(this.uilayer); }
void FillChar(char c) { if (charposs.ContainsKey(c)) { return; } UInt32[] data; Size size = _font.GetCharDataDC(c, out data, _fillcolor, _bordercolor); Point p; var b = packer.TryPack(size.Width, size.Height, out p); Texture2D tex; if (b) { charposs[c] = new charpos( new Rectangle(p.X, p.Y, size.Width, size.Height) , _tex.Count - 1 ); } else { //if (_font.maxcharheight <= 16) { _tex.Add(new Texture2D(_device, 512, 512)); packer = new SimpleRectanglePacker(512, 512); } //else //{ // _tex.Add(new Texture2D(_device, 1024, 1024)); // packer = new SimpleRectanglePacker(1024, 1024); //} packer.TryPack(size.Width, size.Height, out p); charposs[c] = new charpos( new Rectangle(p.X, p.Y, size.Width, size.Height) , _tex.Count - 1 ); } tex = _tex[_tex.Count - 1]; tex.SetData <UInt32>(0, charposs[c].src, data, 0, data.Length); }
//SceneBGMgr bgmgr = new SceneBGMgr();//背景管理器 //public HScrollScene(SceneBGMgr bgcreator) //{ // bgmgr = bgcreator; //} /// <summary> /// 初始化场景 /// </summary> /// <param name="destdrawarea">目标绘制区域,全屏</param> /// <param name="ViewPort">实际显示区域</param> public void Init(Size _destDrawArea, Rectangle _ViewPort) { destDrawArea = _destDrawArea; this._ViewPort = _ViewPort; UpdateDrawInfo(); }
public tpos(Seed seed, clgf.Texture.TexturePacket.TextureBlock block) { this.block = block; this.size = new Size((int)seed.size.X, (int)seed.size.Y); if (seed.size.X - size.Width > 0) this.size.Width++; if (seed.size.Y - size.Height > 0) this.size.Height++; this.orientY = seed.orient.Y; }
public void Resize(Size size,bool fixviewport=false) { destDrawArea = size; if (fixviewport) { _ViewPort.Width = (int)((float)_ViewPort.Height / (float)size.Height * (float)size.Width); } UpdateDrawInfo(); NeedUpdateAll(this.sceneroot); NeedUpdateAll(this.uilayer); }