GithubHelp home page GithubHelp logo

dostoy's Introduction

dostoy

A silly interactive retro terminal library for the HTML5 canvas
Make a fake DOS prompt or draw some ASCII/ANSI art.

Live: http://www.toolsley.com/dos.html

Prerequisites

A font

Google "fntcol16.zip"
One-by-one these fonts are in the public-domain.
Or you can use the one supplied with the demos

A canvas

Make an HTML page with a canvas

Usage

Shell Mode

Prompt, cursor, input, command interpreter

	dostoy.init({
		font: window.atob("your font in base64"), // or Uint8Array with font data
		fontHeight: 14, // or appropriate for font
		canvas: document.getElementById("your-canvas-id"),
		shell:true,
		beforeShell: function() {
			dostoy.println("Some welcome message");
		},
		prompt: "C:\\>",
		commandHandler : function(command) {
			switch(command) {
				case "ver":
					dostoy.println("Fake Dos 1.0");
				break;
				default:
					dostoy.println("Bad command or filename");
			}
		}
	});

Manual Mode

Manual output with manual input

	dostoy.init({
		font: window.atob("your font in base64"), // or Uint8Array with font data
		fontHeight: 14, // or appropriate for font
		canvas: document.getElementById("your-canvas-id"),
		shell:false
	});
	dostoy.println("Hello World");
	dostoy.input("Your name?", function(name) {
		dostoy.println("Hello to you too, "+name);
	});

Reference

print(text)
println(text)
input(prompt,function(input))
inkey(function(keyCode))
locate(col,row)
chr(charcodes) - this also prints. charcodes can be a single ascii code or a comma separated list
cls()
setCursor(true/false)
setPrompt(text)
setShell(true,false)
color(bg,fg) - see color code table at http://en.wikibooks.org/wiki/QBasic/Text_Output#Color_by_Number)
getCols()
getRows()

Etc

License: MIT

Known issues: Grossly incomplete input handler among other things

There's a tremendous amount of room for improvement but as a toy and simple demo it provides enough mild entertainment as-is. Might be useful for April Fools pages or similar.

Pull requests are welcome if you make something more involved with it and improve on it in the process.

dostoy's People

Contributors

toolsley avatar

Stargazers

mohamad hani janaty avatar bianxianyang avatar Alarm avatar su avatar Nathan avatar  avatar  avatar Franky Kohn avatar  avatar Abdurrahman Aydın avatar Matt Fry avatar bre avatar Sherman avatar Austin Shapiro avatar Henry avatar  avatar Pablo Damian Cotoia avatar Exciting Books avatar M Haidar Hanif avatar Daniel Rubin avatar Kyle L. McGregor avatar Bartosz Ptaszynski avatar Bishoy Hanna avatar Ben Sparks avatar Robert Qualls avatar Michael Anthony avatar Austin Mullins avatar Brett Camper avatar Martin Blasko avatar  avatar tmdotorg avatar  avatar Greg Babula avatar Luja avatar Henry Allen-Tilford avatar Jan Werder avatar Kenneth J Davis avatar Ilya avatar Huy Nguyen Quang avatar  avatar Sasindu Mendis avatar Silveira Neto avatar Miëtek Bak avatar Joe avatar Rod Montgomery avatar Rifaqat Shah avatar Tom Carlson avatar Tom Mombourquette avatar  avatar Sam Y avatar Nick Vissari avatar Curious Gecko avatar  avatar 5r!t3x avatar Fernando Bevilacqua avatar Joohun, Maeng avatar Luke McCarthy avatar Shaun W. avatar evandrix avatar Diogo Souza da Silva avatar Chee Aun avatar Jason Kotchoff avatar Matt McInnis (he/him) avatar Sam Twining avatar Carlos Paramio avatar Wesley Hill avatar Harald Lapp avatar  avatar Favi_ty avatar Austin Storm avatar Islam Magdy avatar Jan Roudaut avatar Stelios Petrakis avatar Dave avatar  avatar Carlos Moran avatar Fernando Lucio Canizo avatar Viktor Vasilev avatar Matthew Mckenzie avatar Rene Kriest avatar David avatar Zakaria avatar Aaron Buchanan avatar  avatar

Watchers

7rans avatar evandrix avatar James Cloos avatar  avatar Michael Anthony avatar Kyle Rota avatar  avatar  avatar

dostoy's Issues

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.