1. 26 Dec, 2020 33 commits
  2. 25 Dec, 2020 3 commits
    • Rahix's avatar
      Merge 'Fix memory leak of registered images' · 0d9d6be5
      Rahix authored
      See merge request !24
      0d9d6be5
    • Simon Goller's avatar
      Fix future memory leak of registered images · fccc526d
      Simon Goller authored and neosam's avatar neosam committed
      Sprites were loaded during the level_loading und the level images in
      InGameState::new() but they were never cleaned up.  As soon as the
      InGameState starts several times, this would lead to a memory leak.
      This commit contains a separate treatment for sprites and the level
      images:
      
      Since sprites are stored as a global Enum, they will now be initialized
      only once on the first loading state.  When loading the images, they
      check if the ImageHandle is already registered on the renderer to
      determine if loading is required.
      
      Level foreground and background on the other hand are dynamically loaded
      in the InGameState.  The InGameState got a new attribute
      `registered_images: Vec<resources::ImageHandle>` which stores all
      `ImageHandle` of dynamically loaded images.  On deinint, they
      get deregistered from `Rendering`.
      fccc526d
    • neosam's avatar
      Merge branch 'rahix/wip' into 'master' · 496d4eb5
      neosam authored
      More features
      
      Closes #16
      
      See merge request !23
      496d4eb5
  3. 23 Dec, 2020 4 commits
    • Rahix's avatar
      moving: Fix collision detection algorithm · 1c33106d
      Rahix authored
      The previous code did not work properly when more than a single
      collision is happening at the same time.  The two biggest issues were:
      
      1. For optuse angles, the final velocity would actually point backwards
         from the intended movement direction, causing the entity to wiggle
         around.
      
      2. For acute angles, the final velocity would still contain components
         pointing towards some of the normals, leading to the entity moving
         into some of the colliders.
      
      To fix this, refactor the code such that we can, after calculating the
      final velocity, check that it does not have any remaining components
      towards any of the collision normals and that the final velocity is
      still pointing somewhat towards the original movement direction.  If any
      of those checks fail, no movement is performed at all.
      
      I am not sure if this is the most efficient way to implement this but
      I was not able to find a better solution.  If someone who is more
      familiar with analytic geometry has a better idea, please share!  The
      comments in this implementation should explain the conditions which must
      be upheld.
      1c33106d
    • Rahix's avatar
      testlevel: Replace some colliders with rotated versions · ed1286ce
      Rahix authored
      Makes it a bit cleaner but more work still to go.
      ed1286ce
    • Rahix's avatar
      svg_loader: Support rotated rectangle colliders · 6124c4a6
      Rahix authored
      Support a simple `transform="rotate(x)"` rotation on rectangle colliders
      by properly transforming it into our internal data format.
      6124c4a6
    • Rahix's avatar
      9df32996