[Pal-devel] Re: pal question (problem ?)
Nicolas Lamirault
lam at tuxfamily.org
Thu Jul 12 08:01:19 UTC 2007
oh thanks ! i will try this
Pal is a very good soft.
there is nice example.
one remarks concerning them. If we start theme using SLIME (i means
start lisp REPL not in the current directory), there is some problem
of font (default font isn't founded).
For my game, i try what to generate dynamic path using
asdf:component-relative-pathname. It works welL
i continue on my game ...
i've got another question. In the last Ubuntu, i can't start the game,
pal exemple or anyelse twice.
i explain :
i start the game
i play
q, for stop
i start the game
i've got :
memory fault
[Condition of type SB-KERNEL::MEMORY-FAULT-ERROR]
Restarts:
0: [ABORT] Return to SLIME's top level.
1: [ABORT] Exit debugger, returning to top level.
Backtrace:
0: (SB-KERNEL::MEMORY-FAULT-ERROR)
1: ("foreign function: #x8063F11")
2: ("foreign function: #x8064164")
3: ("foreign function: #xB65713BC")
4: ("foreign function: #xB70DFA71")
5: ("foreign function: #xB70E1541")
6: ("foreign function: #xB73F99BF")
7: ("foreign function: #xB73FF1E6")
8: ("foreign function: #xB73ED863")
9: (PAL-FFI:SET-VIDEO-MODE
#<unavailable argument>
#<unavailable argument>
#<unavailable argument>
#<unavailable argument>)
10: ((SB-PCL::FAST-METHOD PAL:OPEN-PAL NIL)
#<unused argument>
#<unused argument>
:WIDTH
#<unavailable argument>
:HEIGHT
#<unavailable argument>
:FPS
#<unavailable argument>
:TITLE ..)
11: (CLIMON::CLIMON-TEST)
12: (SB-INT:SIMPLE-EVAL-IN-LEXENV (CLIMON::CLIMON-TEST)
#<NULL-LEXENV>)
--more--
on some other computer (ubuntu, debian) i haven't got this problem.
any idea ?
thanks for your help
"Tomi Neste" <flatlander at yellow-hut.com> writes:
> Nicolas Lamirault <lam at perave.org> kirjoitti Wed, 11 Jul 2007 19:07:32
> +0300:
>
>>
>> hi,
>> i try your PAL library. It seems very useful. So i try to start use it
>> with a Simon like game.
>> first tests are concluants.
>> But i've got a problem to load several image in a loop :
>>
>> (defun play-sequence ()
>> "Draw the current color, and play the associated sound."
>> (loop for color in *random*
>> do
>> (when *debug*
>> (format t "~&Play ~A~%" color))
>> (set-simon color)
>> (draw *simon*)
>> (play-music (load-music *sound*) nil 255)
>> (sleep (/ 1 2))
>> (set-simon :base)
>> (draw *simon*)))
>>
>>
>> this function read *random* list and for each color draw the available
>> image :
>>
>> (defmethod draw ((s simon))
>> (when *debug*
>> (format t "~&Draw ~A : ~A" *simon* (simon-image s)))
>> (draw-image (simon-image s) (v 0 0)))
>>
>>
>> set-simon update some internal variables.
>>
>> i've a test :
>>
>> (defun climon-test ()
>> (with-pal (:width +width+ :height +height+ :fullscreenp nil
>> :paths (concatenate 'string *climon-directory*
>> "font/"))
>> (initialize-simon)
>> (draw *simon*)
>> (setf *random* '(:blue :yellow :red :blue :green :blue :green
>> :red :red :blue :red))
>> (event-loop ()
>> (test-keys
>> (:key-space (play-sequence))
>> (:key-q (return-from event-loop))))))
>>
>> each object (simon-{color}) contains the same image but with the
>> specified color with a nice light.
>>
>> when we do the test, it seems that all the images are drawing. But in
>> real, i don't see images with specified colors. Sounds are ok
>>
>> any idea of my problems .
>>
>> i send you with this mail my code. Graphics and sound are stolen from
>> memotux (Simon in OCaml).
>>
>> thanks for any help
>>
>>
>
> Nice little game you got there! I'm surprised you got that far with
> the current PAL documentation being what it is... ;)
> It looks like your problem is in the play-sequence function, the
> following should work:
>
> (defun play-sequence ()
> "Draw the current color, and play the associated sound."
> (loop for color in *random*
> do
> (when *debug*
> (format t "~&Play ~A~%" color))
> (set-simon color)
> (draw *simon*)
> (pal::update-screen) ;; update the screen!
> (play-music (load-music *sound*) nil 255)
> (sleep (/ 1 2))
> (set-simon :base)
> (draw *simon*)))
>
> By default PAL updates the screen only once for each iteration of
> EVENT-LOOP so you need to do it manually. Since PAL::UPDATE-SCREEN is
> useful in these kinds of situations I'll change it into an exported
> symbol in the PAL package.
>
> Hope this helps, if you still have problems/questions feel free to ask.
>
>
--
Nicolas Lamirault
More information about the pal-devel
mailing list