protected GUCVisual(int x, int y, int w, int h, bool virtuals, GUCVisual p) { parent = p; if (virtuals) { vpos = new ViewPoint(x, y); vsize = new ViewPoint(w, h); } else { vpos = PixelToVirtual(x, y); vsize = PixelToVirtual(w, h); } thisView = zCView.Create(vpos.X, vpos.Y, vpos.X + vsize.X, vpos.Y + vsize.Y); shown = false; }
public GUCVisualText(string text, int x, int y, GUCVisual parent, bool virtuals) { this.parent = parent; if (virtuals) { vpos = new ViewPoint(x, y); } else { vpos = GUCVisual.PixelToVirtual(x, y); } vpos = new ViewPoint(vpos.X * 0x2000 / parent.VSize.X, vpos.Y * 0x2000 / parent.VSize.Y); using (zString z = zString.Create(text)) zviewText = parent.zView.CreateText(vpos.X, vpos.Y, z); shown = true; }
public void SetPos(ViewPoint newPos, bool virtuals = false) { if (!virtuals) { newPos = PixelToVirtual(newPos); } int diffX = newPos.X - vpos.X; int diffY = newPos.Y - vpos.Y; vpos = newPos; thisView.SetPos(vpos.X, vpos.Y); //update children foreach (GUCVisual vis in children) { vis.SetPos(vis.vpos.X + diffX, vis.vpos.Y + diffY, true); } }
public static ViewPoint GetScreenSize() { var screen = Gothic.View.zCView.GetScreen(); var ret = new ViewPoint(screen.pSizeX, screen.pSizeY); if (ret.X > 0 && ret.Y > 0) { iniRes = false; } else { var sec = Gothic.zCOption.GetSectionByName("VIDEO"); ret.X = Convert.ToInt32(sec.GetEntryByName("zVidResFullscreenX").VarValue.ToString()); ret.Y = Convert.ToInt32(sec.GetEntryByName("zVidResFullscreenY").VarValue.ToString()); if (!iniRes) { Log.Logger.LogWarning("Couldn't find real resolution, using Gothic.ini resolution: " + ret.X + "x" + ret.Y); } iniRes = true; } return(ret); }
public void SetSize(ViewPoint size, bool virtuals = false) { vsize = virtuals ? size : PixelToVirtual(size); thisView.SetSize(vsize.X, vsize.Y); }
public static ViewPoint PixelToVirtual(ViewPoint point) { var res = GetScreenSize(); return(new ViewPoint(point.X * 0x2000 / res.X, point.Y * 0x2000 / res.Y)); }