Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/realityforge/zifnab
Endless Sky Content Editing Tools
https://github.com/realityforge/zifnab
Last synced: 3 months ago
JSON representation
Endless Sky Content Editing Tools
- Host: GitHub
- URL: https://github.com/realityforge/zifnab
- Owner: realityforge
- License: apache-2.0
- Archived: true
- Created: 2019-08-06T10:31:07.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-29T12:01:30.000Z (almost 5 years ago)
- Last Synced: 2024-06-23T11:39:50.343Z (5 months ago)
- Language: Java
- Homepage:
- Size: 433 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-endless-sky - zifnab - A java library for reading and writing ES datafiles. (Libraries)
README
# zifnab: Endless Sky Content Editing Tools
[](https://search.maven.org/search?q=g:org.realityforge.zifnab%20a:zifnab-core)
## What is zifnab?
Zifnab is a simple library for manipulating and generating content for the [Endless Sky](http://endless-sky.github.io/) game.
### Getting Started
The library is released to Maven Central and can be downloaded using normal dependency download mechanisms.
The Maven dependencies are:```xml
org.realityforge.zifnab
zifnab-hdf
0.05org.realityforge.zifnab
zifnab-core
0.05```
See the `examples/` directory for a few examples of the tools in use.
### Data File Format
The `zifnab.hdf` package contains tools for reading and writing the data file format used by `Endless Sky`. The
package is included in the `zifnab-hdf` artifact.#### Reading
Reading the file format is as simple as:
```java
final Path file = ...;
final DataFile dataFile = DataFile.read( file );
```The `DataFile` object has a reference to the in memory representation of the data format and it is reasonably
easy to traverse to extract information from the the file. i.e.```java
final long topLevelElements = dataFile.getDocument().getChildElements().size();
System.out.println( topLevelElements + " top-level elements found in file." );
```#### Writing
The current API for generating data in the correct format is low-level. A high-level API is expected to be available
in the future. The low-level API for constructing the data file looks like:```java
final DataDocument document = new DataDocument();
document.comment( "The humanitarian mission!" );
final DataElement element1 = document.element( "mission", "Drought Relief" );
element1.comment( "The name of the mission as presented to user" );
element1.element( "name", "Drought relief to " );
final DataElement offer = element1.element( "to", "offer" );
offer.element( "random", "<", "10" );final DataFile dataFile = new DataFile( Paths.get( "output.txt" ), document );
dataFile.write();
```And this would produce a file named `output.txt` that contains
```
# The humanitarian mission!
mission "Drought Relief"
# The name of the mission as presented to user
name "Drought relief to "
to offer
random < 10
```# Contributing
The project was released as open source so others could benefit from the project. We are thankful for any
contributions from the community. A [Code of Conduct](CODE_OF_CONDUCT.md) has been put in place and
a [Contributing](CONTRIBUTING.md) document is under development.# License
The project is licensed under [Apache License, Version 2.0](LICENSE).