Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
uber small game engine with a plugin system
C++ C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
amaranthine full ham commit!
README.md Update README.md

README.md

Introduction

This is an attempt to make a simple extendable game engine. I don't really have things like code style, and documentation down, any suggestions are welcome. If you think I need to do something, I probably do! this project is no where near complete. I need to add a lot of documentation, though I try to make the code speak for itself when I can. And please remember that this is not my normal job, I program when bored!

dependencies

  • boost
  • squirrel (the language)
  • a (mostly) c++11 capable compiler

build

  • todo

install

  • todo!

use

  • todo!

making plugins

//provides the Amaranthine::extension, Amaranthine::plugin, and Amaranthine::engine classes
//note: typedef std::vector< std::pair<SQFUNCTION, SQInteger> > plugin;
#include "amaranthine.h"

/* this file includes the various squirrel functions necissary for proper plugin operation
   note: typedef SQInteger (*SQFUNCTION) (HSQUIRRELVM);
   note: SQInteger is usually whatever your system integer is (I think) */
#include <squirrel.h>
#include <iostream>
#include <utility>

// plugins for the squirrel engine MUST inherit from Amaranthine::extension
//note: this interface is variable and subject to change, if I find a more suitable API
class hello : Amaranthine::extension { 
    //this function provides the function pointers needed
    // for the squirrel engine to initialize the plugin
    plugin plugin_to_return;

    auto output_callback = [](HSQUIRRELVM vm) -> SQInteger {
        std::cout << "\nHello Word!\n";
        //right now for this demo we dont use the parameter
        return (SQInteger)(0);
        //return 0 to tell squirrel that your function doesn't have any returns
        //likewise 1 for a return value
        //and SQ_ERROR if things go bad
    };

    std::pair<SQFUNCTION, SQInteger> temp_pair =
        std::make_pair( (SQFUNCTION)(&output_callback), (SQInteger)(0) );

public:
    Amaranthine::plugin aquire() {
        plugin_to_return.push_back(temp_pair);

        return plugin_to_return;
    }
};

/* the cool ling about this kind of system for a plugin archetecture is that you don't
   have to structure your code in any particular way, other than having a class that
   can be called for plugin acquisition */

//the macro below handles the C Linkage interface boilerplate generation
//it's necissary because I don't wanna hand crank out this for every plugin,
//and because most c++ compilers mangle names and C doesn't like that
AMARANTHINE_MAKE_INIT(hello)

for more information see the squirrel vm documentation

included squirrel libraries

Right now there are no supported libraries besides the squirrel standard library. This will change in the future as more plugins are developed.

references

Something went wrong with that request. Please try again.