Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hackily fix compile errors in the tests. #37

Merged
merged 3 commits into from
Apr 21, 2019

Conversation

lye
Copy link

@lye lye commented Feb 24, 2019

I'm not quite sure how to run the tests, but some things I probably did wrong:

  • In the AudioTest, couldn't figure out the right way to pass an
    AudioClip to AudioAPI::play. The original test set up a background
    track; pretty sure AudioAPI::play doesn't quite do that.
  • In the EntityTest, during TestState::init, a World reference is
    stolen from a unique_ptr. There's an API mismatch wherein createWorld returns a
    unique_ptr<World>, but StatsView::setWorld wants an unmanaged pointer
    (and doesn't take ownership of it). Stealing the pointer (via
    unique_ptr::release/unique_ptr::reset) is terrible, but I'm not sure
    how the ownership semantics should work.
  • In the EntityTest, the mask passed to SpritePainter::add was 0; this
    causes the sprite to never be drawn (via SpritePainter::draw; the
    getMask() & mask check fails). I'm not entirely sure what the mask does,
    but setting it to 1 makes something (albeit incorrect) renders. I think
    the assets might be out-of-date? But the animation frames don't look
    like they have the right texture coordinates.

I believe this fixes #32

Some things I probably did wrong:

 * In the AudioTest, couldn't figure out the right way to pass an
   AudioClip to AudioAPI::play. The original test set up a background
   track; pretty sure AudioAPI::play doesn't quite do that.
 * In the EntityTest, during TestState::init, a World reference is
   stolen from a unique_ptr. There's an API mismatch wherein createWorld returns a
   unique_ptr<World>, but StatsView::setWorld wants an unmanaged pointer
   (and doesn't take ownership of it). Stealing the pointer (via
   unique_ptr::release/unique_ptr::reset) is terrible, but I'm not sure
   how the ownership semantics should work.
 * In the EntityTest, the mask passed to SpritePainter::add was 0; this
   causes the sprite to never be drawn (via SpritePainter::draw; the
   getMask() & mask check fails). I'm not entirely sure what the mask does,
   but setting it to 1 makes something (albeit incorrect) renders. I think
   the assets might be out-of-date? But the animation frames don't look
   like they have the right texture coordinates.

I believe this fixes amzeratul#32
@amzeratul
Copy link
Owner

Hi there:

  • Audio API has changed so you now play audio events instead of clips. Under assets_src/audio_event, you can declare a file e.g. myAudio.yaml, that contains something of the sort:
---
actions:
  - type: play
    clips: [ sfx/myAudio.ogg ]
    group: sfx
    pitch: [ 0.9, 1.1 ]
    volume: [ 0.9, 1.0 ]
    delay: 0.25
...

You can then play it by calling AudioAPI::play("myAudio").

  • The World reference required that should be an observing pointer. It's a bit ugly and it should probably take a reference instead. Don't steal it from the unique pointer, but I guess rather take the address of the dereferenced (can't you .get() on a unique_ptr?)

  • The sprite mask changed, it used to be a single number that the sprite had to match the camera; it's now a bitmask (therefore 0 will never get rendered)

@amzeratul
Copy link
Owner

Also, thank you very much for your contribution! :)

@lye
Copy link
Author

lye commented Feb 25, 2019

Thanks for the feedback! I've updated the PR accordingly.

I'm not sure what was going on in my head with unique_ptr. Gonna blame that on sleepiness.

@geropl geropl mentioned this pull request Mar 6, 2019
@amzeratul amzeratul merged commit 10e2cc6 into amzeratul:master Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project does not compile on Linux + clang/gcc
2 participants