Ejemplo n.º 1
0
        public void DrawOutputs(Vector2 mousePosInWorld)
        {
            for (int i = 0; i < Outputs.Count; i++)
            {
                Vector2 pos = GetOutputPosition(i);

                Color col = Outputs[i].Value == LogicValue.NAN ? Utility.COLOR_NAN : (Outputs[i].Value == LogicValue.HIGH ? Utility.COLOR_ON : Utility.COLOR_OFF);

                if ((mousePosInWorld - pos).Length() < Utility.IO_SIZE)
                {
                    col = IOHoverColor;
                }

                // Line to IO ball
                Vector2 startPos = new Vector2(Position.X + Box.width, pos.Y);

                Vector2[] points = new Vector2[] { startPos, pos };
                Raylib.DrawLineStrip(points, points.Length, BorderColor);

                Raylib.DrawCircleV(pos, Utility.IO_SIZE, col);

                string s = GetOutputID(i);
                if (s != null)
                {
                    Vector2 inputIdSize = Raylib.MeasureTextEx(Raylib.GetFontDefault(), s, Utility.TEXT_SIZE, 1f);

                    Raylib.DrawTextEx(Raylib.GetFontDefault(), s, new Vector2(pos.X - inputIdSize.X - 3 - Utility.IO_H_DIST, pos.Y - inputIdSize.Y / 2f), Utility.TEXT_SIZE, 1f, BorderColor);
                }
            }
        }
Ejemplo n.º 2
0
 public void Update()
 {
     Raylib.DrawCircleV(Raylib.GetMousePosition(), 50, Color.WHITE);
     foreach (var thing in grass)
     {
         thing.Update();
     }
 }
Ejemplo n.º 3
0
 public void Draw()
 {
     Raylib.DrawCircleV(Body.position + Body.size / 2, 50, Color.BLACK);
     foreach (var leg in legs)
     {
         leg.Draw();
     }
     //yPosRay.Draw();
 }
Ejemplo n.º 4
0
        public void Update()
        {
            var delta = Raylib.GetFrameTime();

            var lastPos = position;

            velocity.X += -Math.Sign(velocity.X) * 100 * delta;
            velocity.Y += 1000 * delta;
            position   += velocity * delta;
            Raylib.DrawCircleV(position, 10, Color.GREEN);
            Raylib.DrawLineV(position + Vector2.Normalize(position - lastPos) * 100, position, Color.BLUE);
        }
Ejemplo n.º 5
0
        public void Draw()
        {
            Raylib.BeginDrawing();
            Raylib.ClearBackground(Color.RAYWHITE);

            // TODO: Drawing related logic here

            // draws some text
            Raylib.DrawText("Your movespeed is " + movespeed, 10, 10, 32, Color.DARKGRAY);

            // draws a rotating texture in center of screen
            RayLibExt.DrawTexture(marioTexture, marioXPos, marioYPos, marioWidth, marioHeight,
                                  Color.WHITE, 0, 0.5f, 1.0f);
            Raylib.DrawCircleV(cursorpos, 40, LIME);

            Raylib.EndDrawing();
        }
Ejemplo n.º 6
0
    public void RenderNewWire(Color color, params Vector2[] positions)
    {
        for (int i = 0; i < positions.Length - 1; i++)
        {
            Vector2 start = positions[i];
            Vector2 end   = positions[i + 1];
            Raylib.DrawLineEx(start, end, 5f, Color.BLACK);
            Raylib.DrawLineEx(start, end, 3f, color);
        }

        for (int i = 0; i < positions.Length; i++)
        {
            Vector2 pos = positions[i];
            float   rad = 2f;
            Raylib.DrawCircleV(pos, rad + 1, Color.BLACK);
            Raylib.DrawCircleV(pos, rad, color);
        }
    }
Ejemplo n.º 7
0
        public void Draw()
        {
            var center    = Body.position + Body.size / 2;
            var leg1      = legAngle.ToVector() * 50;
            var leg2      = (-legAngle).ToVector() * 50;
            var armPos    = center - new Vector2(0, 30);
            var headPos   = armPos - new Vector2(0, 25);
            var legColor  = new Color(56, 124, 109, 255);
            var armColor  = new Color(233, 137, 106, 255);
            var headColor = new Color(248, 245, 241, 255);

            Raylib.DrawLineEx(center, center + leg1, 10, legColor);
            Raylib.DrawLineEx(center, center + leg2, 10, legColor);
            Raylib.DrawLineEx(center, armPos, 10, armColor);
            Raylib.DrawLineEx(armPos, headPos, 10, headColor);
            Raylib.DrawCircleV(headPos, 20, headColor);
            bow.Draw();
            Raylib.DrawLineEx(armPos, armPos + (90 - bow.rotation).ToVector() * 40, 10, armColor);
            walkingRay.Draw();
        }
Ejemplo n.º 8
0
        public void Update()
        {
            //player movement
            var dir = Vector2.Zero;

            if (Raylib.IsKeyDown(KeyboardKey.KEY_D))
            {
                dir.X = 1;
            }
            if (Raylib.IsKeyDown(KeyboardKey.KEY_A))
            {
                dir.X = -1;
            }
            if (Raylib.IsKeyDown(KeyboardKey.KEY_S))
            {
                dir.Y = 1;
            }
            if (Raylib.IsKeyDown(KeyboardKey.KEY_W))
            {
                dir.Y = -1;
            }
            if (dir != Vector2.Zero)
            {
                dir = Vector2.Normalize(dir);
            }
            playerPos += dir * Raylib.GetFrameTime() * 300;
            Raylib.DrawCircleV(playerPos, 10, Color.RED);

            for (var i = 0; i < rays.Count; i++)
            {
                rays[i].origin = playerPos;
                rays[i].angle  = MathF.PI / 4 + MathF.PI / rays.Count / 2 * i - Util.VecToAngle(Raylib.GetMousePosition() - playerPos);
                rays[i].Update(walls);
            }
            foreach (var wall in walls)
            {
                Raylib.DrawLineV(wall.p1, wall.p2, Color.PURPLE);
            }
        }
Ejemplo n.º 9
0
 public void Draw()
 {
     Raylib.DrawLineEx(position, EndPosition(length), 2, Color.RED);
     Raylib.DrawCircleV(EndPosition(length), 10, Color.BLUE);
 }
Ejemplo n.º 10
0
 private void Draw()
 {
     Raylib.DrawRectanglePro(rectangle, centerOfRect, randDegree, asteroidColor);
     Raylib.DrawCircleV(circlePos, 60, InvisColorForHitbox);
 }
Ejemplo n.º 11
0
 public void RenderSelected()
 {
     Raylib.DrawCircleV(this.GetPosition(), 4.5f, Color.ORANGE);
 }