{"id":13805309,"url":"https://github.com/mohamedLT/V_sokol_gp","last_synced_at":"2025-05-13T19:30:42.935Z","repository":{"id":147883405,"uuid":"538889197","full_name":"mohamedLT/V_sokol_gp","owner":"mohamedLT","description":"a V wrapper for the sokol_gp library ","archived":false,"fork":false,"pushed_at":"2022-09-20T10:06:32.000Z","size":29,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-18T21:47:11.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mohamedLT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-20T08:40:58.000Z","updated_at":"2023-08-22T18:08:18.000Z","dependencies_parsed_at":"2023-05-27T19:30:27.531Z","dependency_job_id":null,"html_url":"https://github.com/mohamedLT/V_sokol_gp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedLT%2FV_sokol_gp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedLT%2FV_sokol_gp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedLT%2FV_sokol_gp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mohamedLT%2FV_sokol_gp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mohamedLT","download_url":"https://codeload.github.com/mohamedLT/V_sokol_gp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254012967,"owners_count":21999345,"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","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":[],"created_at":"2024-08-04T01:00:59.858Z","updated_at":"2025-05-13T19:30:42.646Z","avatar_url":"https://github.com/mohamedLT.png","language":"C","funding_links":[],"categories":["Libraries"],"sub_categories":["Graphics"],"readme":"# V_sokol_gp\na V wrapper for the sokol_gp library \n\n# Sokol_gp\nSokol_gp is a 2d rendering library for Sokol that has many optimations to it like batch rendering plus it is super easy to use and setup \n# install\n`v install mohamedLT.sokolgp`\n# supported platforms \nbasically, it runs where Sokol runs \nfor android you can use vab \n# Example :\n```\nimport gg\nimport sokol\nimport sokol.sapp\nimport mohamedlt.sokolgp \nimport sokol.gfx\nimport math \n\n\nfn frame(s voidptr) {\n    width := sapp.width() \n    height := sapp.height()\n    ratio := width/f32(height)\n\n    sokolgp.begin(width, height)\n    sokolgp.viewport(0, 0, width, height)\n    sokolgp.project(-ratio, ratio, 1.0, -1.0)\n\n    sokolgp.set_color(0.1, 0.1, 0.1, 1.0)\n    sokolgp.clear()\n\n    time := f32(sapp.frame_count() * sapp.frame_duration())\n    r := math.sinf(time)*0.5+0.5\n    g := math.cosf(time)*0.5+0.5\n    sokolgp.set_color(r, g, 0.3, 1.0)\n    sokolgp.rotate_at(time, 0.0, 0.0)\n    sokolgp.draw_filled_rect(-0.5, -0.5, 1.0, 1.0)\n\n    pass_action := gfx.PassAction{}\n    gfx.begin_default_pass(\u0026pass_action, width, height)\n    sokolgp.flush()\n    sokolgp.end()\n    gfx.end_pass()\n    gfx.commit()\n}\n\nfn init(s voidptr) {\n    sgdesc := sapp.create_desc() \n    gfx.setup(\u0026sgdesc)\n    if !gfx.is_valid() {\n        println(\"Failed to create Sokol GFX context!\\n\")\n        exit(-1)\n    }\n\n    sgpdesc := sokolgp.Desc{}\n    sokolgp.setup(\u0026sgpdesc)\n    if !sokolgp.is_valid() {\n        println(\"Failed to create Sokol GP context:  ${sokolgp.get_error_message(sokolgp.get_last_error())}\\n\")\n        exit(-1)\n    }\n}\n\n\n\nstruct App {\nmut:\n\tgg          \u0026gg.Context = unsafe { nil }\n}\n\n[console]\nfn main() {\n\tmut app := \u0026App{\n\t\tgg: 0\n\t}\n\n\tapp.gg = gg.new_context(\n\t\twidth: 600\n\t\theight: 600\n\t\tuser_data: app\n\t\tcreate_window: true\n\t\twindow_title: '3D Cube Demo'\n\t\tframe_fn: frame\n\t\tinit_fn: init\n\t)\n\n\tapp.gg.run()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmohamedLT%2FV_sokol_gp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FmohamedLT%2FV_sokol_gp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmohamedLT%2FV_sokol_gp/lists"}