{"id":22080405,"url":"https://github.com/mohamedelbachir/tinyguisdl","last_synced_at":"2025-10-11T21:30:17.287Z","repository":{"id":155770694,"uuid":"514671385","full_name":"mohamedelbachir/TinyGuiSDL","owner":"mohamedelbachir","description":"My LightWeight GUI library made with SDL for Game and Application","archived":false,"fork":false,"pushed_at":"2023-01-01T04:35:42.000Z","size":214,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T22:51:12.569Z","etag":null,"topics":["cpp","gui","sdl","sdlgui","simpleui"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohamedelbachir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-16T19:47:58.000Z","updated_at":"2024-10-16T08:58:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"4030e19c-c1e9-4e68-a5e2-ed53fd07d3e7","html_url":"https://github.com/mohamedelbachir/TinyGuiSDL","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mohamedelbachir/TinyGuiSDL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedelbachir%2FTinyGuiSDL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedelbachir%2FTinyGuiSDL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedelbachir%2FTinyGuiSDL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedelbachir%2FTinyGuiSDL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohamedelbachir","download_url":"https://codeload.github.com/mohamedelbachir/TinyGuiSDL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedelbachir%2FTinyGuiSDL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008860,"owners_count":26084518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","gui","sdl","sdlgui","simpleui"],"created_at":"2024-11-30T23:14:01.336Z","updated_at":"2025-10-11T21:30:16.956Z","avatar_url":"https://github.com/mohamedelbachir.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple SDL GUI Library for Game and Application (in development)\n## You should need to have\nfirst of all you need this SDL_Version :\n\u003e[SDL2.0.16 or up](https://github.com/libsdl-org/SDL/releases/)\n\n\u003e[SDL_ttf 2.20.1 or up](https://github.com/libsdl-org/SDL_ttf/releases)\n\n\u003e[SDL_image 2.6.2 or up](https://github.com/libsdl-org/SDL_image/releases)\n\n## Sample example\n\u003efew inclusion\n```c++\n    #include\u003cSDL.h\u003e\n    //header for external font loading \n    #include\"../include/FontManager.h\"\n    \n    //header for any state declaration\n    #include\"../include/AppStateMachine.h\"\n\n    //header for bunch of gui (button,text,image,...)\n    #include\"../include/Widgets.h\"\n```\n\u003ecreate a state for the main Window\n\n```c++\n//state of the main Window\nclass MainState:public AppState{\nprivate:\n    UI_Button *btn;\npublic:\n    static std::string stateID;\n    MainState(Window *pWindow):AppState(pWindow){}\n\n    bool onEnter()override{\n        //initialization all stuff widget before to go displayed\n        btn=new UI_Button(referenceWindow-\u003egetRenderer(),\"ftexte\",\"hello!\",10,10);\n        btn-\u003eonClickAttachTo([\u0026](){\n            //when the button is pressed close the window!\n            referenceWindow-\u003equit();\n        });\n        return true;\n    }\n    bool onExit()override{\n        delete btn;\n        return true;\n    }\n\n    void update()override{\n        btn-\u003eupdate();\n    }\n    void render()override{\n        btn-\u003edraw(referenceWindow-\u003egetRenderer());\n    }\n\n    std::string getStateID()const override{\n        return stateID;\n    }\n};\nstd::string MainState::stateID=\"MAINSTATE\";\n```\n\u003edeclaration of mainWindow \nnotice that one window can have **one** or **more** state according to your choices\n\n```c++\n//main window to display widget\nclass MyWindow:public Window{\nprivate:\n    AppStateMachine *states;\npublic:\n    \n    MyWindow():Window(){}\n    \n    MyWindow(std::string pTitle,\n                    int  pX,\n                    int  pY,\n                    int  pW,\n                    int  pH,\n                    Uint32 pFlagsWindow=SDL_WINDOW_SHOWN):Window(pTitle,\n                                                                 pX,\n                                                                 pY,\n                                                                 pW,\n                                                                 pH,\n                                                                 pFlagsWindow){\n        states=new AppStateMachine();\n        states-\u003epushState(new MainState(this));\n    }\n    \n    void update()override{\n        states-\u003eupdate();\n    }\n    \n    //when the window is drawing\n    void draw()override{\n        SDL_SetRenderDrawColor(getRenderer(),255,255,255,255);\n        SDL_RenderClear(getRenderer());\n            states-\u003erender();\n        SDL_RenderPresent(getRenderer());\n    }\n\n    //when the window is cleaning\n    void clean()override{\n        Window::clean();\n        states-\u003eclear();\n        thefontManager::Instance()-\u003ecleanUp();\n    }\n};\n```\n\n\u003ethere is the **main** program\n\n```c++\nint main(int argc,char *argv[]){\n    //loading a font for displaying to the button\n    thefontManager::Instance()-\u003eload(\"font.ttf\",20,\"ftexte\");\n\n    //create a window\n    MyWindow wind(\"my Window\",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,640,480);\n    \n    while(wind.isRunning()){\n        wind.handleEvent();\n        wind.update();\n        wind.draw();\n    }\n    //clear window allocation and free up memory\n    wind.clean();\n    return 0;\n}\n```\n\n## The ouput\n\n![result](/screenshoots/sample.jpg)\n\nfeel free to commit :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohamedelbachir%2Ftinyguisdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmohamedelbachir%2Ftinyguisdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmohamedelbachir%2Ftinyguisdl/lists"}