Skip to content

Commit 03e7d12

Browse files
committed
RK -> BL. Complete-ish docs.
1 parent 24ae476 commit 03e7d12

File tree

5 files changed

+222
-76
lines changed

5 files changed

+222
-76
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
/.build
33
/Packages
44
/*.xcodeproj
5+
docs/
6+
build/
7+
Binaries/

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.PHONY: docs
2+
3+
docs:
4+
jazzy \
5+
-o docs \
6+
--clean \
7+
--no-skip-undocumented \
8+
--sdk macosx \
9+
--xcodebuild-arguments -project,BearLibTerminal.xcodeproj,-target,BearLibTerminal \
10+
--author "Steve Johnson" \
11+
--author_url "http://steveasleep.com" \
12+
--module-version 1.0.0 \
13+
--copyright "2018 Steve Johnson" \
14+
--root-url "http://steveasleep.com/BearLibTerminal-Swift" \
15+
--github_url "https://github.com/irskep/BearLibTerminal-Swift"

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,55 @@
22

33
Swifty bindings for [BearLibTerminal](http://foo.wyrd.name/en:bearlibterminal).
44

5-
This repo is compatible with the Swift package manager.
5+
This repo is compatible with the Swift package manager. It has not yet been tested
6+
with Carthage or Cocoapods.
67

78
```swift
8-
let terminal = RKTerminal.main
9+
let terminal = BLTerminal.main
910
terminal.open()
10-
terminal.print(point: RKPoint(x: 0, y: 0), string: "[color=red]Hi![/color]")
11+
terminal.print(point: BLPoint(x: 0, y: 0), string: "[color=red]Hi![/color]")
1112
terminal.waitForExit()
1213
terminal.close()
1314
```
1415

15-
The code is very short. Please read `Sources/BearLibTerminal` to get a sense
16-
of the interface and data types.
16+
## Setup
17+
18+
You need to add a new dependency to your `Package.swift`:
19+
20+
```
21+
// swift-tools-version:4.0
22+
23+
import PackageDescription
24+
25+
let package = Package(
26+
name: "My Game",
27+
dependencies: [
28+
.package(url: "https://github.com/irskep/BearLibTerminal-Swift.git", from: "1.0.1"),
29+
],
30+
targets: [
31+
.target(
32+
name: "My Game",
33+
dependencies: ["BearLibTerminal"]),
34+
35+
]
36+
)
37+
```
38+
39+
You **also** need to link against the BearLibTerminal shared library! On OS X,
40+
that's `libBearLibTerminal.dylib` ([download](http://foo.wyrd.name/_media/en:bearlibterminal:bearlibterminal_0.15.7_osx.zip)).
41+
See [the BearLibTerminal site](http://foo.wyrd.name/en:bearlibterminal) for more links.
42+
43+
## Why it's better than using the C bridge directly
44+
45+
The C library plays fast and loose with signedness of ints. You need to convert an `Int8`
46+
to a `UInt8` pretty regularly, and it can be hard to remember where and how to do this.
47+
48+
Also, If you code against the interface, you can write tests for your code without showing
49+
a GUI.
50+
51+
## Docs
52+
53+
If you're reading this from GitHub, please [visit the full documentation.](http://steveasleep.com/BearLibTerminal-Swift)
1754

1855
If you would like more documentation, please open a GitHub issue so
19-
I know someone cares!
56+
I know someone cares!

Sources/BearLibTerminal/BearLibTerminal+constants.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// BearLibTerminal+constants.swift
3-
// RLSandbox
3+
// BearLibTerminal-Swift
44
//
55
// Created by Steve Johnson on 1/5/18.
66
// Copyright © 2018 Steve Johnson. All rights reserved.
@@ -9,7 +9,12 @@
99
import CBearLibTerminal
1010

1111

12-
public struct RKConstant {
12+
/**
13+
All constants exposed by BearLibTerminal. See
14+
[the original documentation](http://foo.wyrd.name/en:bearlibterminal:reference)
15+
for details about each one.
16+
*/
17+
public struct BLConstant {
1318
// Keyboard scancodes for events/states.
1419
public static let A = TK_A
1520
public static let B = TK_B

0 commit comments

Comments
 (0)