Giter Site home page Giter Site logo

Comments (11)

thomaslevesque avatar thomaslevesque commented on May 25, 2024

Hi @ondrejsvorc,

Sorry you're having trouble. Not sure what could be causing this... it should work fine.

Is the ImageBehavior.AutoStart property set to true?

from wpfanimatedgif.

thomaslevesque avatar thomaslevesque commented on May 25, 2024

I tried using the other library of yours, XamlAnimatedGif,

AnimationBehavior.SetSourceUri(turtle.Body, gifSourceTurtle);

but it unfortunately didn't work either.

XamlAnimatedGif takes a URI, not a BitmapSource.

from wpfanimatedgif.

ondrejsvorc avatar ondrejsvorc commented on May 25, 2024

Hi @ondrejsvorc,

Sorry you're having trouble. Not sure what could be causing this... it should work fine.

Is the ImageBehavior.AutoStart property set to true?

Well, I tried the following: ImageBehavior.SetAutoStart(turtle.Body, true); and it didn't make it work.

from wpfanimatedgif.

ondrejsvorc avatar ondrejsvorc commented on May 25, 2024

I tried using the other library of yours, XamlAnimatedGif,
AnimationBehavior.SetSourceUri(turtle.Body, gifSourceTurtle);
but it unfortunately didn't work either.

XamlAnimatedGif takes a URI, not a BitmapSource.

Yeah, thanks. I mistyped there. However, it doesn't make a difference. The problem still lasts.

from wpfanimatedgif.

thomaslevesque avatar thomaslevesque commented on May 25, 2024

Well, I tried the following: ImageBehavior.SetAutoStart(turtle.Body, true); and it didn't make it work.

It's set to true by default, but I wonder if maybe you had disabled it

Anyway, in order to help you, I'm going to need to see more of your code. Are you able to share your project? If not, could you try to create a simple repro that you could share?

from wpfanimatedgif.

ondrejsvorc avatar ondrejsvorc commented on May 25, 2024

Well, I tried the following: ImageBehavior.SetAutoStart(turtle.Body, true); and it didn't make it work.

It's set to true by default, but I wonder if maybe you had disabled it

Anyway, in order to help you, I'm going to need to see more of your code. Are you able to share your project? If not, could you try to create a simple repro that you could share?

Sure. There you have it all https://github.com/ondrejsvorc/TurtleWalk

from wpfanimatedgif.

thomaslevesque avatar thomaslevesque commented on May 25, 2024

Hi @ondrejsvorc,

Thanks for the repro! But I'm not sure what I'm supposed to do to reproduce the problem. It seems the only thing I can do is launch level 1, where I see the turtle cross the screen but I can't do anything. The UpdateImages method is never executed.
How should I reproduce the problem?

from wpfanimatedgif.

ondrejsvorc avatar ondrejsvorc commented on May 25, 2024

You have to click on the images in the top right corner. One of them changes direction of the turtle and the other one stops or starts her movement. Once you do so, one of their Click methods is executed - at the end of the method there is UpdateImages() being called. I hope it helps!

from wpfanimatedgif.

thomaslevesque avatar thomaslevesque commented on May 25, 2024

Strange... on the PC where I first tried it, the control buttons didn't show up. Neither did the language switch buttons, so the app was in Czech. I just tried on another PC, and now I see those buttons.

I was able to reproduce the issue, however I don't really understand what's going on... The problem is related to the fact that you're using relative URIs for your images. This causes the animation loading to be deferred, and it should be retried when the base URI is known, but for some reason, that doesn't happen.

So, I don't know the exact cause, but there's an easy fix: use absolute URIs.
i.e. instead of

./Resources/Images/Turtle/turtle_direction_forward.gif

use

pack://application:,,,/Resources/Images/Turtle/turtle_direction_forward.gif

(and remove UriKind.Relative when you create the Uri instances)

from wpfanimatedgif.

ondrejsvorc avatar ondrejsvorc commented on May 25, 2024

Hello,

I've been thinking a bit and I came to realise I use margins in XAML to position its content. Hence everyone sees my game wrongly on smaller monitors. I'm aware it is a bad practise and I will replace it, probably by Grid.RowDefinitions and Grid.ColumnDefinitions.

Thanks a lot for solving the problem. I really do appreciate your time! If it weren't for you, I would be probably still sitting here, racking my brain over it.

Have a nice rest of your day!

from wpfanimatedgif.

thomaslevesque avatar thomaslevesque commented on May 25, 2024

You're welcome. Good luck with your project!

from wpfanimatedgif.

Related Issues (20)

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.