ziyu4huang
ziyu4huang
MModular
Created by Helehex on 8/21/2024 in #community-showcase
Dustbin
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 .
69 replies
MModular
Created by Helehex on 8/21/2024 in #community-showcase
Dustbin
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
69 replies
MModular
Created by Egod on 9/12/2023 in #questions
cmd args parse
Really, there is no benefit to write simple glue code in Mojo. It wil be painful and useless .
11 replies
MModular
Created by Egod on 9/12/2023 in #questions
cmd args parse
I will do whole things in Python to handle args in python only. Simply. in main.mojo fn main(): let args_dict = Python.import_module("my_app").parse() ... do things in mojo. in my_pp.py: def parse(): parser = argparse.ArgumentParser(): parser.add_argument(...) # do the easy things in Python.
11 replies
MModular
Created by Osama-Logic on 9/11/2023 in #questions
How to build windows exe ?
run GUI? , I think just use mojo->Python. Develop full stack to replace Python is not the main goal for now . IMO.
40 replies