public bool IsOver(SimpleQuad quad) { if (Engine.Singleton.GetFloatFromPxWidth(User.Mysz.X.abs) >= quad.Panel.Left && Engine.Singleton.GetFloatFromPxWidth(User.Mysz.X.abs) <= quad.Panel.Left + quad.Panel.Width && Engine.Singleton.GetFloatFromPxHeight(User.Mysz.Y.abs) >= quad.Panel.Top && Engine.Singleton.GetFloatFromPxHeight(User.Mysz.Y.abs) <= quad.Panel.Top + quad.Panel.Height) { return(true); } return(false); }
public Slot(float left, float top) { BgQuad = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", left, top, Width, Size, new ColourValue(1, 1, 1), 1); BlueQuad = Engine.Singleton.Labeler.NewSimpleQuad("HighlightBlueMaterial", left, top, Width, Size, new ColourValue(1, 1, 1), 3); ItemLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.02f, ColourValue.White, ColourValue.Black, 2); ItemLabel.SetPosition(left, top + 0.015f); BlueQuad.IsVisible = false; isSelected = false; }
public SimpleQuad NewSimpleQuad(string materialName, float left, float top, float width, float height, ColourValue colour, int layer) { SimpleQuad quad = new SimpleQuad(GetUniqueLabelName(), materialName, left, top, width, height, colour); Overlays[layer].Add2D(quad.Panel); Quads.Add(quad); return(quad); }
public HUD() { _isVisible = false; Slot.Width = Slot.Size * 6 / Engine.Singleton.Camera.AspectRatio; Slots = new Slot[SlotsCount]; for (int i = 0; i < SlotsCount; i++) { Slots[i] = new Slot(SlotsSpacing, SlotsSpacing + i * (Slot.Size + SlotsSpacing)); } DescriptionBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.3f, 0.5f, 0.6f, 0.45f, ColourValue.White, 1); SelectedPicture = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.31f, 0.58f, 0.3f / Engine.Singleton.Camera.AspectRatio, 0.3f, ColourValue.White, 2); DescriptionLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.03f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); DescriptionLabel.SetPosition(0.55f, 0.51f); ChosenItemBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.0f, 0.0f, 0.2f, 0.05f, ColourValue.White, 1); ChosenItemLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.02f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); ChosenItemLabel.SetPosition(0.05f, 0.0f); ChosenItemPicture = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.0f, 0.0f, 0.05f, 0.05f, ColourValue.White, 2); GravityBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.5f, 0.0f, 0.3f, 0.07f, ColourValue.White, 1); GravityLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.05f, ColourValue.Green, ColourValue.Green, 2); GravityLabel.SetPosition(0.55f, 0.01f); GravityLabel.Caption = "Gravity: ON"; InventoryBg = Engine.Singleton.Labeler.NewSimpleQuad("InventoryBgMaterial", 0.01f, 0.01f, 0.98f, 0.98f, new ColourValue(1, 1, 1), 0); ArrowDown = Engine.Singleton.Labeler.NewSimpleQuad("DownArrow", 0.2f, 0.7f, Engine.Singleton.GetFloatFromPxWidth(64), Engine.Singleton.GetFloatFromPxHeight(128), ColourValue.White, 2); ArrowUp = Engine.Singleton.Labeler.NewSimpleQuad("UpArrow", 0.2f, 0.1f, Engine.Singleton.GetFloatFromPxWidth(64), Engine.Singleton.GetFloatFromPxHeight(128), ColourValue.Black, 2); MouseCursor = Engine.Singleton.Labeler.NewSimpleQuad("Kursor", 0.0f, 0.0f, Engine.Singleton.GetFloatFromPxWidth(32), Engine.Singleton.GetFloatFromPxHeight(32), new ColourValue(1, 1, 1), 4); CategoryBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.35f, 0.02f, 0.45f, 0.1f, new ColourValue(1, 1, 1), 1); CategoryLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.05f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2); CategoryLabel.SetPosition(0.5f, 0.04f); KtoraStrona = 0; SelectedOne = -1; IsVisible = false; }