Skip to content

Commit b8e833e

Browse files
authored
Add macOS/Linux files to release & make background color tunable (#115)
1 parent 91e117f commit b8e833e

File tree

6 files changed

+84
-35
lines changed

6 files changed

+84
-35
lines changed

.github/workflows/workflow.yml

+40
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,27 @@ jobs:
2929
- uses: actions/checkout@v2
3030
- run: DOCKER_BUILDKIT=1 docker build -o=./bin/ --target=voidstar . --progress=plain
3131
- run: ./bin/voidstar --help
32+
- uses: actions/upload-artifact@v2
33+
with:
34+
name: voidstar_gcc_ubuntu
35+
path: ./bin/voidstar
3236
- uses: Wandalen/[email protected]
3337
with:
3438
command: DOCKER_BUILDKIT=1 docker build -o=. --target=video-gcc . --progress=plain
3539
attempt_limit: 20
3640
attempt_delay: 1000
41+
- run: mv ./bin/voidstar voidstar_gcc_ubuntu
42+
- run: mv ./video.webm voidstar_gcc_ubuntu.webm
43+
- uses: actions/upload-artifact@v2
44+
with:
45+
name: video-gcc_ubuntu
46+
path: ./voidstar_gcc_ubuntu.webm
47+
- uses: softprops/action-gh-release@v1
48+
if: startsWith(github.ref, 'refs/tags/')
49+
with:
50+
files: |
51+
voidstar_gcc_ubuntu
52+
voidstar_gcc_ubuntu.webm
3753
3854
build_on_ubuntu_with_clang:
3955
name: Build on ubuntu with Clang
@@ -46,11 +62,27 @@ jobs:
4662
- uses: actions/checkout@v2
4763
- run: DOCKER_BUILDKIT=1 docker build -o=./bin/ --target=voidstar-clang . --progress=plain
4864
- run: ./bin/voidstar --help
65+
- uses: actions/upload-artifact@v2
66+
with:
67+
name: voidstar_clang_ubuntu
68+
path: ./bin/voidstar
4969
- uses: Wandalen/[email protected]
5070
with:
5171
command: DOCKER_BUILDKIT=1 docker build -o=. --target=video-clang . --progress=plain
5272
attempt_limit: 20
5373
attempt_delay: 1000
74+
- run: mv ./bin/voidstar voidstar_clang_ubuntu
75+
- run: mv ./video.webm voidstar_clang_ubuntu.webm
76+
- uses: actions/upload-artifact@v2
77+
with:
78+
name: video-clang_ubuntu
79+
path: ./voidstar_clang_ubuntu.webm
80+
- uses: softprops/action-gh-release@v1
81+
if: startsWith(github.ref, 'refs/tags/')
82+
with:
83+
files: |
84+
voidstar_clang_ubuntu
85+
voidstar_clang_ubuntu.webm
5486
5587
build_on_macos:
5688
name: Build on macos
@@ -62,6 +94,14 @@ jobs:
6294
- uses: actions/checkout@v2
6395
- run: bazelisk build voidstar
6496
- run: ./bazel-bin/voidstar/voidstar --help
97+
- uses: actions/upload-artifact@v2
98+
with:
99+
name: voidstar_macos-latest
100+
path: ./bazel-bin/voidstar/voidstar
101+
- uses: softprops/action-gh-release@v1
102+
if: startsWith(github.ref, 'refs/tags/')
103+
with:
104+
files: ./bazel-bin/voidstar/voidstar
65105

66106
# build_on_windows: FIXME
67107
# name: Build on windows

README.md

+23-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# VoidStar [![Snap Status](https://build.snapcraft.io/badge/fenollp/voidstar.svg)](https://build.snapcraft.io/user/fenollp/voidstar) [Coverity](https://scan.coverity.com/projects/fenollp-voidstar?tab=overview)
1+
# void*
22

33
Browse data using Corti's 2D projector as well as 3D variants.
44

@@ -27,8 +27,7 @@ The actual file being represented below [is data/BigPictureBG.tga](http://www.do
2727
## Usage
2828

2929
```shell
30-
bazel build voidstar
31-
./bazel-bin/voidstar/voidstar --move bazel-bin/voidstar/voidstar data/*
30+
voidstar --move bazel-bin/voidstar/voidstar data/*
3231
```
3332

3433
```
@@ -63,49 +62,47 @@ Usage:
6362
# Use > to slide faster, < to slow down
6463
# SPACE to toggle spinning the shape
6564
# Press O to reset the camera position
65+
# Use B to change background color
6666
# ESC to quit
6767
6868
```
6969

7070
## Installing
7171

72-
### docker
73-
74-
Known to work with
75-
* ubuntu 18.10 + docker 18.09.0
76-
77-
```
78-
docker build -f Dockerfile.dev -t voiddev .
79-
mv your/interesting/files/* data/
80-
./docker-dev.sh
81-
```
82-
8372
### on MacOS
8473

85-
1. Download one of the `osx` files of [the latest release](https://github.com/fenollp/voidstar/releases/latest)
86-
1. Open Terminal.app (you can search for it in Spotlight)
74+
1. Download one of the `macos` files of [the latest release](https://github.com/fenollp/voidstar/releases/latest)
75+
1. Open `Terminal.app` (you can search for it in Spotlight)
8776
1. Type `chmod u+x ` then drag and drop the file you downloaded then press ENTER (now this file can be executed)
8877
1. Now drag and drop your executable then drag a file you want to look at (e.g. `data/dragon.vox`) then press ENTER
78+
* your Terminal command should look like `/Users/you/Downloads/voidstar some_file.xyz`
8979
1. A window should appear. Move your mouse and play with your keyboard's arrows. You should see some colored dots in 3D.
9080

91-
### on any Linux distribution
81+
### Windows
9282

93-
`snap install voidstar`
83+
https://github.com/fenollp/voidstar/issues/2
9484

95-
This relies on [snaps](https://snapcraft.io/docs/core/install).
85+
### with Docker
9686

87+
```shell
88+
DOCKER_BUILDKIT=1 docker build -o=/usr/local/bin https://github.com/voidstarHQ/voidstar.git
89+
```
9790

98-
## Requirements
91+
### on any Linux distribution
9992

100-
* A C++ compiler
101-
* `bazel` that you can use through [bazelisk](https://github.com/bazelbuild/bazelisk)
93+
```shell
94+
snap install voidstar
95+
```
10296

103-
### Windows
97+
This relies on [snaps](https://snapcraft.io/docs/core/install).
10498

105-
https://github.com/fenollp/voidstar/issues/2
10699

107-
### Debian
100+
## Hacking
108101

109102
```shell
110-
sudo apt-get install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev xorg-dev
103+
bazel build voidstar
104+
./bazel-bin/voidstar/voidstar --move bazel-bin/voidstar/voidstar data/*
111105
```
106+
107+
* A C++ compiler
108+
* `bazel` that you can use through [bazelisk](https://github.com/bazelbuild/bazelisk)

resolved.bzl

+5-5
Original file line numberDiff line numberDiff line change
@@ -385,14 +385,14 @@ resolved = [
385385
"rule_class": "@bazel_upgradable//:rule.bzl%upgradable_repository",
386386
"attributes": {
387387
"urls": [
388-
"https://github.com/bazelbuild/rules_cc/archive/f84656686987ce254481cc33efa3b6645d4254c3.tar.gz",
389-
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/f84656686987ce254481cc33efa3b6645d4254c3.tar.gz",
388+
"https://github.com/bazelbuild/rules_cc/archive/426f72132372dfbd3a904d283662faba71bdf393.tar.gz",
389+
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/426f72132372dfbd3a904d283662faba71bdf393.tar.gz",
390390
],
391-
"sha256": "a30681f34021a77638b07abcea132d0057aa16d81e76444b4c454c29ae59fac0",
391+
"sha256": "e7df2dc809915dda2b5a6d79ed0b9e673af94b7920399ef40ae183623bbff49d",
392392
"netrc": "",
393393
"auth_patterns": {},
394394
"canonical_id": "",
395-
"strip_prefix": "rules_cc-f84656686987ce254481cc33efa3b6645d4254c3",
395+
"strip_prefix": "rules_cc-426f72132372dfbd3a904d283662faba71bdf393",
396396
"type": "tar.gz",
397397
"patches": [],
398398
"patch_tool": "",
@@ -409,7 +409,7 @@ resolved = [
409409
"tag": "",
410410
"name": "rules_cc",
411411
},
412-
"output_tree_hash": "400ca6f1331142b6c9922db519cf33d899f9f0c2acd262ac4585d444bf1d0adb",
412+
"output_tree_hash": "bdb911a032f66a3a03b5095825cbb14c6ae41346dc684c910b723556fa8db695",
413413
},
414414
],
415415
},

snap/snapcraft.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: voidstar
2-
version: v1.35.0 # FIXME: 'git'
2+
version: v1.36.0 # FIXME: 'git'
33
summary: void* casts files onto 2D/3D colored spaces for your mind blowing needs # 79 char long summary
44
description: |
55
Usage:

voidstar/arguments.cc

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ static void usage(const char* prgname __unused) {
3939
# Use > to slide faster, < to slow down
4040
# SPACE to toggle spinning the shape
4141
# Press O to reset the camera position
42+
# Use B to change background color
4243
# ESC to quit
4344
4445
)";

voidstar/managers/glfw3.cc

+14-3
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,23 @@ void GLFW3Manager::run() {
251251
glfwSetCursorPos(window_, viewport_width_ / 2, viewport_height_ / 2);
252252
}
253253

254+
static constexpr float bgColors[][3] = {
255+
{0, 0, 0}, // black
256+
{1, 0, 0}, // R
257+
{0, 1, 0}, // G
258+
{0, 0, 1}, // B
259+
{0.2f, 0.3f, 0.3f}, // gray
260+
{1, 1, 1}, // white
261+
};
262+
size_t bgi = 0;
263+
254264
double lastTime = glfwGetTime();
255265
while (!glfwWindowShouldClose(window_)) {
256266
// process pending events
257267
events_->update();
258268

259269
// Clear the colorbuffer
260-
glClearColor(0, 0, 0, 1);
261-
// glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
270+
glClearColor(bgColors[bgi][0], bgColors[bgi][1], bgColors[bgi][2], 1);
262271
if (is3D) {
263272
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
264273
} else {
@@ -290,10 +299,12 @@ void GLFW3Manager::run() {
290299
if (is3D)
291300
glfwSetCursorPos(window_, viewport_width_ / 2, viewport_height_ / 2);
292301
if (events_->keyPressed(GLFW_KEY_ESCAPE))
293-
glfwSetWindowShouldClose(window_, GL_TRUE);
302+
glfwSetWindowShouldClose(window_, GLFW_TRUE);
294303
if (events_->keyPressed('F')) ToggleFullscreen();
295304
if (events_->keyPressed('H')) loadPrevFile();
296305
if (events_->keyPressed('L')) loadNextFile();
306+
if (events_->keyPressed('B'))
307+
bgi = (bgi + 1) % (sizeof(bgColors) / sizeof(bgColors[0]));
297308
if (!args_->move_window && args_->exit_at_fin)
298309
glfwSetWindowShouldClose(window_, GLFW_TRUE);
299310
}

0 commit comments

Comments
 (0)