•  


GitHub - Thraka/SadConsole: A .NET ascii/ansi console engine written in C# for MonoGame and XNA. Create your own text roguelike (or other) games!
Skip to content

A .NET ascii/ansi console engine written in C# for MonoGame and XNA. Create your own text roguelike (or other) games!

License

Notifications You must be signed in to change notification settings

Thraka/SadConsole

Repository files navigation

SadConsole Logo

Chat on discord NuGet

SadConsole is a C#-based .NET cross-platform terminal, ascii, console, game engine. It simulates these types of programs and with it you can make ascii-styled games for modern platforms. At its heart, SadConsole is really a giant tile-based game engine. However, its object model is conceptually similar to a traditional console app.

While SadConsole is a generic library that doesn't provide any rendering capabilities, "host" libraries are provided that add renderers to SadConsole. The two hosts provided by this library are for SadConsole.Host.MonoGame and SadConsole.Host.SFML . When adding a host library to your project, you don't need to reference the base SadConsole package. If you use MonoGame, you'll also need to add a rendering NuGet package, such as MonoGame.Framework.DesktopGL .

SadConsole currently targets .NET 6, .NET 7, and .NET 8

For the latest changes in this release, see the notes below

Features

Here are some of the features SadConsole supports:

  • Show any number of consoles of any size.
  • Uses graphical tile-based images to build out an ASCII-character font with support for more than 256 characters.
  • Fonts are simply sprite sheet tilesets tied to ascii codes, you can use full graphical tiles if you want.
  • Use more than one font file. However, each console is restricted to a single font.
  • Full GUI system for interactive controls such as list boxes, buttons, and text fields.
  • Importers for DOS ANSI files , TheDraw text fonts , RexPaint , and Playscii .
  • Animated consoles and instruction system to chain commands together.
  • String encoding system for colors and effects while printing.
  • Entity support for drawing thousands of movable objects on the screen
  • Translating images to text-blocks.
  • Keyboard and mouse support.
  • Highly customizable framework.

String display and parsing

string pic

GUI library

GUI library pic

Scrolling

scrolling console

Example startup code

using
 Console 
=
 SadConsole
.
Console
;

using
 SadConsole
;

using
 SadConsole
.
Configuration
;

using
 SadRogue
.
Primitives
;


Settings
.
WindowTitle 
=
 "
SadConsole Examples
"
;


// Configure how SadConsole starts up

Builder
 startup
 =
 new
 Builder
(
)

    .
SetScreenSize
(
90
,
 30
)

    .
UseDefaultConsole
(
)

    .
OnStart
(
Game_Started
)

    .
IsStartingScreenFocused
(
true
)

    .
ConfigureFonts
(
true
)

    ;


// Setup the engine and start the game

Game
.
Create
(
startup
)
;

Game
.
Instance
.
Run
(
)
;

Game
.
Instance
.
Dispose
(
)
;


void
 Game_Started
(
object
?
 sender
,
 GameHost
 host
)

{

    ColoredGlyph
 boxBorder
 =
 new
(
Color
.
White
,
 Color
.
Black
,
 178
)
;

    ColoredGlyph
 boxFill
 =
 new
(
Color
.
White
,
 Color
.
Black
)
;


    Game
.
Instance
.
StartingConsole
.
FillWithRandomGarbage
(
255
)
;

    Game
.
Instance
.
StartingConsole
.
DrawBox
(
new
 Rectangle
(
2
,
 2
,
 26
,
 5
)
,
 ShapeParameters
.
CreateFilled
(
boxBorder
,
 boxFill
)
)
;

    Game
.
Instance
.
StartingConsole
.
Print
(
4
,
 4
,
 "
Welcome to SadConsole!
"
)
;

}
Imports
 SadConsole

Imports
 Console
 =
 SadConsole.Console

Imports
 SadConsole.Configuration

Imports
 SadRogue.Primitives


Module
 Module1


    Sub
 Main()


        Dim
 startup
 As
 New
 Builder()


        ' Configure how SadConsole starts up

        startup.SetScreenSize(
90
,
 30
)

        startup.UseDefaultConsole()

        startup.OnStart(
AddressOf
 Game_Started)

        startup.IsStartingScreenFocused(
True
)

        startup.ConfigureFonts(
True
)


        ' Setup the engine and start the game

        SadConsole.Game.Create(startup)

        SadConsole.Game.Instance.Run()

        SadConsole.Game.Instance.Dispose()


    End
 Sub


    Sub
 Game_Started(sender
 As
 Object
,
 host
 As
 GameHost)


        Dim
 boxBorder
 =
 New
 ColoredGlyph(Color.White,
 Color.Black,
 178
)

        Dim
 boxFill
 =
 New
 ColoredGlyph(Color.White,
 Color.Black)


        Game.Instance.StartingConsole.FillWithRandomGarbage(
255
)

        Game.Instance.StartingConsole.DrawBox(
New
 Rectangle(
2
,
 2
,
 26
,
 5
),
 ShapeParameters.CreateFilled(boxBorder,
 boxFill))

        Game.Instance.StartingConsole.Print(
4
,
 4
,
 "Welcome to SadConsole!"
)


    End
 Sub


End
 Module

Latest changes

v10.4.0 (03/31/2024)

New versioning system. Versions for SadConsole will be in the following format: [all libs major].[all libs minor].[individual lib revision]

When patches come out for the indvidual libraries, the X in 10.0.X would increment. These would be like host updates, or the extended library, but not public facing changes in SadConsole itself. If SadConsole itself updates, the X in 10.X.0 would increment. All libraries would increment with SadConsole, and the individual lib revisions would reset to 0. The X on X.0.0 would indicate a major change to SadConsole with most likely a lot of bigger breaking changes.

That said, SadConsole is resetting all versions to v10.4.0 for this release. From now on, the new versioning system is in place.

  • [Breaking] A minor breaking change. If you were creating your own IConfigurator startup configs, the Run method's parameter changed from Game to GameHost .

  • [Core] Added Components.Overlay which displays a surface on top of an existing console/surface object as a top layer.

  • [Core] Bug: Font.OnFontChanged wasn't actually being called. It is now.

  • [Core] Added Coroutine NuGet library. This is included now with SadConsole.

  • [Core] Added CoroutineHandlerComponent which is a manager that you can add to an object and coroutines to.

  • [Core] Cursor.PrintCoroutine which prints as a coroutine, pausing at each character.

  • [Core] Instructions.DrawString updated to use Cursor.PrintCoroutine which lets it pretty print word breaks.

  • [Core] XML docs didn't genereate correctly for the last build.

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본