static void drawScrollPosition() { if (selectedNode != null) { return; } if (maxScrollPosition < 1) { return; } VideoDriver v = irr.Driver; if (v.ScreenSize.Height < 200) { return; } float p = irr.Scene.ActiveCamera.Position.Z / maxScrollPosition; v.Draw2DLine(v.ScreenSize.Width - 26, 80, v.ScreenSize.Width - 26, v.ScreenSize.Height - 80, new Color(0x88446699)); float y = (v.ScreenSize.Height - 80 - 80 - 40) * (1.0f - p); Recti r = new Recti(v.ScreenSize.Width - 29, (int)y + 80, v.ScreenSize.Width - 22, (int)y + 80 + 40); v.Draw2DRectangle(r, new Color(0x88446699)); }
static void drawTextureManagerActivity() { if (selectedNode != null) { return; } if (tasksAddedToTextureManager == 0) { return; } int l = textureManager.GetCommandQueueLength(); if (l == 0) { tasksAddedToTextureManager = 0; return; } VideoDriver v = irr.Driver; float p = (tasksAddedToTextureManager - l) / (float)tasksAddedToTextureManager; if (p > 1) { p = 1; } Recti r = new Recti(v.ScreenSize.Width - 140, 20, v.ScreenSize.Width - 24, 30); v.Draw2DRectangleOutline(r, new Color(0x88446699)); r.LowerRightCorner = new Vector2Di(r.UpperLeftCorner.X + (int)(r.Width * p), r.LowerRightCorner.Y); v.Draw2DRectangle(r, new Color(0x88446699)); }
/// <summary> /// Determines whether the rectangle can be placed in the packing area /// at its current location. /// </summary> /// <param name="rectangle">Rectangle whose position to check</param> /// <param name="testedPackingAreaWidth">Total width of the packing area</param> /// <param name="testedPackingAreaHeight">Total height of the packing area</param> /// <returns>True if the rectangle can be placed at its current position</returns> private bool IsFree(ref Recti rectangle, int testedPackingAreaWidth, int testedPackingAreaHeight) { // If the rectangle is partially or completely outside of the packing // area, it can't be placed at its current location bool leavesPackingArea = (rectangle.X < 0) || (rectangle.Y < 0) || (rectangle.Right > testedPackingAreaWidth) || (rectangle.Bottom > testedPackingAreaHeight); if (leavesPackingArea) { return(false); } // Brute-force search whether the rectangle touches any of the other // rectangles already in the packing area for (int index = 0; index < packedRectangles.Count; ++index) { if (packedRectangles[index].IntersectsWith(rectangle)) { return(false); } } // Success! The rectangle is inside the packing area and doesn't overlap // with any other rectangles that have already been packed. return(true); }
public void TestGetSideOn() { Recti rect = new Recti(0, 0, 4, 8); Assert.AreEqual( new RectiSide(Dir.E, 0, 8, 3), rect.GetSideOn(Dir.E)); Assert.AreEqual( new RectiSide(Dir.E, 0, 7, 3), rect.GetSideOn(Dir.E, true)); Assert.AreEqual( new RectiSide(Dir.N, 0, 4, 7), rect.GetSideOn(Dir.N)); Assert.AreEqual( new RectiSide(Dir.N, 1, 4, 7), rect.GetSideOn(Dir.N, true)); Assert.AreEqual( new RectiSide(Dir.S, 0, 4, 0), rect.GetSideOn(Dir.S)); Assert.AreEqual( new RectiSide(Dir.S, 0, 3, 0), rect.GetSideOn(Dir.S, true)); Assert.AreEqual( new RectiSide(Dir.W, 0, 8, 0), rect.GetSideOn(Dir.W)); Assert.AreEqual( new RectiSide(Dir.W, 1, 8, 0), rect.GetSideOn(Dir.W, true)); }
/// <summary> /// Optimizes the rectangle's placement by moving it either left or up to fill /// any gaps resulting from rectangles blocking the anchors of the most optimal /// placements. /// </summary> /// <param name="placement">Placement to be optimized</param> /// <param name="rectangleWidth">Width of the rectangle to be optimized</param> /// <param name="rectangleHeight">Height of the rectangle to be optimized</param> private void OptimizePlacement(ref Pointi placement, int rectangleWidth, int rectangleHeight) { var rectangle = Recti.FromSize(placement.X, placement.Y, rectangleWidth, rectangleHeight); // Try to move the rectangle to the left as far as possible int leftMost = placement.X; while (IsFree(ref rectangle, PackingAreaWidth, PackingAreaHeight)) { leftMost = rectangle.X; --rectangle.X; } // Reset rectangle to original position rectangle.X = placement.X; // Try to move the rectangle upwards as far as possible int topMost = placement.Y; while (IsFree(ref rectangle, PackingAreaWidth, PackingAreaHeight)) { topMost = rectangle.Y; --rectangle.Y; } // Use the dimension in which the rectangle could be moved farther if ((placement.X - leftMost) > (placement.Y - topMost)) { placement.X = leftMost; } else { placement.Y = topMost; } }
public void SetPlayerPosition(Vec2i pos) { int minX = pos.x - PathFinderSize; if (minX < 0) { minX = 0; } int minZ = pos.z - PathFinderSize; if (minZ < 0) { minZ = 0; } /* * int maxX = pos.x + PathFinderSize; * if (maxX >= WorldSize) * maxX = WorldSize-1; * * int maxZ = pos.z + PathFinderSize; * if (maxZ >= WorldSize) * maxZ = WorldSize - 1; */ Bounds = new Recti(minX, minZ, 2 * PathFinderSize, 2 * PathFinderSize); }
public bool Overlaps(Recti other) { return(other.xMin < xMax && other.xMax > xMin && other.yMin < yMax && other.yMax > yMin); }
public void Draw(VideoDriver driver, Texture cellTexture) { int th = cellTexture.Size.Height; Recti[] srcRect = new Recti[5] { new Recti(th * 0, 0, th * 1, th), // [0] passable == -1 new Recti(th * 1, 0, th * 2, th), // [1] impassable == -2 new Recti(th * 2, 0, th * 3, th), // [2] start == -3 new Recti(th * 3, 0, th * 4, th), // [3] finish == -4 new Recti(th * 4, 0, th * 5, th) // [4] path == -5 }; for (int i = 0; i < cells.GetLength(0); i++) { for (int j = 0; j < cells.GetLength(1); j++) { int k = -1 - cells[i, j]; if (k >= 0 && k < srcRect.Length) { batchSrcRect[i * cells.GetLength(1) + j] = srcRect[k]; } } } driver.Draw2DImageBatch(cellTexture, batchDestPos, batchSrcRect); }
public Settlement(Kingdom kingdom, string name, SettlementBuilder builder) { IMPORTANT = builder.ENTR_NODE; Name = name; KingdomID = kingdom.KingdomID; TileSize = builder.TileSize; Centre = builder.Centre; BaseCoord = builder.BaseCoord; SettlementBounds = new Recti(BaseCoord.x, BaseCoord.z, TileSize, TileSize); SettlementChunks = builder.SettlementChunks; Buildings = builder.Buildings; SettlementNPCIDs = new List <int>(); SettlementLeaderNPCIDs = new List <int>(); tNodes = builder.TestNodes2; //SettlementNPCs = new List<NPC>(); //setBuild = builder; PathNodes = builder.PathNodes; SettlementType = builder.SettlementType; foreach (Building b in Buildings) { b.SetSettlement(this); } SettlementPathFinder = builder.SettlementPathFinder; }
public bool Contains(Recti other) { return(other.xMin >= xMin && other.xMax <= xMax && other.yMin >= yMin && other.yMax <= yMax); }
public FractalGenerator(IrrlichtDevice device) { this.device = device; driver = device.VideoDriver; screen = driver.ViewPort; regenerateTiles(); }
public Recti GetSubworldBounds() { if (SubworldBounds == null) { SubworldBounds = new Recti(new Vec2i(0, 0), ChunkSize * World.ChunkSize); } return(SubworldBounds); }
/// <summary> /// Creates a new LayerEyeFov. /// </summary> public LayerEyeFov() { Header = new LayerHeader(); Header.Type = LayerType.EyeFov; ColorTexture = new IntPtr[2]; Viewport = new Recti[2]; Fov = new FovPort[2]; RenderPose = new Posef[2]; }
public Recti GetWorldBounds() { if (WorldBounds == null) { WorldBounds = new Recti(WorldPosition.x, WorldPosition.z, Width, Height); } return(WorldBounds); }
public void FillPixels(byte[] byteArray, Rectd destRect) { var screenRect = new Recti(transxi(destRect.X), transyi(destRect.Y), (int)(Width * (destRect.Width)), (int)(Height * (destRect.Height))); int stride = 4 * ((screenRect.Width * (_bitmap.Format.BitsPerPixel / 8) + 3) / 4); _bitmap.WritePixels(new System.Windows.Int32Rect(0, 0, screenRect.Width, screenRect.Height), byteArray, stride, screenRect.X, screenRect.Y); }
/// <summary> /// Creates a new LayerEyeMatrix. /// </summary> public LayerEyeMatrix() { Header = new LayerHeader(); Header.Type = LayerType.EyeMatrix; ColorTexture = new IntPtr[2]; Viewport = new Recti[2]; RenderPose = new Posef[2]; Matrix = new Matrix4[2]; }
/// <summary> /// Creates a new LayerQuad. /// </summary> public LayerQuad() { Header = new LayerHeader(); Header.Type = LayerType.Quad; ColorTexture = IntPtr.Zero; Viewport = new Recti(); QuadPoseCenter = new Posef(); QuadSize = new Vector2(); }
private void initGUI() { GUIEnvironment gui = device.GUIEnvironment; gui.Skin.SetFont(gui.GetFont("fontlucida.png")); foreach (GUIDefaultColor c in Enum.GetValues(typeof(GUIDefaultColor))) { Color l = gui.Skin.GetColor(c); l.Alpha = 255; gui.Skin.SetColor(l, c); } Recti v = device.VideoDriver.ViewPort; GUITabControl tc = gui.AddTabControl(new Recti(20, 20, v.Width - 20, v.Height - 70)); GUITab t1 = tc.AddTab("Setup"); gui.AddStaticText("Driver", new Recti(20, 20, v.Width - 60, 40), false, false, t1); guiDriverType = gui.AddComboBox(new Recti(20, 40, v.Width - 60, 60), t1); foreach (DriverType t in Enum.GetValues(typeof(DriverType))) { if (t == DriverType.Null) { continue; } int i = guiDriverType.AddItem(t.ToString(), (int)t); if (t == driverType) { guiDriverType.SelectedIndex = i; } } gui.AddStaticText("Resolution", new Recti(20, 70, v.Width - 60, 90), false, false, t1); guiResolution = gui.AddComboBox(new Recti(20, 90, v.Width - 60, 110), t1); foreach (VideoMode m in device.VideoModeList.ModeList) { int i = guiResolution.AddItem(m.ToString()); if (m.Resolution == videoMode.Resolution && m.Depth == videoMode.Depth) { guiResolution.SelectedIndex = i; } } guiFullscreen = gui.AddCheckBox(fullscreen, new Recti(20, 130, v.Width - 60, 150), "Fullscreen", t1); GUITab t2 = tc.AddTab("About"); gui.AddStaticText(aboutText, new Recti(20, 20, v.Width - 60, 180), false, true, t2); guiButtonRun = gui.AddButton(new Recti(v.Width - 190, v.Height - 50, v.Width - 110, v.Height - 20), null, -1, "Run"); guiButtonExit = gui.AddButton(new Recti(v.Width - 100, v.Height - 50, v.Width - 20, v.Height - 20), null, -1, "Exit"); }
public override bool Equals(object other) { if (!(other is Recti)) { return(false); } Recti vector = (Recti)other; return(lt == vector.lt && rb == vector.rb); }
private SettlementPathNode[] AddPlot(Recti r) { SettlementPathNode[] nodes = new SettlementPathNode[4]; if (r.X > 0 && r.Y > 0) { Vec2i n1 = new Vec2i(r.X - 1, r.Y - 1); nodes[0] = new SettlementPathNode(n1); //Bottom left //PathNodes.Add(new Vec2i(r.X - 1, r.Y - 1)); } if (r.X > 0 && r.X + r.Width + 1 < TileSize && r.Y > 0) { //PathNodes.Add(new Vec2i(r.X + r.Width + 1, r.Y - 1)); nodes[1] = new SettlementPathNode(new Vec2i(r.X + r.Width + 1, r.Y - 1)); //Bottom right } if (r.X > 0 && r.Y > 0 && r.Y + r.Height + 1 < TileSize) { //PathNodes.Add(new Vec2i(r.X - 1, r.Y + r.Height + 1)); nodes[2] = new SettlementPathNode(new Vec2i(r.X - 1, r.Y + r.Height + 1)); //Top Left } if (r.X > 0 && r.X + r.Width + 1 < TileSize && r.Y > 0 && r.Y + r.Height + 1 < TileSize) { //PathNodes.Add(new Vec2i(r.X + r.Width + 1, r.Y + r.Height + 1)); nodes[3] = new SettlementPathNode(new Vec2i(r.X + r.Width + 1, r.Y + r.Height + 1)); //Top Right } if (nodes[0] != null) { if (nodes[1] != null) { nodes[0].AddConnection(SettlementPathNode.EAST, nodes[1]); nodes[1].AddConnection(SettlementPathNode.WEST, nodes[0]); } if (nodes[2] != null) { nodes[0].AddConnection(SettlementPathNode.NORTH, nodes[2]); nodes[2].AddConnection(SettlementPathNode.SOUTH, nodes[0]); } } if (nodes[3] != null) { if (nodes[1] != null) { nodes[3].AddConnection(SettlementPathNode.SOUTH, nodes[1]); nodes[1].AddConnection(SettlementPathNode.NORTH, nodes[3]); } if (nodes[2] != null) { nodes[3].AddConnection(SettlementPathNode.WEST, nodes[2]); nodes[2].AddConnection(SettlementPathNode.EAST, nodes[3]); } } //TestNodes.AddRange(nodes); BuildingPlots.Add(r); return(nodes); }
public override void GestureEnd(CircuitEditor editor, Vector2d endOffset) { SelectionSize = editor.RoundDistToGrid(endOffset); Selecting = false; // Make sure we don't have a negitive size if (SelectionSize.X < 0) { SelectionSize.X = -SelectionSize.X; SelectionStart.X -= SelectionSize.X; } if (SelectionSize.Y < 0) { SelectionSize.Y = -SelectionSize.Y; SelectionStart.Y -= SelectionSize.Y; } // FIXME: Do the selecting var wires = editor.Scene.Wires; ClearSelection(editor); // If the size is zero we want to check if we clicked a wire or gate if (SelectionSize == Vector2i.Zero) { foreach (var wire in wires.WiresList) { if (wire.IsPointOnWire(SelectionStart)) { SelectedWires.Add(wire); break; } } } else { // Here we should loop through all wires and see if they are contained in the area Recti selectionRect = new Recti(SelectionStart, SelectionSize); foreach (var wire in wires.WiresList) { if (selectionRect.Contains(wire.Pos) && selectionRect.Contains(wire.EndPos)) { SelectedWires.Add(wire); Console.WriteLine($"Selected wire: {wire}"); } } } editor.DrawingArea.QueueDraw(); }
public void SetProgress(uint progress) { if (progress > 100) progress = 0; int xpercentage; xpercentage = (int)(progress * xWidth) / 100; //Reducing to the bar size toFill.UpperLeftCorner.Set(bar.UpperLeftCorner.X, bar.UpperLeftCorner.Y); toFill = new Recti(bar.UpperLeftCorner.X, bar.UpperLeftCorner.Y, bar.UpperLeftCorner.X + xpercentage, bar.LowerRightCorner.Y); empty = new Recti(new Vector2Di(toFill.LowerRightCorner.X, toFill.UpperLeftCorner.Y), new Vector2Di(bar.LowerRightCorner.X, bar.LowerRightCorner.Y)); }
static void drawPreviewPlateTooltip() { if (hoveredNode == null || !hoveredNode.Visible) { return; } int k = hoveredNode.ID; Texture t = hoveredNode.GetMaterial(0).GetTexture(0); if (t != null && t.Name.Path != "NoPreviewTexture") { k = hoveredNode.ID & (0xFFFFFFF ^ SelectableNodeIdFlag); } string s = previewPlateInfo.ContainsKey(k) ? previewPlateInfo[k] : "???"; if (s != null) { Vector2Di p = irr.Device.CursorControl.Position + new Vector2Di(16); GUIFont f = irr.GUI.Skin.GetFont(GUIDefaultFont.Default); Dimension2Di d = f.GetDimension(s); d.Inflate(16, 12); Recti r = new Recti(p, d); VideoDriver v = irr.Driver; int ax = r.LowerRightCorner.X - v.ScreenSize.Width; int ay = r.LowerRightCorner.Y - v.ScreenSize.Height; if (ax > 0 || ay > 0) { if (ax < 0) { ax = 0; } if (ay < 0) { ay = 0; } r.Offset(-ax, -ay); } v.Draw2DRectangle(r, new Color(0xbb223355)); v.Draw2DRectangleOutline(r, new Color(0xbb445577)); f.Draw(s, r.UpperLeftCorner + new Vector2Di(8, 6), Color.SolidYellow); } }
public bool Intersects(Recti r) { if (r.X > X + Width || r.X + Width > X) { return(false); } if (r.Y > Y + Height || r.Y + Height > Y) { return(false); } return(true); }
private void BuildWallAndEntrance() { Recti boundry = new Recti(Boundry, Boundry, TileSize.x - 2 * Boundry, TileSize.z - 2 * Boundry); Vec2i entrance = new Vec2i(0, 0); for (int x = Boundry + 1; x < TileSize.x - Boundry - 1; x++) { Vec2i p1 = new Vec2i(x, Boundry + 1); if (entrance.QuickDistance(p1) > 4) { WoodSpikeWall wall1 = new WoodSpikeWall(); wall1.SetPosition(p1); AddObject(wall1, true); } Vec2i p2 = new Vec2i(x, TileSize.z - Boundry - 1); if (entrance.QuickDistance(p2) > 4) { WoodSpikeWall wall2 = new WoodSpikeWall(); wall2.SetPosition(p2); AddObject(wall2, true); } } for (int z = Boundry + 1; z < TileSize.z - Boundry - 1; z++) { Vec2i p1 = new Vec2i(Boundry + 1, z); if (p1.QuickDistance(entrance) > 4) { WoodSpikeWall wall1 = new WoodSpikeWall(); wall1.SetPosition(p1); AddObject(wall1, true); } Vec2i p2 = new Vec2i(TileSize.x - Boundry - 1, z); if (p2.QuickDistance(entrance) > 4) { WoodSpikeWall wall2 = new WoodSpikeWall(); wall2.SetPosition(p2); AddObject(wall2, true); } } for (int x = 0; x < TileSize.x; x++) { for (int z = 0; z < TileSize.z; z++) { SetTile(x, z, Tile.DIRT); } } }
public static void Init() { FIELD_SIZE_X = GameManager.Instance.Definitions.FieldSizeX; FIELD_SIZE_Y = GameManager.Instance.Definitions.FieldSizeY; FIELD_GRID_X = GameManager.Instance.Definitions.FieldGridX; FIELD_GRID_Y = GameManager.Instance.Definitions.FieldGridY; FIELD_RECT = new Recti(-FIELD_GRID_X * FIELD_SIZE_X / 2 + GameManager.Instance.Definitions.FieldCenterX, -FIELD_GRID_Y * FIELD_SIZE_Y / 2 + GameManager.Instance.Definitions.FieldCenterY, FIELD_GRID_X * FIELD_SIZE_X / 2 + GameManager.Instance.Definitions.FieldCenterX, FIELD_GRID_Y * FIELD_SIZE_Y / 2 + GameManager.Instance.Definitions.FieldCenterY); FIELD_POS_X = -FIELD_GRID_X * FIELD_SIZE_X / 2 + FIELD_GRID_X / 2 + GameManager.Instance.Definitions.FieldCenterX; FIELD_POS_Y = FIELD_GRID_Y * FIELD_SIZE_Y / 2 - FIELD_GRID_Y / 2 + GameManager.Instance.Definitions.FieldCenterY; }
public void TestExpandToInclude() { Recti r = new Recti(0, 0, 0, 0); r.ExpandToInclude(new Vec2i(1, 1)); Assert.AreEqual(new Recti(1, 1, 1, 1), r); r.ExpandToInclude(new Vec2i(1, 1)); Assert.AreEqual(new Recti(1, 1, 1, 1), r); r.ExpandToInclude(new Vec2i(3, 1)); Assert.AreEqual(new Recti(1, 1, 3, 1), r); r.ExpandToInclude(new Vec2i(0, 4)); Assert.AreEqual(new Recti(0, 1, 4, 4), r); }
/// <summary> /// Attempts to place generate a building based on <paramref name="bp"/> in the plot specified /// </summary> /// <param name="bp"></param> /// <param name="plot"></param> private bool GenBuildingInPlot(BuildingPlan bp, Plot plot) { Vec2i entrance = GenerationRandom.RandomFromArray(plot.EntranceSides); BuildingGenerationPlan bpPlan = new BuildingGenerationPlan() { BuildingPlan = bp, EntranceSide = entrance, MaxHeight = plot.Bounds.Height, MaxWidth = plot.Bounds.Width }; if (bp.MinSize > plot.Bounds.Width || bp.MinSize > plot.Bounds.Height) { return(false); } Building b = BuildingGenerator.CreateBuilding(GenerationRandom, out BuildingVoxels vox, bpPlan); Vec2i pos = new Vec2i(plot.Bounds.X, plot.Bounds.Y); if (entrance.x == -1) { pos = new Vec2i(plot.Bounds.X, plot.Bounds.Y + GenerationRandom.RandomIntFromSet(0, plot.Bounds.Height - b.Height)); } else if (entrance.x == 1) { pos = new Vec2i(plot.Bounds.X + (plot.Bounds.Width - b.Width), plot.Bounds.Y + GenerationRandom.RandomIntFromSet(0, plot.Bounds.Height - b.Height)); } else if (entrance.z == -1) { pos = new Vec2i(plot.Bounds.X + GenerationRandom.RandomIntFromSet(0, plot.Bounds.Width - b.Width), plot.Bounds.Y); } else if (entrance.z == 1) { pos = new Vec2i(plot.Bounds.X + GenerationRandom.RandomIntFromSet(0, plot.Bounds.Width - b.Width), plot.Bounds.Y + (plot.Bounds.Height - b.Height)); } Recti r = AddBuilding(b, vox, pos); if (r != null) { BuildingPlots.Add(r); return(true); } return(false); }
public void OnSceneGUI() { var obj = (CharacterController)target; if (showPlayerTiles) { Handles.color = Color.green; var box = obj.rigidbody.GetComponent <Collider2D>().bounds; var tiles = Recti.GetBoundingRect(box.min.x, box.min.y, box.size.x, box.size.y); for (int x = tiles.xMin; x < tiles.xMax; x++) { for (int y = tiles.yMin; y < tiles.yMax; y++) { Handles.DrawWireCube(new Vector3((float)x + 0.5f, (float)y + 0.5f, 0), Vector3.one); } } } }
/// <summary>Tries to allocate space for a rectangle in the packing area</summary> /// <param name="rectangleWidth">Width of the rectangle to allocate</param> /// <param name="rectangleHeight">Height of the rectangle to allocate</param> /// <param name="placement">Output parameter receiving the rectangle's placement</param> /// <returns>True if space for the rectangle could be allocated</returns> public override bool TryPack(int rectangleWidth, int rectangleHeight, out Pointi placement) { // Try to find an anchor where the rectangle fits in, enlarging the packing // area and repeating the search recursively until it fits or the // maximum allowed size is exceeded. int anchorIndex = SelectAnchorRecursive(rectangleWidth, rectangleHeight, actualPackingAreaWidth, actualPackingAreaHeight); // No anchor could be found at which the rectangle did fit in if (anchorIndex == -1) { placement = new Pointi(); return(false); } placement = anchors[anchorIndex]; // Move the rectangle either to the left or to the top until it collides with // a neightbouring rectangle. This is done to combat the effect of lining up // rectangles with gaps to the left or top of them because the anchor that // would allow placement there has been blocked by another rectangle OptimizePlacement(ref placement, rectangleWidth, rectangleHeight); // Remove the used anchor and add new anchors at the upper right and lower left // positions of the new rectangle // The anchor is only removed if the placement optimization didn't // move the rectangle so far that the anchor isn't blocked anymore bool blocksAnchor = ((placement.X + rectangleWidth) > anchors[anchorIndex].X) && ((placement.Y + rectangleHeight) > anchors[anchorIndex].Y); if (blocksAnchor) { anchors.RemoveAt(anchorIndex); } // Add new anchors at the upper right and lower left coordinates of the rectangle InsertAnchor(new Pointi(placement.X + rectangleWidth, placement.Y)); InsertAnchor(new Pointi(placement.X, placement.Y + rectangleHeight)); // Finally, we can add the rectangle to our packed rectangles list packedRectangles.Add(Recti.FromSize(placement.X, placement.Y, rectangleWidth, rectangleHeight)); return(true); }
public static bool AddObject(Building build, BuildingVoxels vox, WorldObjectData obj, bool force = false) { if (force) { build.AddInternalObject(obj); return(true); } else { //Iterate all objects in the building and check for intersection. foreach (WorldObjectData obj_ in build.GetBuildingInternalObjects()) { //If they intersect, then we cannot place this object. if (obj_.Intersects(obj)) { return(false); } } //Find the integer bounds Recti bounds = obj.CalculateIntegerBounds(); int yMin = (int)obj.Position.y; int yMax = yMin + (int)obj.Size.y; //Iterate the voxel position of the object bounds. for (int x = bounds.X; x < bounds.X + bounds.Width; x++) { for (int z = bounds.Y; z < bounds.Y + bounds.Height; z++) { for (int y = yMin; y < yMax; y++) { //If any single voxel is non-none, then we cannot place the object here. if (vox.GetVoxel(x, y, z) != Voxel.none) { return(false); } } } } build.AddInternalObject(obj); return(true); } }
public ExperienceBar(GUIEnvironment guienv, Recti rectangle, int id = -1, GUIElement parent = null) : base(GUIElementType.Unknown, guienv, parent, rectangle) { xWidth = rectangle.LowerRightCorner.X - rectangle.UpperLeftCorner.X; gui = guienv; if (Parent != null) { bar = new Recti(Parent.RelativePosition.UpperLeftCorner + rectangle.UpperLeftCorner, Parent.RelativePosition.UpperLeftCorner + rectangle.LowerRightCorner); } else { bar = rectangle; } if (parent != null) gui.RootElement.AddChild(this); videoDriver = gui.VideoDriver; fillcolor = Color.OpaqueGreen; emptycolor = Color.OpaqueRed; bordercolor = Color.OpaqueBlack; border = bar; toFill = new Recti(); empty = new Recti(); SetProgress(0); }
public void Draw(VideoDriver driver, Texture cellTexture) { int th = cellTexture.Size.Height; Recti[] srcRect = new Recti[5] { new Recti(th * 0, 0, th * 1, th), // [0] passable == -1 new Recti(th * 1, 0, th * 2, th), // [1] impassable == -2 new Recti(th * 2, 0, th * 3, th), // [2] start == -3 new Recti(th * 3, 0, th * 4, th), // [3] finish == -4 new Recti(th * 4, 0, th * 5, th) // [4] path == -5 }; for (int i = 0; i < cells.GetLength(0); i++) { for (int j = 0; j < cells.GetLength(1); j++) { int k = -1 - cells[i, j]; if (k >= 0 && k < srcRect.Length) batchSrcRect[i * cells.GetLength(1) + j] = srcRect[k]; } } driver.Draw2DImageBatch(cellTexture, batchDestPos, batchSrcRect); }
static void Main(string[] args) { DriverType driverType; if (!AskUserForDriver(out driverType)) return; IrrlichtDevice device = IrrlichtDevice.CreateDevice(driverType, new Dimension2Di(512, 384)); if (device == null) return; device.SetWindowCaption("Irrlicht Engine - 2D Graphics Demo"); VideoDriver driver = device.VideoDriver; Texture images = driver.GetTexture("../../media/2ddemo.png"); driver.MakeColorKeyTexture(images, new Vector2Di(0, 0)); GUIFont font = device.GUIEnvironment.BuiltInFont; GUIFont font2 = device.GUIEnvironment.GetFont("../../media/fonthaettenschweiler.bmp"); Recti imp1 = new Recti(349, 15, 385, 78); Recti imp2 = new Recti(387, 15, 423, 78); driver.Material2D.Layer[0].BilinearFilter = true; driver.Material2D.AntiAliasing = AntiAliasingMode.FullBasic; while (device.Run()) { if (device.WindowActive) { int time = (int)device.Timer.Time; driver.BeginScene(true, true, new Color(120, 102, 136)); // draw fire & dragons background world driver.Draw2DImage(images, new Vector2Di(50, 50), new Recti(0, 0, 342, 224), null, new Color(255, 255, 255), true); // draw flying imp driver.Draw2DImage(images, new Vector2Di(164, 125), (time / 500 % 2) == 1 ? imp1 : imp2, null, new Color(255, 255, 255), true); // draw second flying imp with colorcylce driver.Draw2DImage(images, new Vector2Di(270, 105), (time / 500 % 2) == 1 ? imp1 : imp2, null, new Color(time % 255, 255, 255), true); // draw some text if (font != null) font.Draw("This demo shows that Irrlicht is also capable of drawing 2D graphics.", 130, 10, new Color(255, 255, 255)); // draw some other text if (font2 != null) font2.Draw("Also mixing with 3d graphics is possible.", 130, 20, new Color(time % 255, time % 255, 255)); driver.EnableMaterial2D(); driver.Draw2DImage(images, new Recti(10, 10, 108, 48), new Recti(354, 87, 442, 118)); driver.EnableMaterial2D(false); Vector2Di m = device.CursorControl.Position; driver.Draw2DRectangle(new Recti(m.X - 20, m.Y - 20, m.X + 20, m.Y + 20), new Color(255, 255, 255, 100)); driver.EndScene(); } } device.Drop(); }
static void drawScrollPosition() { if (selectedNode != null) return; if (maxScrollPosition < 1) return; VideoDriver v = irr.Driver; if (v.ScreenSize.Height < 200) return; float p = irr.Scene.ActiveCamera.Position.Z / maxScrollPosition; v.Draw2DLine(v.ScreenSize.Width - 26, 80, v.ScreenSize.Width - 26, v.ScreenSize.Height - 80, new Color(0x88446699)); float y = (v.ScreenSize.Height - 80 - 80 - 40) * (1.0f - p); Recti r = new Recti(v.ScreenSize.Width - 30, (int)y + 80, v.ScreenSize.Width - 23, (int)y + 80 + 40); v.Draw2DRectangle(r, new Color(0x88446699)); }
static void drawTextureManagerActivity() { if (selectedNode != null) return; if (tasksAddedToTextureManager == 0) return; int l = textureManager.GetCommandQueueLength(); if (l == 0) { tasksAddedToTextureManager = 0; return; } VideoDriver v = irr.Driver; float p = (tasksAddedToTextureManager - l) / (float)tasksAddedToTextureManager; if (p > 1) p = 1; Recti r = new Recti(v.ScreenSize.Width - 140, 20, v.ScreenSize.Width - 24, 30); v.Draw2DRectangleOutline(r, new Color(0x88446699)); r.Inflate(-4, -4); r.LowerRightCorner = new Vector2Di(r.UpperLeftCorner.X + (int)(r.Width * p), r.LowerRightCorner.Y); v.Draw2DRectangle(r, new Color(0x88446699)); }
static void drawPreviewPlateTooltip() { if (hoveredNode == null || !hoveredNode.Visible) return; int k = hoveredNode.ID; Texture t = hoveredNode.GetMaterial(0).GetTexture(0); if (t != null && t.Name.Path != "NoPreviewTexture") k = hoveredNode.ID & (0xFFFFFFF ^ SelectableNodeIdFlag); string s = previewPlateInfo.ContainsKey(k) ? previewPlateInfo[k] : "???"; if (s != null) { Vector2Di p = irr.Device.CursorControl.Position + new Vector2Di(16); GUIFont f = irr.GUI.Skin.GetFont(GUIDefaultFont.Default); Dimension2Di d = f.GetDimension(s); d.Inflate(16, 12); Recti r = new Recti(p, d); VideoDriver v = irr.Driver; int ax = r.LowerRightCorner.X - v.ScreenSize.Width; int ay = r.LowerRightCorner.Y - v.ScreenSize.Height; if (ax > 0 || ay > 0) { if (ax < 0) ax = 0; if (ay < 0) ay = 0; r.Offset(-ax, -ay); } v.Draw2DRectangle(r, new Color(0xbb223355)); v.Draw2DRectangleOutline(r, new Color(0xbb445577)); f.Draw(s, r.UpperLeftCorner + new Vector2Di(8, 6), Color.OpaqueYellow); } }
public void AddBorder(int size, Color color) { bordercolor = color; border = new Recti(border.UpperLeftCorner.X - size, border.UpperLeftCorner.Y - size, border.LowerRightCorner.X + size, border.LowerRightCorner.Y + size); }
/// <summary> /// Létrehoz egy sizex*sizey méretű ablakot, windowCaption címmel és deviceType renderelési eszközzel. /// </summary> /// <param name="windowCaption">Ablak címe</param> /// <param name="sizex">Ablak szélessége</param> /// <param name="sizey">Ablak magassága</param> /// <param name="deviceType">A render eszköz típusa ("DriverType.OpenGL;" (OpenGL) vagy "DriverType.Direct3D8;"/"DriverType.Direct3D9;" (DirectX))</param> /// <param name="mapName">Betöltendő pálya neve a kiterjesztés nélkül (pl. "devmap")</param> /// <param name="pak0">A pak0 fájl neve (pl. "pak0" vagy "pack1")</param> /// <param name="pak1">A pak1 fájl neve (pl. "pak1" vagy "pack4")</param> /// <param name="pak2">A pak2 fájl neve (pl. "pak2" vagy "pack2")</param> public static void createScreen(string windowCaption, int sizex, int sizey, DriverType deviceType, string mapName, string pak0, string pak1, string pak2, bool isFullScreen) { //Ablakot megjeleníteni if (isFullScreen == true) { device = IrrlichtDevice.CreateDevice(deviceType, new Dimension2Di(sizex, sizey), 32, true, false, true); } else { device = IrrlichtDevice.CreateDevice(deviceType, new Dimension2Di(sizex, sizey), 32, false, false, true); } if (device == null) return; AnimatedMesh q3levelmesh = null; device.OnEvent += new IrrlichtDevice.EventHandler(device_OnEvent); device.SetWindowCaption(Property.modName + " Build " + Property.modVersion); driver = device.VideoDriver; smgr = device.SceneManager; GUIEnvironment gui = device.GUIEnvironment; //fadein GUIInOutFader fader = device.GUIEnvironment.AddInOutFader(); fader.SetColor(new Color(0, 0, 0, 255)); fader.FadeIn(2000); //hurtOverlay = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Overlays/hurt.png"), new Vector2Di(0, 0)); //hurtOverlay.Visible = false; GUIImage copyrightScreen = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/exit.tga"), new Vector2Di(0, 0)); float guiScalex = sizex / 800; float guiScaley = sizey / 600; copyrightScreen.Visible = false; copyrightScreen.ScaleImage = true; copyrightScreen.SetMaxSize(new Dimension2Di(sizex, sizey)); copyrightScreen.SetMinSize(new Dimension2Di(sizex, sizey)); //Betölteni a mapot try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak0 + ".edsf"); } catch (Exception ex) { Logger.Log("pak0 fajl betoltese sikertelen vagy nem talalhato, a jatek nem tud betoltodni"); string error = ex.ToString(); Logger.Log(error); Environment.Exit(0); } try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak1 + ".edsf"); } catch (Exception ex) { Logger.Log("pak1 fajl betoltese sikertelen vagy nem talalhato, ignoralva"); string error = ex.ToString(); Logger.Log(error); } try { device.FileSystem.AddFileArchive("./Content/PK3/" + pak2 + ".edsf"); } catch (Exception ex) { Logger.Log("pak2 fajl betoltese sikertelen vagy nem talalhato, ignoralva"); string error = ex.ToString(); Logger.Log(error); } try { q3levelmesh = smgr.GetMesh(mapName + ".bsp"); } catch (Exception ex) { Logger.Log("Palya betoltese sikertelen vagy nem talalhato, a jatek nem tud betoltodni"); string error = ex.ToString(); Logger.Log(error); Environment.Exit(0); } MeshSceneNode q3node = null; q3node = smgr.AddOctreeSceneNode(q3levelmesh.GetMesh(0), null, IDFlag_IsPickable); q3node.Position = new Vector3Df(-1350, -130, -1400); SceneNode node = null; if (mapName == "rpg") { IsRPG = true; } //LightSceneNode light = smgr.AddLightSceneNode(q3node, new Vector3Df(-1319, -118, -1410), new Color(255, 255, 255), 600.0, 10); //Half-Life Headcrab AnimatedMeshSceneNode anode3 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/headcrab.mdl")); if (IsRPG) { anode3.Position = new Vector3Df(-1212, -180, -1346); Audio.playWave("./Content/Music/rpg.mp3"); } else { anode3.Position = new Vector3Df(-1372.951f, -145.9882f, -1319.71f); } anode3.Rotation = new Vector3Df(0, 0, 0); anode3.AnimationSpeed = 1; Scenes.changeAnimation(anode3, 1, 31); anode3.SetMaterialFlag(MaterialFlag.Lighting, true); anode3.GetMaterial(0).NormalizeNormals = true; anode3.GetMaterial(0).Lighting = false; //Yodan anode2 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/yodan.mdl")); anode2.Position = new Vector3Df(-1355, -200, -1410); anode2.AnimationSpeed = 15; anode2.SetMaterialFlag(MaterialFlag.Lighting, true); anode2.GetMaterial(0).NormalizeNormals = true; anode2.GetMaterial(0).Lighting = false; anode2.SetTransitionTime(3); Scenes.changeYodanAnimation(anode2, "idle"); //SkyBox SceneNode skybox = smgr.AddSkyBoxSceneNode("./Contents/2D/Skybox/mountains_up.jpg", "./Contents/2D/Skybox/mountains_dn.jpg", "./Contents/2D/Skybox/mountains_lf.jpg", "./Contents/2D/Skybox/mountains_rt.jpg", "./Contents/2D/Skybox/mountains_ft.jpg", "./Contents/2D/Skybox/mountains_bk.jpg"); skybox.Visible = true; //FPS kamera hozzáadása camera = smgr.AddCameraSceneNodeFPS(); camera.Position = new Vector3Df(-1625.723f, -145.9937f, -1532.087f); camera.Target = new Vector3Df(-1491.555f, -1434.106f, -1368.737f); //fegyver AnimatedMesh weaponmesh = smgr.GetMesh("./Content/3D/blades.mdl"); AnimatedMeshSceneNode weapon = smgr.AddAnimatedMeshSceneNode(weaponmesh, camera, 30); weapon.Scale = new Vector3Df(0.5f, 0.5f, 0.5f); weapon.Position = new Vector3Df(0, 0, 15); weapon.Rotation = new Vector3Df(0, -90, 0); Scenes.changeAnimation(weapon, 1, 1); weapon.Visible = true; //fizika TriangleSelector selector; selector = smgr.CreateOctreeTriangleSelector(q3levelmesh.GetMesh(0), q3node, 128); q3node.TriangleSelector = selector; anim = smgr.CreateCollisionResponseAnimator(selector, camera, new Vector3Df(30, 50, 30), new Vector3Df(0, -10, 0), new Vector3Df(0, 30, 0)); //Overlay GUIImage overlay = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Overlays/vignette.png"), new Vector2Di(0, 0)); overlay.ScaleImage = true; overlay.SetMaxSize(new Dimension2Di(sizex, sizey)); overlay.SetMinSize(new Dimension2Di(sizex, sizey)); selector.Drop(); camera.AddAnimator(anim); anim.Drop(); // fény lightMovementHelperNode = smgr.AddEmptySceneNode(); q3node = smgr.AddSphereSceneNode(2, 6, lightMovementHelperNode, -1, new Vector3Df(15, -10, 15)); q3node.SetMaterialFlag(MaterialFlag.Lighting, false); lightNode = q3node; //A Portré anode = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/portrait.mdl")); anode.Position = new Vector3Df(-1177.601f, -137.975f, -1238.015f); anode.Rotation = new Vector3Df(0,0,0); anode.Scale = new Vector3Df(3); anode.AnimationSpeed = 1500; anode.SetMaterialFlag(MaterialFlag.Lighting, true); anode.GetMaterial(0).NormalizeNormals = true; anode.GetMaterial(0).Lighting = false; AnimatedMeshSceneNode anode4 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/waiter.mdl")); anode4.Position = new Vector3Df(-1130, -375, -1724); anode4.Rotation = new Vector3Df(0, -90, 0); anode4.Scale = new Vector3Df(2, 2, 2); anode4.SetMaterialFlag(MaterialFlag.Lighting, false); Scenes.changeAnimation(anode4, 0, 1); //Egér elrejtése device.CursorControl.Visible = false; GUIFont font = device.GUIEnvironment.BuiltInFont; SceneCollisionManager collMan = smgr.SceneCollisionManager; TextSceneNode headcrabName = smgr.AddTextSceneNode(font, "Yodan Lebegö Headcrab-je <Level 10>", new Color(255, 255, 0), null, anode3.Position + new Vector3Df(0, 25, 0), 0); TextSceneNode waiterName = smgr.AddTextSceneNode(font, "John <Level 15>", new Color(0, 255, 0), null, anode4.Position + new Vector3Df(0, 125, 0), 0); uint then = device.Timer.Time; float MOVEMENT_SPEED = 100.0f; //Energiagömb /*AnimatedMeshSceneNode anode5 = smgr.AddAnimatedMeshSceneNode(smgr.GetMesh("./Content/3D/core.mdl")); anode5.Position = new Vector3Df(-1355, 0, -1410); Scenes.changeAnimation(anode5, 0, 90); anode5.Scale = new Vector3Df(2.0f); Line3Df coreray = new Line3Df(-1355, 0, -1410, -1355, -500, -1410); driver.SetMaterial(anode5.GetMaterial(1)); driver.SetTransform(TransformationState.World, Matrix.Identity); driver.Draw3DLine(coreray, new Color(255,0,0));*/ GUIImage bartenderForm = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/bartender.png"), new Vector2Di(10, 10)); bartenderForm.ScaleImage = true; bartenderForm.Visible = false; bartenderForm.SetMinSize(new Dimension2Di(sizex - 10, sizey - 10)); bartenderForm.SetMaxSize(new Dimension2Di(sizex - 10, sizey - 10)); bool BartenderFormIsOpen = false; GUIImage ActionBar = device.GUIEnvironment.AddImage(driver.GetTexture("./Content/2D/Hud/Actionbar.tga"), new Vector2Di(0, 600 - 128)); //330, 110 790, 120 Recti expbarrect = new Recti(); ExperienceBar expbar = new ExperienceBar(gui, expbarrect,0, ActionBar); expbar.SetProgress(0); expbar.SetColors(new Color(255, 255, 0), new Color(255, 255, 255)); expbar.AddBorder(5, new Color(0, 0, 0)); expbar.SetMinSize(new Dimension2Di(128, 64)); expbar.SetMaxSize(new Dimension2Di(128, 64)); //Mi minek a része q3node.AddChild(anode); q3node.AddChild(anode2); q3node.AddChild(anode3); q3node.AddChild(anode4); TextSceneNode yodanName = smgr.AddTextSceneNode(font, "Yodan a Bérgyilkos <Level 90>", new Color(255, 0, 0), null, anode2.Position + new Vector3Df(0, 50, 0), 0); while (device.Run()) { driver.BeginScene(true, true, new Color(135, 206, 235)); smgr.DrawAll(); gui.DrawAll(); string printDate = dateTime.ToShortTimeString(); uint now = device.Timer.Time; float frameDeltaTime = (float)(now - then) / 1000.0f; then = now; Vector3Df nodePosition = camera.Position; if (font != null) { /*font.Draw("Build " + Property.modVersion, 5, 5, new Color(0, 0, 255)); font.Draw("pos= " + camera.Position, 5, 578 - 16, new Color(0, 0, 255)); font.Draw("tar= " + camera.Target, 5, 594 - 16, new Color(0, 0, 255));*/ font.Draw(Player.Experience(), new Vector2Di(505, 582), new Color(0,0,0)); } if (camera.Position.Z >= 10000) { font.Draw("Kiestél a Világból!", new Vector2Di(400, 300), new Color (0, 0, 0)); camera.Position = anode.Position; } if (Quest1Done) { yodanName.SetTextColor(new Color(255, 255, 0)); } if (IsKeyDown(KeyCode.Space)) { nodePosition.Y += MOVEMENT_SPEED * frameDeltaTime; } else if (IsKeyDown(KeyCode.LControl)) { nodePosition.Y -= MOVEMENT_SPEED * frameDeltaTime; } if (IsKeyDown(KeyCode.LShift)) { MOVEMENT_SPEED = 200.0f; } else { MOVEMENT_SPEED = 100.0f; } if (IsKeyDown(KeyCode.Esc)) { copyrightScreen.Visible = true; } if (IsKeyDown(KeyCode.KeyM)) { //Yodan.Run(new Vector3Df(-1642, -172, -1421), new Vector3Df(-1053, -167, -1416)); } if (IsKeyDown(KeyCode.KeyB)) { // Yodan.Wave(); Scripting.RunScript(Scripting.LoadScript()); } if (IsKeyDown(KeyCode.KeyV)) { //Yodan.Speak("./Content/Sound/vo/yodan/yo_20ft.mp3"); } else if (IsKeyDown(KeyCode.KeyN)) { //Yodan.Stand(); } else if (IsKeyDown(KeyCode.KeyC)) { //Yodan.WaveAndGreet(); } //Actionbar START //Auto-Attack if (IsKeyDown(KeyCode.Key1)) { if (!AutoAttack) { Delay(100); AutoAttack = true; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 11 + 24 + 25, 11 + 24 + 25 + 31 + 30); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 91 + 31 + 81 + 31, 91 + 31 + 81 + 31+90); } } else if (AutoAttack) { Delay(100); AutoAttack = false; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 1, 1); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 1, 90); } } } //Blades if (IsKeyDown(KeyCode.Key2)) { AnimatedMesh bladesmesh = smgr.GetMesh("./Content/3D/blades.mdl"); weapon.Mesh = bladesmesh; weapon.Scale = new Vector3Df(0.5f, 0.5f, 0.5f); weapon.Position = new Vector3Df(0, 0, 15); weapon.Rotation = new Vector3Df(0, -90, 0); Scenes.changeAnimation(weapon, 1, 1); currentWeapon = 1; } //Crossbow if (IsKeyDown(KeyCode.Key3)) { AnimatedMesh crossbowmesh = smgr.GetMesh("./Content/3D/crossbow.mdl"); weapon.Mesh = crossbowmesh; Scenes.changeAnimation(weapon, 1, 90); weapon.Scale = new Vector3Df(3.0f, 3.0f, 3.0f); currentWeapon = 2; } if (IsKeyDown(KeyCode.Key4)) { if (IsEtlapPickedUp) { bartenderForm.Visible = true; BartenderFormIsOpen = true; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } //Actionbar END //elteszi/előveszi a fegyvert if(IsKeyDown(KeyCode.Tab)) { if(weaponHolster) { weapon.Visible = false; Audio.playWave("./Content/sound/weapon.mp3"); weaponHolster = false; } else { weapon.Visible = true; Audio.playWave("./Content/sound/weapon.mp3"); weaponHolster = true; } } if (IsKeyDown(KeyCode.MouseLButton)) { AutoAttack = true; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 11 + 24 + 25, 11 + 24 + 25 + 31 + 30); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 91 + 31 + 81 + 31, 91 + 31 + 81 + 31 + 90); } } else if (!IsKeyDown(KeyCode.MouseLButton)) { AutoAttack = false; if (currentWeapon == 1) { Scenes.changeAnimation(weapon, 1, 1); } else if (currentWeapon == 2) { Scenes.changeAnimation(weapon, 1, 90); } } if (IsKeyDown(KeyCode.KeyX)) { Texture yodanMissing = driver.GetTexture("./Content/2D/yodanmissing.tga"); Dimension2Di yodanMisSiz = yodanMissing.Size; yodanMisSiz = anode.GetMaterial(0).GetTexture(0).Size; anode.SetMaterialTexture(0, yodanMissing); } if (IsKeyDown(KeyCode.KeyE)) { //Bartender Johh On-Use Vector3Df camtarget = camera.Target; if (!BartenderFormIsOpen) { if (new Vector3Df(727, 221, -986) <= camtarget) { if (new Vector3Df(763, 276, -2329) >= camtarget) { if (camtarget > new Vector3Df(184, -1843, -1255)) { if (camtarget > new Vector3Df(138, -1837, -2318)) { bartenderForm.Visible = true; BartenderFormIsOpen = true; if (!IsEtlapPickedUp) { ActionBar.Image = driver.GetTexture("./Content/2D/Hud/Actionbar_etlap.tga"); Audio.playWave("./Content/sound/vo/waiter_john/teatime.mp3"); } IsEtlapPickedUp = true; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } } } } else if (BartenderFormIsOpen) { bartenderForm.Visible = false; BartenderFormIsOpen = false; Audio.playWave("./Content/sound/paper_pickup.mp3"); } } if (IsKeyDown(KeyCode.KeyK)) { //Yodan.GoGhost(); } if (IsKeyDown(KeyCode.KeyJ)) { //Yodan.GoNormal(); } if (IsKeyDown(KeyCode.KeyL)) { } if (IsKeyDown(KeyCode.F7)) { Delay(500); takeScreenshot(device); } if (IsKeyDown(KeyCode.F9)) { Delay(500); string campos = camera.Position.ToString(); Logger.Log("position:" + campos); string camtar = camera.Target.ToString(); Logger.Log("target: " + camtar); } if (IsKeyDown(KeyCode.LShift)) { if (IsKeyDown(KeyCode.KeyY)) { Environment.Exit(0); } else if (IsKeyDown(KeyCode.KeyN)) { copyrightScreen.Visible = false; } } camera.Position = nodePosition; driver.EndScene(); } device.Drop(); }