Hi everyone. I’ve been using C for mostly everything for the last 6 7 years. I’m no C expert but I believe I’m pretty good with it.

I’m trying to build an application and C does not have many choices. The best is raygui but it’s too barebones. I had to implement so much from scratch and it kinda ruins the point.

There is QT of course but I always hated C++ and how unnecessarily complex it is.

Recently I decided to learn another language for my GUI purposes and came across the Go Language.

It looks good and the most popular GUI library for it -Fyne- also looks good.

My question is, is this a good combo for building GUI’s coming from C? Do you guys have any recommendations?

Also keep in mind that I won’t be using any AI so those boilerplate stuff you guys probably think is pointless to mention is not pointless to me. I would appreciate it.

  • Kajika@lemmy.ml
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    1
    ·
    9 hours ago

    I am building myself a truly efficient GUI framework in C++ (not C though) as even Qt is a no-go to me as it is very hard to work with in a clean manner (no Qt editor or other vendor lock).

    I can’t find anything that really crafted for efficient/not-bloated GUI : not running dumbly at 60 FPS while nothing needs to be redraw and not being in 20 years old immediate mode OpenGL (very inefficient).

    I touched this subject no so long ago with a post about a 6 years-old GLFW bug on wayland -> https://lemmy.ml/post/54916148 . This makes me think that we are very few on hearth who cares/knows about GUI outside HTML+CSS+chrome solutions.

    I think that making a C library (out of C++ for me) could bring something for many languages like Go, Python, etc. But I don’t have many hopes thus not really putting to much work on this as revenue is very limited, at least for me, so other projects must be put in priority.

    I am genuinely curious about what are the needs of others, as I don’t need cross-platform (Windows is way too much work) nor a lot of fancy widget most of time. Already having text, images, buttons, and inputs (text area) would be a pretty solid start. For the rest give me a opengl context and I can work with that.

    My library’s idea is to follow the habits of HTML+CSS (flex object, relative/absolute positioning, separated style options):

    int main()
    {
    	const auto app = uui::create_application(uui::Application::Implementation::OPENGL);
    	app->create_window(800, 600, "UUI sample", [](uui::Window& window) {
    		window.set_background_color({0.1f, 0.1f, 0.1f, 0.8f});
    		window.create_component({.x = 0, .y = 0, .width = 200, .height = 100}, [](uui::Component& component) {
    			component.set_background_color({1.0f, 0.f, 0.f, 0.5f});
    		});
    		window.create_label(
    			{.x = 0.5f, .y = 0.5f, .text = "Hello world!", .text_color = {0.8f, 0.8f, 0.8f, 1.0f}}, nullptr);
    		window.set_keyboard_callback([&](int key, int scancode, uui::KeyAction action, uui::KeyMod mods) {
    			std::cout << "keyboard callback key=" << key << ", scancode=" << scancode << ", action=" << action << ", mods=" << mods << "\n";
    			if(key == 256 && action == uui::KeyAction::PRESS)
    				window.close();
    		});
    	});
    	app->run();
    	return 0;
    }
    

    I guess it is not a today solution but if people are interested I wanted to share the idea (I could share the code too if some people are interested, I don’t want to publish half finished library).