May 152012
 

Discussing how I do libraries and don’t do frameworks

  3 Responses to “DevVlog EP27: Libraries and Frameworks”

Comments (2) Pingbacks (1)
  1. Nice entry Andy! Keep’em comming.
    Although you said you dont have initialization code in your libraries, I guess you were referring to library initialization code. My initialization code (graphics, sound, etc) tends to end up in my utilities library exactly because of what you just said: dont repeat code.

  2. When I was talking about initialization stuff, I mean like… To use Flixel or Flashpunk, you first have to call a base game object, then start building on that and using those methods.

    My libraries are all distinct functions that don’t require “setup”; you just use them as-needed. I guess it’s the difference between using an enclosed *system* vs. using *tools*.

    I haven’t used those two libraries so I won’t use them as an example, but here’s one from Box2D. Let’s say we want to make a box fall with gravity on the screen.

    With Box2D:
    Install the package;
    include the library;
    create a box2d scene;
    define the world constants;
    define the box;
    be sure to include weight, friction, density, air density, and all those figures;
    hit run;
    hope that everything works ok, and despair at you not being able to directly set X/Y coordinates of the box as they are private in Box2D.

    With my library:
    Include my “tools” folder;
    create a square sprite;
    call sprite.addGravity(9.81);
    box starts falling, and all other properties are still easily used.

    (repeat if you want to add friction or air resistance or such)

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>