This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MIT License - Copyright (c) 2016 Can Güney Aksakalli | |
// https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html | |
// This version is slightly modified from the original source stated above, see comments for details. | |
using System; | |
using System.Collections.Generic; | |
using System.Net.Sockets; | |
using System.Net; | |
using System.IO; | |
using System.Threading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Form1() | |
{ | |
InitializeComponent(); | |
// set custom draw method | |
List_EventsLog.DrawMode = DrawMode.OwnerDrawVariable; | |
List_EventsLog.DrawItem += List_EventsLog_DrawItem; | |
} | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_link(title): | |
return "[" + title + "](#" + title.lower().replace(' ', '-') + ")" | |
print ("# Table Of Content") | |
with open("README.md", 'r') as infile: | |
for line in infile: | |
line = line.strip() | |
if line.startswith('## '): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Utility to serialize data directly into a buffer. | |
/// </summary> | |
public class MessageSerializer | |
{ | |
// the buffer containing the data. | |
private byte[] _buffer; | |
/// <summary> | |
/// Get the buffer itself that contains the data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// String-related utils. | |
/// </summary> | |
public static class StringUtils | |
{ | |
/// <summary> | |
/// Convert string to bytes[]. | |
/// </summary> | |
/// <param name="str">String to convert.</param> | |
/// <returns>String as bytes[].</returns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// possible characters for the random strings generation | |
static string _charsForRandomness = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | |
/// <summary> | |
/// Generate a random string at a given length. | |
/// </summary> | |
public static string GenerateRandomString(int length = 8) | |
{ | |
// generate random characters | |
var stringChars = new char[length]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member | |
/// <summary> | |
/// Colors enum, can be packed in 4 bits. | |
/// </summary> | |
public enum ColorsEnum | |
{ | |
White, | |
Red, | |
Green, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
using Microsoft.Xna.Framework.Content.Pipeline; | |
using Microsoft.Xna.Framework.Content.Pipeline.Processors; | |
using Microsoft.Xna.Framework.Graphics; | |
using Microsoft.Xna.Framework.Audio; | |
using MonoGame.Framework.Content.Pipeline.Builder; | |
using System.Reflection; | |
using System.IO; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generate a random level with rooms | |
// mapSize = level size {x, y} | |
// maxRooms = max number of rooms to generate (number). note: under some conditions the result will have less rooms than max rooms, for example if we run out of places to place rooms in. | |
// minRoomSize = min room size (number). | |
// maxRoomSize = max room size (number). | |
// base on the concepts found here: https://medium.com/@victorcatalintorac/dungeon-with-rooms-algorithm-for-javascript-ultimate-begginer-guide-ec1489e90314 | |
// author: Ronen Ness. | |
// feel free to use this for any purpose. | |
// NOTE: made for a project on http://5mbg.com/. | |
function generateLevel(mapSize, maxRooms, minRoomSize, maxRoomSize) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// general defs | |
const LEVEL_WIDTH = 40; // playable region width | |
const LEVEL_HEIGHT = 20; // playable region height | |
const SCALE = 4; // scale factor for rendering | |
const SCREEN_WIDTH = LEVEL_WIDTH * SCALE; // screen width | |
const SCREEN_HEIGHT = LEVEL_HEIGHT * SCALE; // screen height | |
// set engine init flags | |
initFlags.gfx.crispRendering = true; // make rendering pixelated / crisp | |
initFlags.gfx.fixedResolutionX = SCREEN_WIDTH; // lock x resolution |
NewerOlder