{"id":17979022,"url":"https://github.com/lykhonis/terramach","last_synced_at":"2025-07-05T17:32:33.882Z","repository":{"id":141702326,"uuid":"234229854","full_name":"lykhonis/terramach","owner":"lykhonis","description":"Terra Mach is a mapping frontend system to build graphical interfaces for devices.","archived":false,"fork":false,"pushed_at":"2020-08-08T15:44:36.000Z","size":4267,"stargazers_count":163,"open_issues_count":5,"forks_count":8,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-13T11:56:25.543Z","etag":null,"topics":["gui","mapbox","mapbox-gl","rust","skia","ui"],"latest_commit_sha":null,"homepage":"https://terramach.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lykhonis.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":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-16T03:47:57.000Z","updated_at":"2025-04-29T09:05:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f158e60-e101-4a6a-b704-e8bef724adc3","html_url":"https://github.com/lykhonis/terramach","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lykhonis/terramach","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2Fterramach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2Fterramach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2Fterramach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2Fterramach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykhonis","download_url":"https://codeload.github.com/lykhonis/terramach/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2Fterramach/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263778557,"owners_count":23510016,"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":["gui","mapbox","mapbox-gl","rust","skia","ui"],"created_at":"2024-10-29T17:35:58.471Z","updated_at":"2025-07-05T17:32:33.867Z","avatar_url":"https://github.com/lykhonis.png","language":"Rust","readme":"# Terra Mach\n\nTerra Mach is a mapping frontend system to build graphical interfaces for devices.\n\nThis project focuses on experiences around statistical data (graphs, diagrams), mapping, \nand user input. When it comes to user experience, elements a user interacts with are flexible enough to build \nmost of common experiences.\n\nThe project is in active development. Most of the APIs are stable, though some breaking changes are still possible.\n\nThis project is highly inspired by [Flutter](https://flutter.dev). Terra Mach is written in a systems programming language [Rust](https://www.rust-lang.org). \nIt leverages graphics library [Skia](https://skia.org) to enable high performant 2D graphics.\n\n# How to Use\n\nTerra Mach crate is located in [terramach](/terramach) folder. To use it checkout Terra Mach to your workspace and link \nit locally by supplying a path.\n\n```shell script\ngit clone https://github.com/lykhonis/terramach.git\ncd MyProject\n```\n\nAdd dependency in `Cargo.toml`.\n\n```toml\n[dependencies.terramach]\npath = \"../terramach/terramach\"\n```\n\n## Examples\n\nTerra Mach comes with some prebuilt examples of what can be built with it.\n\n### Dashboard\n\n![Dashboard Preview](/docs/assets/dashboard.gif)\n\nA dashboard sample app inspired by [Dark Version](https://dribbble.com/shots/3530048-Dark-Version) design. \nThe dashboard integrates [Mapbox](https://www.mapbox.com) to access maps. The integration module is located in \n[third-party crate](/third-party/mapbox).\n\nTry example by running in command line:\n```shell script\ncd examples/dashboard\ncargo run --release\n```\n\nThis may take awhile for initial build, so don't hesitate to grab some :coffee:.\n\nIn order to access maps, you would need to supply Mapbox access token in [Settings.toml](/examples/dashboard/Settings.toml).\nRegister and get Mapbox access token by signing up [here](https://account.mapbox.com/auth/signup).\n\n```shell script\ncd examples/dashboard\ntouch Settings.toml\n```\nand insert following content:\n```toml\n[mapbox]\naccess-token = \"ACCESS_TOKEN_GOES_HERE\"\ncache-path = \"/tmp/mapbox.cache.db\"\n```\n\n## Build a Widget\n\nTerraMach GUI is a composition of widgets and/or direct painting. For example, a Decoration widget\npaints background color but also manages its child widget.\n\nA simple example of a counter app. On a tap, the counter is increased and UI is updated to reflect the change.\n\n1. Define a widget and its state (state is optional)\n```rust\n#[derive(Default, Clone, PartialEq, PartialWidget)]\nstruct Counter {}\n\n#[derive(Default)]\nstruct CounterState {\n    counter: usize,\n}\n```\n\n2. Implement a counter widget\n```rust\nimpl Widget for Counter {\n    // prepare state for the counter\n    fn mount(\u0026self, context: \u0026mut WidgetContext, mount: \u0026mut MountContext) {\n        context.set_state(CounterState::default());\n    }\n    \n    // build a counter widget with tap gesture and white background\n    fn build(\u0026self, context: \u0026mut WidgetContext, build: \u0026mut BuildContext) {\n        let state = context.state::\u003cCounterState\u003e().unwrap();\n        build.add_child(\n            Gesture::new(\n                0,\n                build.event_emitter(),\n                TapGesture::default(),\n                None,\n                Decoration::new(\n                    Color::WHITE,\n                    None,\n                    Align::new(\n                        Alignment::center(),\n                        Text::new_text(format!(\"Counter {}\", state.counter).as_str()),\n                    ),\n                ),\n            ),\n        );\n    }\n    \n    // handle a single tap\n    fn event(\u0026self, context: \u0026mut WidgetContext, event: \u0026mut EventContext) {\n        if let Event::Tap(_) = event.get() {\n            let state = context.state_mut::\u003cCounterState\u003e().unwrap();\n            state.counter += 1;\n            event.mark_need_build();\n        }\n    }\n}\n```\n\n3. Start the app\n```rust\nfn main() {\n    App::new((1020, 640))\n        .with_title(\"Counter\")\n        .run(Counter::default());\n}\n```\n\n## Supported Platforms\n\nIn order:\n\n| Platform | Status      |\n| -------- | ----------- |\n| Mac OS   | Supported   |\n| Android  | Partial     |\n| Linux    | Planned     |\n| Windows  | Planned     |\n| iOS      | Planned     |\n| Web      | Considered  |\n\n# License\n\nThis software is available publicly via GPLv3 license which can be found [here](/LICENSE). \nFor any other request please [contact me](mailto:vladimirlichonos@gmail.com).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykhonis%2Fterramach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykhonis%2Fterramach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykhonis%2Fterramach/lists"}