Git Product home page Git Product logo

fireworks's Introduction

Fireworks

ASCII Fireworks in C#

fireworks

How does it work?

There are two main components: the IEntity and the IEntityManager

IEntity

The IEntity is any kind of figure that wants to be drawn. In this case, there are two entities: the Firework and the Sparkles.

When a Firework dies, it's deathwish is to spawn a Sparkles in it's place, and when the Sparkles die, it's deathwish is to spawn a new Firework.

The IEntity has two functions: a Draw, an Update, and a RequestDeathWish.

The Update function is where all core logic and processing goes - this could be parallelized as to speed up the process in the event that lots of entities are being processed. This returns an UpdateResult, which will tell the IEntityManager whether to:

  • Standby: Ignore the entity
  • Draw: Schedule the entity for drawing on the next loop
  • Kill: Kill the entity immedietly after processing

Standby: Nothing happens.

Draw: The Draw function is where the entity draws itself to the screen. No logic should be performed here, as all the logic should already be calculated in the Update function. When the entity requests to be drawn, this function will be called.

Kill: The entity's RequestDeathWish function will be called to store the deathwish, and then promptly disposed. The deathwish will be executed in parallel while drawing.

IEntityManager

The IEntityManager handles each entity. It runs in a loop. First, it'll call Update on every entity, asking them for their state.

  • Kill: Their death wish and they will be promptly disposed
  • Draw: They will be drawn
  • Standby: Ignored

Immedietly after calling update, every entity that requests a Kill will have their death wish stored and be disposed. Then, the entities that wish to be drawn will be drawn in parallel to executing the deathwishes gathered from the disposed entities.

fireworks's People

Stargazers

 avatar

Watchers

James Cloos avatar monoclex avatar

Forkers

trinitek

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.