Giter Club home page Giter Club logo

sdl2-vga-terminal's Introduction

SDL2 VGA Terminal

Codacy Badge codecov

Monolithic CI Note
Build status disabled
Build Status disabled
Linux (x64) Windows (x86, x64) macOS (x64) Analyzer
Build Status Build Status Build Status Build Status

SonarCloud

NOTE: Code Coverage is not yet computed

Bugs Code Smells Coverage Duplicated Lines (%) Lines of Code Maintainability Rating Quality Gate Status Reliability Rating Security Rating Technical Debt Vulnerabilities

Azure Pipelines

NOTE: unmaintained pipelines, it looks like something changed in azure pipelines, i don't have the interest to fix it at the moment. (replaced with simpler basic GitHub workflows instead, to do the CI build&testing&install, then release the pacakge)

there are 5 pipelines, 1 for each OS and one dedicated to "Analysis", plus 1 for matrix build.

  • The CI pipelines related to each OS are building and generating the artifacts.

    Only Linux is not runnig the tests due to missing video driver on CI.

    The test results are published in Azure Devops through ctest -T Test flag.

  • The Analysis pipeline is analyzing the code, generating coverage and publish to codecov and SonarCloud. it also performing a cpplint job and publish as artifact the result.

  • The Matrix pipeline is an overkill so it is just triggered manually when required. It is reflecting this table:

FLAGS\OS Windows Linux macos
Debug ✔️ ✔️ ✔️
Release ✔️ ✔️ ✔️
BUILD_SHARED_LIBS ✔️ ✔️ ✔️
WITH_SDL2_STATIC ✔️ only only
BUILD_TESTING ✔️ ✔️ ✔️
BUILD_EXAMPLES ✔️ ✔️ ✔️
BUILD_SNAPSHOT ✔️ ✔️ ✔️
TEST_DUMP_SNAPSHOT
ENABLE_CODE_COVERAGE 🚫 🚫 ✔️
  • code coverage available only with LLVM and GCC in cmake, on CI working only on macos
  • TEST_DUMP_SNAPSHOT is "forbidden" to test for the build as an helper flag only.

Linux Note

It is required to install sdl[x11] along side sdl package otherwise linking error. NOTE: it looks like not anymore true using vcpkg.json

SDL2-static switch

It has been disabled as it has been moved to a different triplet x64-windows-static and just makes it annoying to test for it as it requires to have also a VCPKG_TARGET_TRIPLET to be changed and so it should be used as a different job itself rather than a switch, even though the switch in CMAKE is required to link the proper SDL2::SDL2 or SDL2::SDL2-static.

At the moment the WITH_SDL2_STATIC option in CMAKE has been disabled.

Synopsis

It is just a VGA font terminal using SDL2.

the VGA fonts are related to vgabios project.

At the moment support only mode 3.

It should be on 16 colors in the classic way, but can support more thanks to SDL2.

It is just a matter of fonts and a terminal grid for displaying texts.

Requirements

  • SDL2

Compiling

These are the requirements to compile the project from source:

  • cmake 3.16
  • C++17
  • vcpkg for dependency management
  • gtest 1.10 for testing
  • SDL_Image for snapshot testing

Usage

SDL2 Video sub-system has to be initialized before using VgaTerminal class.

There are few examples too in examples folder.

Screenshot

This screenshot is also used in the snapshot test.

alt text

Testing

using GTest framework.

There is a technique, snapshot testing, to verify some expectation, due to some required raster image to compare with, there is a boolean option TEST_DUMP_SNAPSHOT, that will run the test suit for generating the expected result. It could be a little bit risky, but it is a way to have generated expected results for the test suite.

The test suite take advantages of the option and will be compiled accordingly based on "dumping" or "testing".

please note if you are dumping the snapshot, you have to copy back to the test/snapshot directory to make them usable.

The filename generated are based on the test that are running, ideally: [Test-suite.Test-name].png

Just as a convention.

Tui Terminal (Experimental)

This is just a show case and has not to be considered following the semantic versioning of the project, it implies things might change with no objective reason at all.

It might could be detached completely and be its own library using this one.

At the moment is really very basic, error-prone and not well designed neither.

There is an example too among the examples.

Screenshot

This is a TUI screenshot used in the snapshot test too.

alt text

Done with

  • VT-snake retro-gaming style snake in an emulated DOS Text Mode

Projects Idea to be done in the future

  • VT Tetris (retro-gaming style Tetris in an emulated DOS Text Mode)
  • VT Pong (retro-gaming style Pong in an emulated DOS Text Mode)

sdl2-vga-terminal's People

Contributors

codacy-badger avatar raffaello avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

feodorfitsner

sdl2-vga-terminal's Issues

fix appveyor cache

the vcpkg cache is not properly configured
and it is like not having it at all.

cursor speeds as predefined enum class values

to avoid to set up "extreme values" that either make no sense and could potentially generate performances issues for eg when very high speed, cannot be faster than the refresh rate i would suggest... so would be just pointless.. :)
same way on the other side, too slow just disable cursor_blinking..

actually cursor blinking functionality is missing i guess..


  • default ~500ms
  • slow ~ 750ms
  • fast ~ 250ms

follow up #127

BUILD_SHARED_LIBS flag use for choose to build SO lib

at the moment is building both static and shared.

static is the "base" the shared is on top of that.

static is c++ shared is doing "hacking" interop among C++/C. so basically has a C interface.

anyway..
that flag can just save to compile the shared_libs if not required. As the lib is intended to be used in the C++ version so static.

[azure pipelines] automatically attach artifact to releases

set up a CI that upload the artifacts (CPack)
from the CI build.

Or generate the release from the CI, with tags.

there will be conflicts with app-veyor.
so it should be choose one or the other.

  • create artifacts
  • set up the release in azure-pipelines
  • disable appveyor release (comment out)

more or less.

remove mutex

replace it with atomic ops.

explore ways to be non-blocking/lock-free code......

extend CI

build for linux and avoid run the test, just the build (compile).

for the test need a videodriver to run, and probably all the linux server on CI tools are headless.

cursor

  • cursor shapes
  • cursor frequency blink
  • detach cursors from fonts

design better a choice for cursors mixed among fonts and just only cursors one.

the rendering would be the same, but using a different datatype probably.

these 4 lines below should be promoted to a method and reused also in the timer ...

// TODO these 4 lines below should be promoted to a method and reused also in the timer routine
int icur = _curY * mode.tw + _curX;
{
std::lock_guard lck(_pGridMutex);
_pGrid[icur].rendered = false;
}


This issue was generated by todo based on a TODO comment in 96d3f72. It's been assigned to @Raffaello because they committed the code.

[azure-pipelines] sync github repo to azure-devops repo

it should be possible creating a side pipeline

to pull from github and push to the project repo in azure devops

the pull is for free as the pipeline is triggered
the push should just be no more than few lines.

please remember as well to pull/push tags
and branches... (or should just be only master?)

there is another one that should delete the merged branches
right, but this one is not triggered as not part of the "build"
so it would be potentially in a dirty state with delete branch still present on azure.
Those actually would be cleaned on the master CI, so as a post PR merge trigger, it would pull/push master branch and synch the remaining branches/tags.
(it might not always work, as are 2 different events and the synch could be triggered before the branch of the github PR is being deleted).

to be triggered always

the repo there should be just read only

consider to remove/improve appveyor

becuase is not run in parallel

and is very slow compare to azure pipelines.
1 job in appveyor is the same of the full CI of azure-pipelines

there are 8 jobs, 6 valid ones:

so roughly 6 times slower.


  • check cache is working
  • just keeping it for the master branch and releases with vcpkg updates each time, could be worthy having it as a fail-safe release CI too.
    on side of azure pipelines.

CI build matrix extension (Windows)

build with all the switches combinations:
ON/OFF

  • BUILD_SHARED_LIBS
  • WITH_SDL2_STATIC
  • BUILD_TESTING
  • BUILD_EXAMPLES
  • BUILD_SNAPSHOT
  • TEST_DUMP_SNAPSHOT (dependant on BUILD_SNAPSHOT
  • ENABLE_CODE_COVERAGE

CI related builds:

FLAGS\OS Windows Linux macos
BUILD_SHARED_LIBS ✔️ ✔️ ✔️
WITH_SDL2_STATIC ✔️ only only
BUILD_TESTING ✔️ ✔️ ✔️
BUILD_EXAMPLES ✔️ ✔️ ✔️
BUILD_SNAPSHOT ✔️ ✔️ ✔️
TEST_DUMP_SNAPSHOT
ENABLE_CODE_COVERAGE 🚫 🚫 ✔️
Debug ✔️ ✔️ ✔️
Release ✔️ ✔️ ✔️
  • code coverage available only with LLVM and GCC in cmake, on CI working only on macos
  • TEST_DUMP_SNAPSHOT is "forbidden" to test for the build as an helper flag only.

cursor functionality related tests

  • blinking
  • change blinking time
  • change shape
  • display, not display.

for the display, how to do it without snapshots?

the other can be done with events and ticks checking.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.