Coder Social home page Coder Social logo

flounder-framework's Introduction

Flounder Framework

Flounder Framework is a modular Java framework composed of modules and extensions.

MacOS

MacOS must be run with the vm args: '-XstartOnFirstThread -Djava.awt.headless=true', because of the way it is...

Modules

A module (IModule) is a class that is built to serve a specific purpose, for example: the processor module only acts to manage requests. When they are updated in the main iterative loop is determined from the ModuleUpdate enum they pass through the super constructor. Modules may depend on other modules, for example: the profiler requires the logger. A requirement list if built within the framework.

Extensions

A extension (IExtension) is a class that is used to added extra functionality to a module. For example: a camera extension could be used to define a camera. The only requirement for a extension is for the module to support extensions. Creating a extension for the logger will not do anything! The extension may depend on other modules, and while it is active, the module will be a forced requirement (if not already depended on).

Creating a Project

You must in some way create a new FlounderFramework object, and also create a basic standard extension (we call them the programs interface). The interface will require module, and can be used to load configs, initialize display settings, create worlds, etc...

    import flounder.framework.*;
    import flounder.logger.*;
    import flounder.maths.*;
    import flounder.standards.*;

    /**
     * The class that contains the main method.
     */
    public class TestProject {
        public static void main(String[] args) {
            // Creates a new framework object.
            Framework framework = new Framework("test", -1, new TestInterface());

            // Runs the frameworks thread.
            framework.run();

            // After close, exits the programs.
            System.exit(0);
        }

        /**
         * The programs interface, this one is used for a simple close countdown.
         */
        public static class TestInterface extends Standard {
            private static final int INTERVAL_CLOSE = 60;

            private Timer timer;
            private int i;

            public TestInterface() {
                super(FlounderLogger.class);
            }

            @Override
            public void init() {
                FlounderLogger.get().log("TestInterface initialized!");

                this.timer = new Timer(1.0);
                this.i = 0;
            }

            @Override
            public void update() {
                // Called in the update pre loop. Framework update order: Always, /Pre/, Post, Render.

                // A simple close countdown.
                if (timer.isPassedTime()) {
                    i++;

                    if (i == INTERVAL_CLOSE) {
                        FlounderLogger.get().log("TestInterface requesting close!");
                        Framework.requestClose();
                    } else {
                        //	FlounderLogger.get().log("TestInterface closing after: " + (INTERVAL_CLOSE - i) + " seconds!");
                    }

                    timer.resetStartTime();
                }
            }

            @Override
            public void profile() {
                // Called after every update, if the profiler is open.
            }

            @Override
            public void dispose() {
                FlounderLogger.get().log("TestInterface disposed!");
            }

            @Override
            public boolean isActive() {
                return true;
            }
        }
    }

flounder-framework's People

Contributors

mattparks avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  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.