Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
j4james committed Dec 8, 2024
0 parents commit 6962d09
Show file tree
Hide file tree
Showing 32 changed files with 3,279 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterFunction: true
BreakBeforeBraces: Custom
ColumnLimit: 0
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 2
- Regex: '^<.*'
Priority: 3
- Regex: '.*'
Priority: 1
IndentCaseLabels: true
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PointerAlignment: Left
SpaceAfterCStyleCast: true
SpacesBeforeTrailingComments: 2
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
tab_width = 8
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.cpp text
*.h text
*.txt text
*.md text
.* text
*.png filter=lfs diff=lfs merge=lfs -text
92 changes: 92 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Build and Release

on:
push:
tags:
- 'v[0-9]+.*'

permissions:
packages: read
contents: write

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest

outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

release_assets:
name: Release Assets
needs: create_release
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
cpp_compiler: [g++, cl]
include:
- os: windows-latest
cpp_compiler: cl
- os: ubuntu-latest
cpp_compiler: g++
exclude:
- os: windows-latest
cpp_compiler: g++
- os: ubuntu-latest
cpp_compiler: cl

steps:
- uses: actions/checkout@v3

- name: Set Reusable Strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}
- name: Build
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Upload Ubuntu Assets
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: vtnibbler
asset_path: ${{ steps.strings.outputs.build-output-dir }}/vtnibbler
asset_content_type: application/octet-stream

- name: Upload Windows Assets
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: vtnibbler.exe
asset_path: ${{ steps.strings.outputs.build-output-dir }}/Release/vtnibbler.exe
asset_content_type: application/octet-stream
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vs/
36 changes: 36 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.15)
project(vtnibbler)

set(
MAIN_FILES
"src/main.cpp"
"src/capabilities.cpp"
"src/coloring.cpp"
"src/engine.cpp"
"src/font.cpp"
"src/levels.cpp"
"src/options.cpp"
"src/os.cpp"
"src/screen.cpp"
"src/snake.cpp"
"src/status.cpp"
)

set(
DOC_FILES
"README.md"
"LICENSE.txt"
)

if(WIN32)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
endif()

add_executable(vtnibbler ${MAIN_FILES})

if(UNIX)
target_link_libraries(vtnibbler -lpthread)
endif()

set_target_properties(vtnibbler PROPERTIES CXX_STANDARD 20 CXX_STANDARD_REQUIRED On)
source_group("Doc Files" FILES ${DOC_FILES})
26 changes: 26 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
}
]
}
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 James Holderness

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
VT Nibbler
==========

![Screenshot](screenshot.png)

This is a clone of the 1980's [Nibbler] arcade game, designed to be played on
a DEC VT terminal. It requires at least a VT320 (or something of comparable
functionality), but a VT525 is best if you want color and sound effects.

You'll also need at least a 19200 baud connection to play at the default
frame rate. If you find the input is lagging, try selecting a slower speed
using the command line option `--speed 4` or `--speed 3`.

[Nibbler]: https://en.wikipedia.org/wiki/Nibbler_(video_game)


Controls
--------

Use the arrow keys to move, and `Q` to quit.


Download
--------

The latest binaries can be found on GitHub at the following url:

https://github.com/j4james/vtnibbler/releases/latest

For Linux download `vtnibbler`, and for Windows download `vtnibbler.exe`.


Build Instructions
------------------

If you want to build this yourself, you'll need [CMake] version 3.15 or later
and a C++ compiler supporting C++20 or later.

1. Download or clone the source:
`git clone https://github.com/j4james/vtnibbler.git`

2. Change into the build directory:
`cd vtnibbler/build`

3. Generate the build project:
`cmake -D CMAKE_BUILD_TYPE=Release ..`

4. Start the build:
`cmake --build . --config Release`

[CMake]: https://cmake.org/


Supported Terminals
-------------------

| Terminal | Color | Sound |
|--------------------|:-----:|:-----:|
| DEC VT320 | no | no |
| DEC VT330/340 | no | no |
| DEC VT382 | no | no |
| DEC VT420 | no | no |
| DEC VT510/520 | no | no |
| DEC VT525 | yes | yes |
| KoalaTerm | no | no |
| MLTerm | part | no |
| PowerTerm | no | no |
| Reflection Desktop | no | no |
| RLogin | yes | yes |
| VTStar | part | no |
| Windows Terminal | yes | yes |

You could also get by with a VT220 or VT240, but those terminals don't have
full-cell fonts, so the graphics will look a bit messed up.

Terminals with *part* color support will render the graphics in color, but
won't show palette animations and the different level color schemes.


License
-------

The VT Nibbler source code and binaries are released under the MIT License.
See the [LICENSE] file for full license details.

[LICENSE]: LICENSE.txt
2 changes: 2 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
3 changes: 3 additions & 0 deletions screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6962d09

Please sign in to comment.