Giter Site home page Giter Site logo

feathers's Introduction

DEPRECATED

Feathers has been discontinued. Please see https://github.com/Attict/Quill

Feathers

A lightweight game engine, that only uses feathers.

Why Feathers?

The idea of feathers is to give you full control over your app. By allowing you to create the components you want, for the feathers you design. All you need to know, is a feather!

Quick Start

lib/main.dart

import 'package:feathers/feathers.dart';
import 'dart:ui'

void main() async {
  FeatherEngine engine = new FeatherEngine();
  engine.initialize(new MyGame());
}

class MyGame extends Feather {
  @override
  void init() {
    this.addFeather('usersprite', new User());
    super.init();
  }
}

class User extends Feather {
  @override
  void init() {
    this.setQuill<SpriteQuill>(new SpriteQuill())
      ..setSize(50.0, 150.0)
      ..setPosition(25.0, 50.0)
      ..initWithColor(0xFFFF0000);
    super.init();
  }
}

The Feather Loop

Each feather, and all associated components follow a main way of looping. Primarily through the input, update, and render methods.

init: Initializes the feather/component.

destroy: Disposes of the feather/component, and all internal properties.

load: Loads any data neccessary for the feather/component.

unload: Unloads any data, to make room for loading new data.

input: Handles input events as neccessary for the feather/component.

update: Updates our feather/component.

render: Draws our feather/component to the screen.

Custom Components & Quills

Creating custom components is simple. Create a new file to hold your components, perhaps storing them in a custom_components directory. Add your class extending the Component class, then implement the methods appropriatly (found above in the Feather Loops section. It is up to you to determine how you want your component to handle everything! See example below:

class CustomComponent extends Component {
  @override
  void init() {
  }

  @override
  void destroy() {
  }

  @override
  void load() {
  }

  @override
  void input(Event event) {
  }

  @override
  void update(Time time) {
  }

  @override
  void render(Context context) {
  }
}

Quills

Create quills is similar to creating components, except you do not need to implement the core loop functionality, since this is already handled for you. The main focus of your custom quill is to add whichever components you wish to have combined into one component set. See example below:

class ColoredSquareQuill extends Quill {
  void initWithColor(Color color) {
    addComponent<PositionComponent>(new PositionComponent())
      ..setPosition(25.0, 50.0);

    addComponent<SizeComponent>(new SizeComponent())
      ..setSize(75.0, 75.0);

    addComponent<ColorComponent>(new ColorComponent())
      ..setColor(color);
  }
}

NOTE: Quill overrides require calling the super method at the end

Creating Consistent Components and Quills

  • Components should not contain constructors, to keep things simple. This will help keep your code maintainable. Future versions plan to remove adding access to constructors.
  • Quills should init with a unique method, such as initWithColor, rather than using the init override. Again, this helps keep code more maintainable.

Contributing

I hope that one day there will be a community of components and quills to help new users streamline their app development.

More Coming soon...

feathers's People

Contributors

attict avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

feathers's Issues

Action Component

  • Initial Setup
  • Tween size (width & height)
  • Tween position (x & y)

formally known as TweenComponent

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.