Skip to content

Commit 6962d09

Browse files
committed
Initial release
0 parents  commit 6962d09

32 files changed

+3279
-0
lines changed

.clang-format

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Language: Cpp
2+
AccessModifierOffset: -4
3+
AlignAfterOpenBracket: DontAlign
4+
AllowShortCaseLabelsOnASingleLine: true
5+
AllowShortIfStatementsOnASingleLine: true
6+
AlwaysBreakTemplateDeclarations: Yes
7+
BraceWrapping:
8+
AfterFunction: true
9+
BreakBeforeBraces: Custom
10+
ColumnLimit: 0
11+
IncludeBlocks: Regroup
12+
IncludeCategories:
13+
- Regex: '^<.*\.h>'
14+
Priority: 2
15+
- Regex: '^<.*'
16+
Priority: 3
17+
- Regex: '.*'
18+
Priority: 1
19+
IndentCaseLabels: true
20+
IndentWidth: 4
21+
KeepEmptyLinesAtTheStartOfBlocks: false
22+
MaxEmptyLinesToKeep: 2
23+
NamespaceIndentation: All
24+
PointerAlignment: Left
25+
SpaceAfterCStyleCast: true
26+
SpacesBeforeTrailingComments: 2

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 4
7+
tab_width = 8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.gitattributes

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.cpp text
2+
*.h text
3+
*.txt text
4+
*.md text
5+
.* text
6+
*.png filter=lfs diff=lfs merge=lfs -text

.github/workflows/build.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.*'
7+
8+
permissions:
9+
packages: read
10+
contents: write
11+
12+
jobs:
13+
create_release:
14+
name: Create Release
15+
runs-on: ubuntu-latest
16+
17+
outputs:
18+
upload_url: ${{ steps.create_release.outputs.upload_url }}
19+
20+
steps:
21+
- name: Create Release
22+
id: create_release
23+
uses: actions/create-release@v1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
tag_name: ${{ github.ref }}
28+
release_name: Release ${{ github.ref }}
29+
draft: false
30+
prerelease: false
31+
32+
release_assets:
33+
name: Release Assets
34+
needs: create_release
35+
runs-on: ${{ matrix.os }}
36+
37+
strategy:
38+
matrix:
39+
os: [ubuntu-latest, windows-latest]
40+
build_type: [Release]
41+
cpp_compiler: [g++, cl]
42+
include:
43+
- os: windows-latest
44+
cpp_compiler: cl
45+
- os: ubuntu-latest
46+
cpp_compiler: g++
47+
exclude:
48+
- os: windows-latest
49+
cpp_compiler: g++
50+
- os: ubuntu-latest
51+
cpp_compiler: cl
52+
53+
steps:
54+
- uses: actions/checkout@v3
55+
56+
- name: Set Reusable Strings
57+
id: strings
58+
shell: bash
59+
run: |
60+
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
61+
62+
- name: Configure CMake
63+
run: >
64+
cmake -B ${{ steps.strings.outputs.build-output-dir }}
65+
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
66+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
67+
-S ${{ github.workspace }}
68+
69+
- name: Build
70+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
71+
72+
- name: Upload Ubuntu Assets
73+
if: ${{ matrix.os == 'ubuntu-latest' }}
74+
uses: actions/upload-release-asset@v1
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
with:
78+
upload_url: ${{ needs.create_release.outputs.upload_url }}
79+
asset_name: vtnibbler
80+
asset_path: ${{ steps.strings.outputs.build-output-dir }}/vtnibbler
81+
asset_content_type: application/octet-stream
82+
83+
- name: Upload Windows Assets
84+
if: ${{ matrix.os == 'windows-latest' }}
85+
uses: actions/upload-release-asset@v1
86+
env:
87+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
with:
89+
upload_url: ${{ needs.create_release.outputs.upload_url }}
90+
asset_name: vtnibbler.exe
91+
asset_path: ${{ steps.strings.outputs.build-output-dir }}/Release/vtnibbler.exe
92+
asset_content_type: application/octet-stream

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.vs/

CMakeLists.txt

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(vtnibbler)
3+
4+
set(
5+
MAIN_FILES
6+
"src/main.cpp"
7+
"src/capabilities.cpp"
8+
"src/coloring.cpp"
9+
"src/engine.cpp"
10+
"src/font.cpp"
11+
"src/levels.cpp"
12+
"src/options.cpp"
13+
"src/os.cpp"
14+
"src/screen.cpp"
15+
"src/snake.cpp"
16+
"src/status.cpp"
17+
)
18+
19+
set(
20+
DOC_FILES
21+
"README.md"
22+
"LICENSE.txt"
23+
)
24+
25+
if(WIN32)
26+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
27+
endif()
28+
29+
add_executable(vtnibbler ${MAIN_FILES})
30+
31+
if(UNIX)
32+
target_link_libraries(vtnibbler -lpthread)
33+
endif()
34+
35+
set_target_properties(vtnibbler PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED On)
36+
source_group("Doc Files" FILES ${DOC_FILES})

CMakeSettings.json

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "x64-Debug",
5+
"generator": "Ninja",
6+
"configurationType": "Debug",
7+
"inheritEnvironments": [ "msvc_x64_x64" ],
8+
"buildRoot": "${projectDir}\\build\\${name}",
9+
"installRoot": "${projectDir}\\build\\install\\${name}",
10+
"cmakeCommandArgs": "",
11+
"buildCommandArgs": "",
12+
"ctestCommandArgs": ""
13+
},
14+
{
15+
"name": "x64-Release",
16+
"generator": "Ninja",
17+
"configurationType": "RelWithDebInfo",
18+
"inheritEnvironments": [ "msvc_x64_x64" ],
19+
"buildRoot": "${projectDir}\\build\\${name}",
20+
"installRoot": "${projectDir}\\build\\install\\${name}",
21+
"cmakeCommandArgs": "",
22+
"buildCommandArgs": "",
23+
"ctestCommandArgs": ""
24+
}
25+
]
26+
}

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2024 James Holderness
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
VT Nibbler
2+
==========
3+
4+
![Screenshot](screenshot.png)
5+
6+
This is a clone of the 1980's [Nibbler] arcade game, designed to be played on
7+
a DEC VT terminal. It requires at least a VT320 (or something of comparable
8+
functionality), but a VT525 is best if you want color and sound effects.
9+
10+
You'll also need at least a 19200 baud connection to play at the default
11+
frame rate. If you find the input is lagging, try selecting a slower speed
12+
using the command line option `--speed 4` or `--speed 3`.
13+
14+
[Nibbler]: https://en.wikipedia.org/wiki/Nibbler_(video_game)
15+
16+
17+
Controls
18+
--------
19+
20+
Use the arrow keys to move, and `Q` to quit.
21+
22+
23+
Download
24+
--------
25+
26+
The latest binaries can be found on GitHub at the following url:
27+
28+
https://github.com/j4james/vtnibbler/releases/latest
29+
30+
For Linux download `vtnibbler`, and for Windows download `vtnibbler.exe`.
31+
32+
33+
Build Instructions
34+
------------------
35+
36+
If you want to build this yourself, you'll need [CMake] version 3.15 or later
37+
and a C++ compiler supporting C++20 or later.
38+
39+
1. Download or clone the source:
40+
`git clone https://github.com/j4james/vtnibbler.git`
41+
42+
2. Change into the build directory:
43+
`cd vtnibbler/build`
44+
45+
3. Generate the build project:
46+
`cmake -D CMAKE_BUILD_TYPE=Release ..`
47+
48+
4. Start the build:
49+
`cmake --build . --config Release`
50+
51+
[CMake]: https://cmake.org/
52+
53+
54+
Supported Terminals
55+
-------------------
56+
57+
| Terminal | Color | Sound |
58+
|--------------------|:-----:|:-----:|
59+
| DEC VT320 | no | no |
60+
| DEC VT330/340 | no | no |
61+
| DEC VT382 | no | no |
62+
| DEC VT420 | no | no |
63+
| DEC VT510/520 | no | no |
64+
| DEC VT525 | yes | yes |
65+
| KoalaTerm | no | no |
66+
| MLTerm | part | no |
67+
| PowerTerm | no | no |
68+
| Reflection Desktop | no | no |
69+
| RLogin | yes | yes |
70+
| VTStar | part | no |
71+
| Windows Terminal | yes | yes |
72+
73+
You could also get by with a VT220 or VT240, but those terminals don't have
74+
full-cell fonts, so the graphics will look a bit messed up.
75+
76+
Terminals with *part* color support will render the graphics in color, but
77+
won't show palette animations and the different level color schemes.
78+
79+
80+
License
81+
-------
82+
83+
The VT Nibbler source code and binaries are released under the MIT License.
84+
See the [LICENSE] file for full license details.
85+
86+
[LICENSE]: LICENSE.txt

build/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

screenshot.png

+3
Loading

0 commit comments

Comments
 (0)