RunnIT

Code

No file open

Console

Project Explorer

Files

Folder: /
    Starting compiler...

    RunnIT

    Write and run VB.NET and C# in your browser, with no installation required. Ideal for Macs, Chromebooks and other non-Windows devices.

    Features

    Full IntelliSense, breakpoint debugging and variable inspection, plus a graphics API for animations and games.

    Powered by .NET 10 via WebAssembly. Some desktop-specific .NET features aren't available in the browser.

    © 2026 Neil Kendall - More @ www.korovatron.co.uk

    RunnIT Graphics API

    A small 2D drawing API for animations and student-built games. Add Imports Runnit in VB.NET or using Runnit; in C#. All members below belong to Graphics, unless stated otherwise. C# names are case-sensitive.

    Canvas and frames

    Coordinates are drawing pixels: (0, 0) is the top-left, x increases rightwards and y increases downwards. The display scales without changing these coordinates.

    SetSize(width, height)
    Set the drawing size. Both arguments are integers from 1 to 4096. Each Run starts at 1280 × 720. Resizing clears the canvas and queued commands, so normally do this once at startup.
    Width, Height
    Read-only integer drawing dimensions, not the on-screen display size.
    Clear(colour)
    Queue a background fill over the whole canvas. Use it at the start of each frame to remove the previous drawing.
    DrawPixels(x, y, width, height, pixels)
    Queue a block of pixels with integer coordinates and dimensions. pixels is a byte array containing exactly four bytes per pixel: red, green, blue and alpha (0–255), left to right and top to bottom. For example, {255, 0, 0, 255} is one opaque red pixel. Dimensions must be 1–4096, with at most 64 MiB of pixel data queued per Present(). The array is copied when called; off-canvas pixels are clipped. Pixels replace existing canvas content, including transparency, rather than blending with it.
    Present()
    Display queued drawing commands on the next animation frame and wait for that frame. Call once per loop iteration. Drawing commands alone do not display a frame. Background tabs may pause animation.
    DeltaTime
    Read-only elapsed seconds between the two most recent presented frames; zero before and immediately after the first Present(). Multiply speed in pixels/second by this value. It is not capped; Math.Min(Graphics.DeltaTime, 0.1) limits large jumps after a pause.

    Shapes and colours

    Drawing coordinates and dimensions use Double in VB.NET / double in C#. Colours are CSS strings such as "lime", "#00e676" or "rgba(0, 230, 118, 0.5)". Commands draw in the order you call them.

    Rectangle(x, y, width, height, colour)
    Draw a filled rectangle with its top-left at (x, y).
    Circle(x, y, radius, colour)
    Draw a filled circle centred on (x, y).
    RectangleOutline(x, y, width, height, colour, lineWidth = 1)
    Draw an unfilled rectangle. The optional line width must be positive.
    CircleOutline(x, y, radius, colour, lineWidth = 1)
    Draw an unfilled circle. Radius must be non-negative; the optional line width must be positive.
    Line(x1, y1, x2, y2, colour, width = 1)
    Draw a line between two points. The optional width is the stroke thickness in drawing pixels.

    Arguments shown with = are optional defaults. Omit them to use the default, or supply a value in that position.

    Text

    Text(text, x, y, colour, size = 20, font = "sans-serif", alignment = TextAlignment.Left, baseline = TextBaseline.Alphabetic)
    Draw a string. Size is a positive integer in pixels; font is a valid CSS font family available in the browser, such as "monospace" or "Consolas, monospace".
    TextAlignment.Left, TextAlignment.Center, TextAlignment.Right
    Choose which part of the text is anchored at x.
    TextBaseline.Alphabetic, TextBaseline.Top, TextBaseline.Middle, TextBaseline.Bottom
    Choose how text is positioned relative to y. The default alphabetic baseline is not the top of the text.
    TextWidth(text, size = 20, font = "sans-serif")
    Return the text width as a Double / double in drawing pixels. Use the same size and font as your Text call.

    Images

    Image(name, x, y)
    Draw a project image at its natural size, with its top-left at (x, y).
    Image(name, x, y, width, height)
    Draw it scaled to positive width and height values.
    ImageRegion(name, sourceX, sourceY, sourceWidth, sourceHeight, x, y)
    Crop a rectangle from a project image and draw it at (x, y) at the cropped region's natural size. Source coordinates are image pixels measured from the image's top-left, not canvas coordinates.
    ImageRegion(name, sourceX, sourceY, sourceWidth, sourceHeight, x, y, width, height)
    Draw the cropped region scaled to the destination width and height. Regions use nearest-neighbour scaling to keep pixel-art frames crisp without blending neighbouring sprites; normal Image scaling is unchanged. Source and destination sizes must be positive and finite; all coordinates must be finite. The source rectangle must fit entirely inside the image, otherwise an error is reported. Destination coordinates may be negative to draw partially off-screen.

    Import the image into Project Explorer first, then use its case-sensitive project path, for example Graphics.Image("images/player.png", 100, 100, 64, 64). Web URLs are not supported.

    For a sprite sheet with 32 × 32 frames in one row, Graphics.ImageRegion("sheet.png", frame * 32, 0, 32, 32, 100, 100, 64, 64) draws the selected frame at double size. In C#, add a semicolon. Choose a valid frame index in your own animation loop and call Present() to display it.

    PNG, JPEG, GIF, WebP and BMP raster data are supported when the browser can decode them; GIFs use a static frame. Limits: 500 KB per file, 4096 pixels per image axis and 64 MiB total decoded-image cache. Missing or invalid images report an error. Images and their regions share the same cache until the next Run, so file changes do not reload them during that run. SVG, automatic sprite animation, physics, collision handling and game-audio/music APIs are not built in; simple tones are available through Console.Beep.

    Keyboard

    KeyDown(key)
    Return Boolean / bool live held-key state.
    KeyPressed(key), KeyReleased(key)
    Return presses/releases collected at the last Present(). These flags stay unchanged until the next frame. A quick tap may set both; key auto-repeat does not create new presses.

    Click or focus the canvas to use its keyboard input. Keys are case-insensitive strings: A-Z, 0-9, "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Space" (or " "), Enter, Escape, Tab, Backspace, Delete, Insert, Home, End, PageUp, PageDown, Shift, Control, Alt, Meta, F1-F12 and unshifted punctuation (` - = [ ] \ ; ' , . /). Letter/digit/punctuation bindings follow the physical key independently of Shift; numeric keypad digits also work. Unsupported names report an error.

    Focus loss and new runs clear held and pending keys. Browser/OS shortcuts may reserve keys; Tab and Ctrl/Alt/Meta shortcuts retain their normal behaviour. A keyboard is needed for keyboard-driven games.

    Mouse

    Mouse values are sampled when Present() completes and remain unchanged until the next one. Read them after presenting a frame. Button numbers are 0 = left (default), 1 = middle, 2 = right.

    MouseX, MouseY, MouseInside
    Read-only drawing-space coordinates (Double / double) and whether the pointer is inside (Boolean / bool). Coordinates account for display scaling and custom canvas sizes, and can be outside the drawing area during a drag. Initially zero / false.
    MouseDown(button = 0)
    Whether the button is held at the sampled frame.
    MousePressed(button = 0), MouseReleased(button = 0), MouseClicked(button = 0)
    Boolean / bool event flags since the previous frame. A click requires a press and release on the canvas; releasing outside ends a drag but is not a click.
    MousePressedX(button = 0), MousePressedY(button = 0)
    MouseReleasedX(button = 0), MouseReleasedY(button = 0)
    MouseClickedX(button = 0), MouseClickedY(button = 0)
    Coordinates of the most recent matching event for that button. Initially zero; persist until another matching event. Multiple same-kind events between frames use the latest coordinates.

    SetSize clears pending mouse input; updated coordinates are sampled at the next Present(). Losing browser focus clears held buttons without inventing click/release events. Touch and pen input are not explicitly supported.

    Try it: move a circle

    Hold the right arrow to move; Escape ends the loop when the canvas has keyboard focus. You can always use Stop. For more examples, open the menu's Examples section.

    VB.NET

    Imports Runnit
    
    Module Program
        Sub Main()
            Graphics.SetSize(640, 360)
            Dim x As Double = 100
            Do
                Graphics.Clear("#0b0826")
                Graphics.Circle(x, 180, 20, "#00e676")
                Graphics.Present()
                If Graphics.KeyDown("ArrowRight") Then
                    x += 180 * Math.Min(Graphics.DeltaTime, 0.1)
                End If
            Loop Until Graphics.KeyDown("Escape")
        End Sub
    End Module

    C#

    using System;
    using Runnit;
    
    class Program
    {
        static void Main()
        {
            Graphics.SetSize(640, 360);
            double x = 100;
            while (!Graphics.KeyDown("Escape"))
            {
                Graphics.Clear("#0b0826");
                Graphics.Circle(x, 180, 20, "#00e676");
                Graphics.Present();
                if (Graphics.KeyDown("ArrowRight"))
                    x += 180 * Math.Min(Graphics.DeltaTime, 0.1);
            }
        }
    }

    Choose your first project

    Which language would you like to start with? You can create projects in either language later.