Skip to content

Latest commit

 

History

History
180 lines (137 loc) · 5.59 KB

README.md

File metadata and controls

180 lines (137 loc) · 5.59 KB

#SimpleRL The C# library for writing RogueLike games

##API todo

##Examples All example projects use E?M? naming. Here E? - group and M? - project number in group.

E1 - BASE EXAMPLES

E1M1 - Hello world

image

You can control console window via static members of Util class:

Util.Title = "E1M1 - Hello world";
Util.Width = 80;
Util.Height = 25;
Util.CursorVisible = false;

For to control console's content you must use Util.Buffer:

Util.Buffer.Clear();
Util.Buffer.Write(0, 0, "Hello world");

This library uses buffering, so after Util.Buffer was filled you must call Util.Swap() method:

Util.Swap();

E1M2 - Simple events loop

image

For to events access you must use Events.NextEvent() method. Here simple events loop:

while (true)
{
	//process input events
	Event e = Events.GetNext(true);
	//...
	
	//update screen
	//...
}

The Event struct contains info about event kind and additional event data (cursor pos, key and etc).

//ESC key was released
if (e.Kind == EventKind.Key && !e.Key.Press && e.Key.Key == ConsoleKey.Escape)
    break;

E1M3 - Load canvas content

image

Console content can be easy saved or loaded via simple text format:

Canvas pic = Canvas.Load("screen.rl");
Util.Buffer.Copy(pic, 4, 1);

Here example and description of *.rl format:

15 12
###############
# #     # ##  #
# # # #      ##
#   # # ## ####
## ##    #    #
#   # ###### ##
## ##    @## ##
#     # # #   #
# ### # # # # #
# # ### # # # #
#     # #   # #
###############
888888888888888
8F8FFFFF8F88FF8
8F8F8F8FFFFFF88
8FFF8F8F88F8888
88F88FFFF8FFFF8
8FFF8F888888F88
88F88FFFFE88F88
8FFFFF8F8F8FFF8
8F888F8F8F8F8F8
8F8F888F8F8F8F8
8FFFFF8F8FFF8F8
888888888888888
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000

first line:
width height

[1, height + 1] lines:
symbols

[height + 2, 2 * height + 1] lines:
fore colors

[2 * height + 2, 3 * height + 1] lines:
back colors

E1M4 - Mouse painter

image

E1M5 - Working with config helper

image

E1M6 - Lines

image

E2 - GAME EXAMPLES

E2M1 - Simple maze game

image

E2M2 - Random maze game

image

E2M3 - Extended maze game

image

E2M4 - 3D Maze

image

E2M5 - FOV

image

E2M6 - Kobolds Cave

image

E3 - UI EXAMPLES

E3M1 - Simple UI with textboxes

image

E3M2 - Panel Example

image

E3M3 - Colored string

image

E3M4 - Menu

image

E4 - UTILS

E4M1 - Cellular cave generation

image