ollelogdahl / ConsoleGameEngine

.NET Console Graphics Engine
The Unlicense
354 stars 45 forks source link
console console-framework console-graphics consoleengine draw game-loop graphics graphics-library hacktoberfest unlicense

ConsoleGameEngine

C# Graphics Library for drawing graphics in Windows Command Prompt

Olle Logdahl, 24 November 2018

downloads release licence issues


ConsoleGameEngine is a C# library that wraps around the System.Console class, adding enhanced functionality for displaying graphics. Implements a new ConsoleGame abstract, a custom buffer, custom color palette, fullscreen capabilites, input handling and more.

Installation / Getting Started


After installing you'll have to:

  1. Import ConsoleGameEngine.dll to project.
  2. Reference the namespace using ConsoleGameEngine;

Why?

I created this Library to make graphics more available for beginners and hobbyists alike. The first programs you create are usually made in the console, but when users want to migrate to actual graphics there is a steep learning curve. My ambition with this library is to depricate the need for psuedo-graphics in the console, usually done by moving the cursor, writing a short string and clearing the actual screen. Not only is that solution unintuitive in the long run, but also highly inefficient.

Uses

Does the last apply to you? Then sorry, this is not the library you are looking for.

Usage / Features

Library contains two main classes, ConsoleEngine and ConsoleGame

ConsoleEngine

Is used to draw to the screen, replacement for the System.Console class (kind of)

using ConsoleGameEngine;
...
Engine = new ConsoleEngine(windowWidth, windowHeight, fontWidth, fontHeight);

Engine.SetPixel(new Point(8, 8), ConsoleCharacter.Full, 15);

ConsoleGame

Keeps an instance of the ConsoleEngine and implements game loops.

Note Not neccessary, you could use the ConsoleEngine as is

using ConsoleGameEngine;
...

new AppName.Construct(windowWidth, windowHeight, fontWidth, fontHeight, FramerateMode.Unlimited);
class AppName : ConsoleGame {
  public override void Create() {
  }

  public override void Update() {
  }

  public override void Render() {
  }
}
Try out some example games over here

Notes

Links

Licensing

This project, and all code it contains, is licensed under The Unlicense and can be read here.