Add reference to ona-template in the readme
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e350d88793
commit
a63eefd7d4
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
.paths = .{
|
.paths = .{
|
||||||
"src",
|
"src",
|
||||||
|
"ext",
|
||||||
"build.zig",
|
"build.zig",
|
||||||
"build.zig.zon",
|
"build.zig.zon",
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
|
|
35
readme.md
35
readme.md
|
@ -55,40 +55,23 @@ Tests are ran by our continuous integration host so should these shouldn't fail
|
||||||
|
|
||||||
### Packaging
|
### Packaging
|
||||||
|
|
||||||
Since this is a Zig package it can be consumed via the Zig package manager using the usual steps.
|
**Note** that consuming Ona as a package requires it be downloaded manually, either through the releases page or by cloning, and referencing as a local dependency. This is due to the repository using Git submodules to reference third-party code.
|
||||||
|
|
||||||
(These steps have been adapted from [Andre Weissflog's tutorial for for setting up Sokol with Zig package manager](https://github.com/floooh/sokol-zig/blob/master/README.md).)
|
To reduce the amount of setup work, a [project template is provided](https://sauce.pizzawednes.day/kayomn/ona-template) that will open a window and show the default texture on the middle of the screen. If you decide to use this project, the steps below can be skipped.
|
||||||
|
|
||||||
1. Create a new Zig project if you have not already.
|
2. Create a new Zig project if you have not already.
|
||||||
2. Create a `build.zig.zon` accompanying your `build.zig` if you do not already have one.
|
3. Create a `build.zig.zon` accompanying your `build.zig` if you do not already have one.
|
||||||
3. Your `build.zig.zon` should, at minimum, contain the following dependency listed in the dependencies section:
|
4. Your `build.zig.zon` should, at minimum, contain the following dependency listed in the dependencies section:
|
||||||
|
|
||||||
```zig
|
```zig
|
||||||
.{
|
.{
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.ona = .{
|
.ona = .{ .path = "path/to/ona/repo" },
|
||||||
.url = "git+https://sauce.pizzawednes.day/kayomn/ona.git#[commit-hash]",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Make sure the `[commit-hash]` is a recent commit that will work with your version of the Zig compiler and, when in doubt, choose the latest `master` commit.
|
5. Add a package declaration for Ona to your `build.zig` and add the relevant modules to your application.
|
||||||
|
|
||||||
5. Run `zig build` and add the content hash it outputs in your terminal to your dependencies:
|
|
||||||
|
|
||||||
```zig
|
|
||||||
.{
|
|
||||||
.dependencies = .{
|
|
||||||
.ona = .{
|
|
||||||
.url = "git+https://sauce.pizzawednes.day/kayomn/ona.git#[commit-hash]",
|
|
||||||
.hash = "[content-hash]",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
6. Add a package declaration for Ona to your `build.zig` and add the relevant modules to your application.
|
|
||||||
|
|
||||||
```zig
|
```zig
|
||||||
const ona_dependency = b.dependency("ona", .{
|
const ona_dependency = b.dependency("ona", .{
|
||||||
|
@ -106,4 +89,8 @@ const app = b.addExecutable(.{
|
||||||
app.root_module.addImport("ona", ona_dependency.module("ona"));
|
app.root_module.addImport("ona", ona_dependency.module("ona"));
|
||||||
app.root_module.addImport("gfx", ona_dependency.module("gfx"));
|
app.root_module.addImport("gfx", ona_dependency.module("gfx"));
|
||||||
app.root_module.addImport("hid", ona_dependency.module("hid"));
|
app.root_module.addImport("hid", ona_dependency.module("hid"));
|
||||||
|
b.installArtifact(app);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
6. Create a `main.zig` containing a valid Ona app declaration.
|
||||||
|
7. Run `zig build` to build your new game application.
|
||||||
|
|
Loading…
Reference in New Issue