1. 25 May, 2016 2 commits
    • Terence Martin's avatar
      Switch to release 0.3.1 · 934f560b
      Terence Martin authored
      This officially bumps the engine version number up.
      934f560b
    • Terence Martin's avatar
      Include toggleable fullscreen support · 1261a443
      Terence Martin authored
      Include new methods and properties on the stage object; check to see
      if it is currrently fullscreen or not, set an explicit state, and
      toggle between the two.
      
      This is theoretically implemented so as to work in multiple browser.
      1261a443
  2. 24 May, 2016 3 commits
    • Terence Martin's avatar
      Force scaling on mobile devices · d665d1fe
      Terence Martin authored
      Using a simple test, make sure that the page always turns on the new
      scaling feature when on a mobile device, even if the game author has
      not provided that option (it's off by default).
      
      This makes the pages work as expected on a mobile device regardless.
      d665d1fe
    • Terence Martin's avatar
      Include support for touch events and scaling · c5c16466
      Terence Martin authored
      Here we add in two new features; scaling the canvas up to fill the
      page as much as possible, and touch events.
      
      Currently, touch events are always handled, although unless the device
      being used can generate them, they have no effect. The touch events
      are converted into appropriate mouse events and triggered that way,
      so anything done with a mouse should also be possible via a touch.
      
      The canvas scaling is actually a two part thing; firstly, the canvas
      is now properly centered horizontally AND vertically inside the page,
      taking into account the size of the headers and footers (also the
      footer is now properly static).
      
      Additionally, an optional boolean (which defaults to false) can be
      specified, which causes the canvas to visually scale to fill the whole
      window container less the header and footer, while maintaining aspect
      ratio.
      
      When the boolean is false, the canvas still centers itself in the page
      when the orientation of the device or the size of the window changes.
      c5c16466
    • Terence Martin's avatar
      Include support for Sublime Text · 4af729b3
      Terence Martin authored
      Control files for editing this project via sublime text have been
      added, since I've ditched WebStorm.
      4af729b3
  3. 31 Mar, 2016 1 commit
    • Terence Martin's avatar
      Enhance Vector2D API · 3437b8c9
      Terence Martin authored
      The Vector class now includes the ability to set its components both
      using setTo(), setToXY() and setToArray() as well as the ability to
      return its values as an array via toArray().
      
      These are stolen from the Point class.
      3437b8c9
  4. 30 Mar, 2016 2 commits
    • Terence Martin's avatar
      Bump the engine to version 0.3.0 · 5f24694f
      Terence Martin authored
      This will be the version of the engine that will be used for the next
      project in the series from the Chris DeLeon Udemy game development
      course, "brick breaker" i.e. breakout.
      
      This includes one last bug fix from the 0.2 series used for ts-tennis
      that uncovered a bug in the vector magnitude code regarding allowing
      a negative magnitude to be set, which would flip the vector direction
      unintentionally.
      5f24694f
    • Terence Martin's avatar
      Fix a bug in vector magnitude code · 826b14aa
      Terence Martin authored
      The setter for the Vector2d.magnitude property uses trig to adjust
      the magnitude of the vector while retaining its direction.
      
      There was a "flaw" in the code in which if a negative magnitude was
      provided, the operation would work as expected to set the magnitude
      but would also reverse the direction of the vector.
      
      This is fixed by ensuring that we only use the absolute value of the
      magnitude value provided.
      826b14aa
  5. 29 Mar, 2016 4 commits
    • Terence Martin's avatar
      Bump the engine to version 0.2.8 · 82d2a405
      Terence Martin authored
      This will be the official release of the engine to the next version,
      which adds a global stage for debugging and modifies the Point and
      Vector2D class API's a bit to be more useful.
      82d2a405
    • Terence Martin's avatar
      Typos and global stages · 1ed50091
      Terence Martin authored
      Fixed a couple of typos while adding the notion that nurdz.stage
      contains a reference to the last constructed Stage object, which
      should hopefully be the *only* one ever created.
      
      This aids in debugging because it allows console access to the stage,
      and through that the scenes and their contents.
      1ed50091
    • Terence Martin's avatar
      Extend the Vector2D class a bit · 47a7c2b4
      Terence Martin authored
      As an oversight/oversimplification on my part, I made the vector API's
      relating to its direction take degrees.
      
      This is great from a debugging standpoint but awful from a using
      vectors standpoint, since it requires a bunch of extra conversions
      to/from radians, which is a drag and a half.
      
      So now all of the API's that would take or return a direction default
      naturally to radians and have a degrees version that does a
      converstion for you.
      
      Also, since there is a Utils function for doing these conversions,
      they're used now instead of inlining it all the time.
      47a7c2b4
    • Terence Martin's avatar
      Extend the Point class a bit · 06d628ad
      Terence Martin authored
      Add the ability to pass Vector instances to some methods, such as
      translate, since that is totally a thing that I wish already existed
      and is natural.
      
      While in the vicinity I remembered that I made a utility function to
      clamp values to a range, so I modified the implementation of
      clampX/clampY to use that, for cleanliness.
      06d628ad
  6. 26 Mar, 2016 3 commits
    • Terence Martin's avatar
      Bump the engine to version 0.2.7 · 95694545
      Terence Martin authored
      This will be the official release of the engine to the next version,
      which updates things to work with the latest versions of TypeScript
      and includes a simple vector flipping API.
      95694545
    • Terence Martin's avatar
      Add Vector component flip API · bfff5ea6
      Terence Martin authored
      Since I'm in the neighborhood, I thought I'd go ahead and include a
      Vector API that I forgot I wanted to add before the last release; the
      ability to flip the sign of the X and Y components individually,
      which can be useful for things like bouncing collisions.
      bfff5ea6
    • Terence Martin's avatar
      Upgrade to the latest TypeScript version · d6ce5b55
      Terence Martin authored
      I realized that the TypeScript version built into WebStorm was different
      (and newer, as of the latest release) than the version that I have
      globally installed, and both were out of date.
      
      This is the core of some weird issues I've been seeing lately, where
      I revert a git change made from files I hand compiled and then
      WebStorm decides that they're slightly different.
      
      To get around this, I've upgraded my global compiler to the latest
      version and told WebStorm to use that version instead of its included
      version.
      
      This required some slight changes to the tsconfig.json files because
      I'm generating a single output file but the config is specifying a
      module format that does not allow this. That doesn't actually matter
      since I'm not using modules anyway, but changing it makes the
      compiler happy so there you have it.
      d6ce5b55
  7. 24 Mar, 2016 5 commits
    • Terence Martin's avatar
      Bump the engine to version 0.2.6 · 3c5b8500
      Terence Martin authored
      This will be the official release of the engine to the next version,
      which adds in some vector logic and the ability to detect the exact
      intersection point between a line and a rectangle.
      3c5b8500
    • Terence Martin's avatar
      Include tests for line/shape collisions · fadf97b7
      Terence Martin authored
      This includes the formal testing for the new collision code. This is
      set up to try to collide with all shapes and not just the rectangles,
      so that when we include that ability (eventually) we will be ready to
      go.
      
      The control line for this now renders with an arrow head only on its
      end, allowing us to visuzlize it's direction better. Additionally,
      the perpendicular is rendered at the originating endpoint of the line.
      
      This is not actually needed for anything, but it's a nice visualization
      of which side of the line is the left side and that the vector code
      is working.
      fadf97b7
    • Terence Martin's avatar
      Include line/collider collision routine · cc4205d7
      Terence Martin authored
      This ties the code from the previous commit into the actual collider
      object, allowing you to test for the intersection between a line and
      a collision object.
      
      Currently this is defined only for rectangles, so objects with
      circular collision will never intersect.
      cc4205d7
    • Terence Martin's avatar
      Include Line/Rect intersect and fix formatting · 96617afc
      Terence Martin authored
      This includes a utility collision routine for determining the collision
      point between a rectangle and a line segment. The methods will tell
      you the exact point that the segment intersects with the rectangle,
      using the directionality of the line segment to determine which of
      multiple intersections is the correct one.
      
      Additionally, I didn't realize that WebStorm was a tit about indenting
      the code due to there being a leading comment (yet another instance of
      broken code formatting, sigh), so that is fixed as well.
      96617afc
    • Terence Martin's avatar
      Include Math.sign polyfill · 17cf9378
      Terence Martin authored
      Some new collision code wants to know the sign of numbers, which
      javascript kinda supports but TypeScript does not include in its
      declaration files.
      
      I assume that this has everything to do with it not being standardized
      yet, as older versions of Chrome don't support it (for example).
      17cf9378
  8. 23 Mar, 2016 1 commit
    • Terence Martin's avatar
      Fix arrow rendering code · 6f636394
      Terence Martin authored
      Something that slipped through the initial port of the engine without
      being noticed is that the symbolic constants for indicating if arrow
      heads should be drawn at the start or end of the line were reversed.
      
      The two constants have now been properly reordered in the enumeration.
      6f636394
  9. 16 Mar, 2016 1 commit
    • Terence Martin's avatar
      Tighten up the code a bit · ae223a30
      Terence Martin authored
      This change does two things; firstly it adds in the notion of
      changing the direction of the vector by setting a property in the
      same way that setting the magnitude can be done the same way.
      
      This just makes the API look nicer, and some minor code changes need
      to occur where fetching the current direction is now no longer a
      method call.
      
      Secondly, the code to alter the magnitude is done via trig instead of
      the simple way I originally had, which was to normalize the vector
      and then scale it.
      
      This is done on the presumption that calculating sine and cosine are
      faster than a square root. This may or may not actually be the case,
      though.
      ae223a30
  10. 15 Mar, 2016 7 commits
    • Terence Martin's avatar
      More enhanced utility code · 4ca71946
      Terence Martin authored
      Include the ability to normalize a value within a range and do a
      linear interpolation from a normalized value to a range.
      
      Both of these operations are simple, but having methods for them
      helps to document what they're being used for, so I decided that they
      should exist anyway. This eases the inner tension of having repeated
      code that could be factored out.
      4ca71946
    • Terence Martin's avatar
      Enhance utilities · bfb1dff6
      Terence Martin authored
      Based on the previous edits, add in some extra utility methods for
      finding the distance between two points as the square of the distance
      instead of the actual distance.
      
      These functions are used in the circle collision routines, so those
      have been modified to compare the square of the distance to the
      square of the radius under the theory that a multiplication is faster
      than a square root for the purposes of a comparison that doesn't
      actually return the actual distance.
      bfb1dff6
    • Terence Martin's avatar
      Enhance the Point/Vector classes · 33e94f61
      Terence Martin authored
      The Point class gains a static construction method that can create a
      point given a vector and an optional origin, the ability to calculate
      the rotation between itself and another point and the distance between
      itself and another point.
      
      The Vector class now allows you to set its magnitude as a simple wrapper
      around first normalizing and then scaling. We also modify the method
      that returns a copy of the vector after it is made orthogonal to itself
      to modify the vector directly and then make a new copy method. This
      covers the use case of wanting to just rotate a vector without
      creating a new one.
      33e94f61
    • Terence Martin's avatar
      Update the ortho test code · 32558607
      Terence Martin authored
      This replaces a bunch of lines of code that were doing vector math
      directly with points with a ssingle line that does everything that we
      need all in one set of chained calls.
      32558607
    • Terence Martin's avatar
      Actually export the vector class · 11a6e687
      Terence Martin authored
      Well, that's embarassing.
      11a6e687
    • Terence Martin's avatar
      Include a simple Vector class · 57723e78
      Terence Martin authored
      This represents only 2D vectors (all we care about at the moment) and
      has a bit of an API. Some changes could probably be done here.
      
      For one thing, the Point class and this class are very similar in
      many respects, so it might be a good idea to have a common ancestor?
      
      Also, the Point class could be extended to allow moving a point along
      a vector or such; we'll leave that to when it's actually needed,
      though.
      57723e78
    • Terence Martin's avatar
      Visually render a perpendicular line to the new control line that we · 1b8b44d2
      Terence Martin authored
      will use for our collision detection routines between lines and shapes.
      
      This will come into play when calculating circle collisions and this
      makes the operation easier to visualize.
      1b8b44d2
  11. 15 Feb, 2016 2 commits
    • Terence Martin's avatar
      Get ready for line->shape collisions · df786de5
      Terence Martin authored
      An extra set of points has been added to render a line for checking
      collisions with shapes. These points are stored the same as the other
      points, but the line color is changed before rendering the line.
      
      Additionally, we no longer allow the shape/point collision involving
      the shape that follows the mouse to collide with the static shapes on
      the stage while doing a mouse drag.
      df786de5
    • Terence Martin's avatar
      Merge branch 'dev' into dev-collide · a1e12112
      Terence Martin authored
      a1e12112
  12. 12 Feb, 2016 4 commits
  13. 10 Feb, 2016 3 commits
  14. 09 Feb, 2016 2 commits