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

gamekit:stop does not work in a event handler #30

Closed
lthms opened this Issue Jun 16, 2018 · 5 comments

Comments

Projects
None yet
2 participants
@lthms

lthms commented Jun 16, 2018

Hi.

I am considering playing around with trivial-gamekit. Fair warning (and apologies in advance): I am very novice in common lisp.

I have been able to have a minimum working example (after installing quilcklisp).

I wanted to be able to quit the game from within the game, when for instance I press the left button of my mouse. Here is my code:

(cl:in-package :lysk)

(gamekit:defgame example () ())

(defmethod gamekit:post-initialize ((app example))
  (gamekit:bind-button :mouse-left :released
                       (lambda () (gamekit:stop))))

(defun run ()
  (gamekit:start 'example))

Unfortunately, it does not work, and even worth I cannot use gamekit:stop from the repl after a pressed left button.

Could you help me a bit here? I have no idea how to do this.

Thanks by advance, for your help and for your work.

@borodust

This comment has been minimized.

Owner

borodust commented Jun 16, 2018

Hi! Thank you for the report. At the moment #'stop works synchronously which means when called from the event callback it actually blocks the engine. Let me fix that :)

@borodust

This comment has been minimized.

Owner

borodust commented Jun 16, 2018

Fixed in bodge dist.

(ql:update-all-dists)
@borodust

This comment has been minimized.

Owner

borodust commented Jun 16, 2018

Please, let me know if it works fine for you after updating the dist.

@lthms

This comment has been minimized.

lthms commented Jun 16, 2018

Looks like it is working perfectly! Thanks a lot for your awesome reactivity. I will try to dive more into this, to see if I can implement a game client for my 2D online game using this project.

@borodust

This comment has been minimized.

Owner

borodust commented Jun 16, 2018

That would be awesome! Feel free to fire any issues or shoot any questions here or on #lispgames.

@borodust borodust closed this Jun 16, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment