1.0.0-alpha.7 • Published 3 months ago

krunker-ui v1.0.0-alpha.7

Weekly downloads
-
License
LGPL-3.0
Repository
github
Last release
3 months ago

Krunker UI

React Components for Krunker

Features

  • Developed for and supports NodeJS v12 (CommonJS)
  • Easy API
  • Highly Tested

Usage

  1. Add the global types for Krunker. This makes your code aware of window.windows, playSound(), and other features.

    env.d.ts:

    /// <reference types="krunker-ui/window" />
  2. Import the components

    import { Switch } from "krunker-ui/components/Switch";
    
    function MyInterface() {
      const [unlimitedFPS, setUnlimitedFPS] = useConfig("unlimitedFPS");
    
      return (
        <Switch
          title="Unlimited FPS"
          description="Disables the FPS limit"
          defaultChecked={unlimitedFPS}
          onChange={(event) => {
            setUnlimitedFPS(event.currentTarget.checked);
            alert("Client will now restart");
            ipcRenderer.send("restart");
          }}
        />
      );
    }
  3. Render your interface in a window:

    (This is subject to change)

    import { createRenderContainer } from "krunker-ui/container";
    
    const html = createRenderContainer(() => <MyInterface />);
    
    const window: GameWindowRender = {
      header: "",
      label: "",
      width: 1100,
      popup: true,
      sticky: true,
      forceScroll: true,
      gen: () => html,
    };
    
    const id = windows.length;
    
    windows.push(window);
    
    // ...
    
    // Show the window
    showWindow(id);
1.0.0-alpha.7

3 months ago

1.0.0-alpha.6

3 months ago

1.0.0-alpha.5

10 months ago

1.0.0-alpha.4

12 months ago

1.0.0-alpha.3

12 months ago

1.0.0-alpha.2

12 months ago

1.0.0-alpha.1

12 months ago

1.0.0-alpha

12 months ago