freenode/#lisp - IRC Chatlog
Search
3:36:46
vms14
guys, I want to make a function to move some character when I receive input events. I'm using clx and I'll receive one event once the player press a key and another when he relases the key.
3:37:04
vms14
the thing is, I want to create another function to stop moving once I receive the release event
3:37:34
vms14
I should make two functions inside a let sharing one symbol, using this symbols as a condition for a loop?
3:38:47
vms14
I mean, making the stop function change the value of some symbol that the move function uses as a condition of a loop
3:40:57
vms14
oh, I don't really need it I guess. I should receive more key events until the user releases the key, so the condition just needs to be the key events
3:45:48
drmeister
I'm building a complicated state machine and I want all of the state in packed into one vector.
4:26:05
PuercoPope
vms14: It depends on how you want to structure your main loop, a global variable works fine if its the 'main' character. You could also toggle a slot in the character class from :moving/:up/:left/etc to :stop and vice versa that controls what your main loop does with character on each tick
4:29:08
PuercoPope
phoe: Got everything the CI running using your example as a guideline. Now I need to update the test command to set its exit status according to the outcome of the test https://builds.sr.ht/~puercopop/job/110265
4:45:48
vms14
I'm thinking about how I should make the main loop move the random enemies I'll have and moving objects like a bullet
4:47:20
vms14
should I have a list of those objects wanting to move? What I have in mind is to have a list of elements wanting to move and every element should say the direction it wants to move at this moment, then iterate in that list and move every object/enemy at one point, because I cannot move entirely something without blocking the loop and having to finish that movement
5:08:19
PuercoPope
Any reason why you aren't using cl-sdl2+sdl2kit instead? It seems better suited for your use case. But to answer your question yeah having a list of 'active' objects is an ok strategy. You shouldn't use event-case but instead define a more general event loop which checks for X11 events to process but also 'ticks' the game. The CLX manual has some info on how to do that iirc
5:19:08
vms14
PuercoPope: I'll look about how to retrieve events manually, I use clx because I've learned Xlib with C and clx is just the same stuff but much better, I consider sdl, but I'm not able to use it in NetBSD because I don't know how to make the library look at the correct path, since it's different from the linux one
5:24:49
PuercoPope
vms14: the eclipse WM has an example of how to integrate CLX into your own event loop if you want to look at an example
5:28:37
vms14
PuercoPope: I didn't know it existed, thanks, I wanted to use stumpwm because it was written in lisp, but I'm used to a stacking wm and use a tiling one is a pain for me, I'll take a look at this one
5:40:48
vms14
found it at https://gitlab.common-lisp.net/eclipse/eclipse/blob/master/wm.lisp thanks PuercoPope <3
9:34:33
phoe
PuercoPope: <3 Try also using XFVB to get an X server on your CI, https://docs.travis-ci.com/user/gui-and-headless-browsers/
9:35:54
phoe
beach: as soon as I understand how does CCL's own compiler work. I think I mostly got the part that parses Lisp code into an IR that CCL calls "acode" and that then gets stuffed into a backend for a particular platform - the latter, it's magic to me.
9:36:42
phoe
PuercoPope: I see that your test failures are because of the DISPLAY variable not being set - in that case, do set it, and set it to a meaningful value that responds to an actual X server running on your VM. That is what XFVB is for.
9:36:47
beach
Maybe you should do one step at a time, and start by replacing the CCL reader by Eclector. :)
9:37:51
phoe
beach: my first step is squashing ansi-test bugs. Once that's done, I will think of that and possibly try doing it on a separate branch.
9:39:12
beach
Though, CCL is another implementation that is written mainly in Common Lisp, so it would be a better candidate for that kind of stuff than the implementations written in C or C++.
9:41:51
phoe
beach: I know you are half joking, but maybe it's possible. If anything, one could at least introduce a decent mechanism that allows one to utilize a different implementation of #'READ than the built-in one.
9:44:48
beach
phoe: Well, my goal with SICL has always been partly to cut down on the global maintenance burden for maintainers of Common Lisp implementations. But I realized from the start that these maintainers would be reluctant to ditching their code in favor of the portable one.
11:07:34
easye
I think the EQUAL correspondence will be valid for the CL:TRUENAME of the pathname, and otherwise implementation dependent.
11:09:19
phoe
I have a CCL situation where *compile-file-pathname* is bound to a logical pathname inside the file being compiled but is a physical pathname outside it.
11:09:21
easye
Ah, man. I'm speaking as an lazy implementer here. The CLHS is a maze of twisty hyperlinks for me, all alike in different ways.
11:10:06
phoe
So either the two should be able to be equal to each other, or they should be both logical or both physical.
11:10:46
easye
CL:*LOAD-TRUENAME* should be were the comparison is made. Or the CL:TRUENAME of CL:*COMPILE-FILE-PATHNAME* for that instance of a compilation phase.
11:11:23
easye
A logical pathname is sort of a predicate that you bind at runtime to work with "reified" CL:PATHNAMEs
11:18:01
phoe
I am lazy that way. I load ANSI-TEST, set up the proper default pathname defaults, (in-package :cl-test) and just evaluate the test body.
11:20:17
MichaelRaskin
The issue is slightly unclear whether it is *compile-file-pathname* that is logical pathname (seems so)
11:21:43
phoe
The value of *compile-file-pathname* must always be a pathname or nil. The value of *compile-file-truename* must always be a physical pathname or nil.
11:22:33
phoe
During a call to compile-file, *compile-file-pathname* is bound to the pathname denoted by the first argument to compile-file, merged against the defaults.
11:23:07
MichaelRaskin
And the result has the same logical-ness as *defualt-pathname-defaults*, right?
11:24:09
phoe
merge-pathnames returns a logical pathname if and only if its first argument is a logical pathname, or its first argument is a logical pathname namestring with an explicit host, or its first argument does not specify a host and the default-pathname is a logical pathname.
11:25:03
phoe
First argument is #p"foo.lsp" and therefore has no host; the default is a physical pathname.
11:26:23
phoe
merge-pathnames returns a logical pathname only in three cases, and none of the three cases happen here.
13:15:34
phoe
I see that SBCL ignores this altogether and flips the table as soon as it sees an OR type
14:14:16
galdor
is it me or UIOP:RUN-PROGRAM does not offer the possibility to specify the directory to use as current directory for the subprocess being created ?