GithubHelp home page GithubHelp logo

chayimfriedman2 / dome_cloomnik Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 99 KB

A Rust framework for building DOME plugins

Home Page: https://docs.rs/dome_cloomnik

License: MIT License

Rust 100.00%
dome plugin plugin-framework rust game-engine game-engine-2d dome-engine

dome_cloomnik's Introduction

A Rust framework for building DOME plugins.

The basic structure of every plugin using this framework is:

Cargo.toml:

[package]
name = "my_awesome_dome_plugin"
description = "Really, really awesome DOME plugin written in Rust!"
version = "0.1.0"
authors = ["Me <[email protected]>"]
edition = "2018"

[dependencies]
libc = "0.2"
dome_cloomnik = "0.1"

[lib]
crate-type = ["cdylib"]

lib.rs:

use dome_cloomnik::{Context, WrenVM, register_modules, HookResult};

#[no_mangle]
#[allow(non_snake_case)]
extern "C" fn PLUGIN_onInit(get_api: *mut libc::c_void, ctx: *mut libc::c_void) -> libc::c_int {
    unsafe {
        dome_cloomnik::init_plugin(
            get_api,
            ctx,
            dome_cloomnik::Hooks {
                on_init: Some(on_init),
                pre_update: Some(pre_update),
                post_update: Some(post_update),
                pre_draw: Some(pre_draw),
                post_draw: Some(post_draw),
                on_shutdown: Some(on_shutdown),
            }
        )
    }
}

fn on_init(mut ctx: Context) -> HookResult {
    (register_modules! {
        ctx,
        ...
    })?;

    // ...
}

fn pre_update(mut ctx: Context) -> HookResult {
    // ...
}

fn post_update(mut ctx: Context) -> HookResult {
    // ...
}

fn pre_draw(mut ctx: Context) -> HookResult {
    // ...
}

fn post_draw(mut ctx: Context) -> HookResult {
    // ...
}

fn on_shutdown(mut ctx: Context) -> HookResult {
    // ...
}

Go ahead, and start with learning DOME plugins from the docs. Don't worry, much of the things there will apply to doom_cloomnik too!

dome_cloomnik's People

Contributors

chayimfriedman2 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.