{"id":20780901,"url":"https://github.com/x4e/fps","last_synced_at":"2025-04-30T20:34:24.000Z","repository":{"id":138137279,"uuid":"278483674","full_name":"x4e/fps","owner":"x4e","description":null,"archived":false,"fork":false,"pushed_at":"2020-10-10T17:46:48.000Z","size":437,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T20:33:50.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/x4e.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":"2020-07-09T22:27:26.000Z","updated_at":"2024-06-06T12:50:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"79ef5e59-17ab-4498-911d-000f8221c541","html_url":"https://github.com/x4e/fps","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/x4e%2Ffps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x4e%2Ffps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x4e%2Ffps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x4e%2Ffps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x4e","download_url":"https://codeload.github.com/x4e/fps/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251777896,"owners_count":21642242,"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-11-17T13:40:02.508Z","updated_at":"2025-04-30T20:34:23.995Z","avatar_url":"https://github.com/x4e.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lwjgl stuff\n\nJust learning lwjgl!\n\n## Stuff this project has\n\n#### Font Renderer\nBitmap font renderer that supports variably spaced fonts\n\n![Font rendering example](https://i.binclub.dev/kcmecrjw.png)\n\nHow it works:\n1. Alpha channel only of bitmap texture is loaded into memory\n2. Once vao for every character in the bitmap is created, containing two triangles and\ntexture coordinates of the characters position on the bitmap\n\n#### Cool vao/vbo abstractions\n```kotlin\nval posBuf = positions.buffer()\nval texBuf = textures.buffer()\nval idxBuf = indices.buffer()\n\nvao.use {\n    posVbo.use {\n        posVbo.bindData(posBuf)\n        glEnableVertexAttribArray(0)\n        posVbo.bindToVao(0, 3, GL_FLOAT)\n    }\n    \n    texVbo.use {\n        texVbo.bindData(texBuf)\n        glEnableVertexAttribArray(1)\n        texVbo.bindToVao(1, 2, GL_FLOAT)\n    }\n    \n    idxVbo.use {\n        idxVbo.bindData(idxBuf)\n    }\n}\n\nmemFree(posBuf, texBuf, idxBuf)\n\n// draw\n\nvao.use {\n    idxVbo.use {\n        texture?.bind()\n        glDrawElements(GL_TRIANGLES, numVertices, GL_UNSIGNED_INT, 0)\n        texture?.unbind()\n    }\n}\n```\n\n#### A modular entity system (Inspired by [EntityX](https://github.com/alecthomas/entityx)):\n```kotlin\nobject LocalPlayerEntity: Entity() {\n\tinit {\n\t\tinjectComponent(PositionedEntity())\n\t\tinjectComponent(CameraComponent)\n\t\tinjectComponent(ControllableEntity())\n\t}\n}\n\nshader.use {\n    shader[\"projectionMatrix\"] = ProjectionHandler.projection\n    shader[\"texture_sampler\"] = 0\n    \n    // Loop through each entity that has a mesh\n    // Entities with multiple mesh components will be iterated for each mesh they have\n    Client.world.entities.each { entity: Entity, meshed: MeshedEntity -\u003e\n        entity.component { positioned: PositionedEntity -\u003e\n            val matrix = ProjectionHandler.getModelMatrix(positioned, viewMatrix)\n            shader[\"worldMatrix\"] = matrix\n        } `else` {\n            shader[\"worldMatrix\"] = Mat4.identity\n        }\n        meshed.mesh.draw()\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx4e%2Ffps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx4e%2Ffps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx4e%2Ffps/lists"}