Dustbin

I made a little falling sand game today in mojo. https://github.com/helehex/dustbin
GitHub
GitHub - helehex/dustbin
Contribute to helehex/dustbin development by creating an account on GitHub.
27 Replies
Darin Simmons
Darin Simmons4w ago
Next up, model gym for learning lunar lander but all in mojo Wheeeeee
dlopen failed: /lib/x86_64-linux-gnu/libSDL2-2.0.so: cannot open shared object file: No such file or directory
[53663:53663:20240820,192200.276429:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.276745:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.277896:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.278108:ERROR elf_dynamic_array_reader.h:64] tag not found
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo game.mojo
[53663:53664:20240820,192200.282478:ERROR directory_reader_posix.cc:42] opendir /home/darin/.modular/crashdb/attachments/f2c3991d-7e5c-49d1-a008-2a286cd8d294: No such file or directory (2)
#0 0x00005ad3377633cb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) Signals.cpp:0:0
#1 0x00005ad337761329 llvm::sys::RunSignalHandlers() Signals.cpp:0:0
#2 0x00005ad337763a6d SignalHandler(int) Signals.cpp:0:0
#3 0x000072fb24842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000072faa0036000
mojo crashed!
Please file a bug report.
Illegal instruction (core dumped)
dlopen failed: /lib/x86_64-linux-gnu/libSDL2-2.0.so: cannot open shared object file: No such file or directory
[53663:53663:20240820,192200.276429:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.276745:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.277896:ERROR elf_dynamic_array_reader.h:64] tag not found
[53663:53663:20240820,192200.278108:ERROR elf_dynamic_array_reader.h:64] tag not found
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo game.mojo
[53663:53664:20240820,192200.282478:ERROR directory_reader_posix.cc:42] opendir /home/darin/.modular/crashdb/attachments/f2c3991d-7e5c-49d1-a008-2a286cd8d294: No such file or directory (2)
#0 0x00005ad3377633cb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) Signals.cpp:0:0
#1 0x00005ad337761329 llvm::sys::RunSignalHandlers() Signals.cpp:0:0
#2 0x00005ad337763a6d SignalHandler(int) Signals.cpp:0:0
#3 0x000072fb24842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000072faa0036000
mojo crashed!
Please file a bug report.
Illegal instruction (core dumped)
Thoughts?
Helehex
Helehex4w ago
I had to do it
Helehex
Helehex4w ago
tell me if running sudo apt install libsdl2-dev in your terminal works, if not i might have to make some changes to sdl bindings if your still awake i didnt see the message until now i have a feeling you'r gonna have to install all the satellite libraries aswell which im not even using working on improving sdl bindings rn to give better errors and such How can I incorporate both magnets and digital intelligence into my little dustbin
Darkmatter
Darkmatter4w ago
https://anaconda.org/conda-forge/sdl2 It might make sense to use the conda-forge version of sdl2.
Helehex
Helehex4w ago
that would probly be really helpful
Three chickens in the green bag
I didn’t realize there were SDL bindings already
Ryulord
Ryulord4w ago
I was looking into doing this but the sdl bindings currently use mojo nightly and magic doesn't support nightly yet. Definitely going to try to get that working once next stable drops
Darkmatter
Darkmatter4w ago
We really just need nightly in magic.
Ryulord
Ryulord4w ago
yeah this would also work
Helehex
Helehex4w ago
getting some random segfaults in the nightly that just dropped, same with thermo i think maybe something with the sdl event system
Three chickens in the green bag
What’re tonight’s changes?
Helehex
Helehex4w ago
ok, it's definitely something with the event system causing segfaults.. but now mojo is refusing to compile because of commented out code.. nvm i forgot the sdl example file was using the packaged version 😮‍💨
Helehex
Helehex4w ago
i fixed the aforementioned segfault in sdl bindings btw, but also, tonight i added camera movement and zoom
Helehex
Helehex4w ago
rendering took a performance hit, but it can definitely be improved back to it's former glory
ziyu4huang
ziyu4huang4w ago
I found it broken in Ubuntu 24 , this is because the Window in sdl-binding will construct Surface , and it's forbidden in SDL2 / Ubuntu2 . I fix it by remove it . because dustbin use Render and not allow Surface bind to Window ++ b/src/render.mojo @@ -10,25 +10,25 @@ struct Renderer[lif: AnyLifetime[False].type]: var sdl: Reference[SDL, lif] var _renderer_ptr: Ptr[_Renderer] var window: Window[lif] - var surface: Surface[lif] + #var surface: Surface[lif] fn init(inout self, owned window: Window[lif], index: Int = -1, flags: UInt32 = RendererFlags.SDL_RENDERER_ACCELERATED) raises: self.sdl = window.sdl self._renderer_ptr = self.sdl[]._sdl.create_renderer(window._window_ptr, index, flags) self.window = window^ - self.surface = Surface(self.sdl[]) + #self.surface = window.surface fn init(inout self, owned surface: Surface[lif]) raises: self.sdl = surface.sdl self._renderer_ptr = self.sdl[]._sdl.create_software_renderer(surface._surface_ptr) self.window = Window(self.sdl[]) - self.surface = surface^ + #self.surface = window.surface fn moveinit(inout self, owned other: Self): self.sdl = other.sdl self._renderer_ptr = other._renderer_ptr self.window = other.window^ - self.surface = other.surface^ + #self.surface = other.surface Renderer could not be created! SDL_Error: Surface already associated with window. in Ubuntu 22 it works fine , it's seems Ubuntu 24 forbidden it .
Want results from more Discord servers?
Add your server