Skip to content

Instantly share code, notes, and snippets.

View gregoryfmartin's full-sized avatar

gregoryfmartin gregoryfmartin

View GitHub Profile
@gregoryfmartin
gregoryfmartin / main.cpp
Last active November 12, 2022 23:33
Linux Colored Terminal String (24-bit)
#include <string>
#include <iostream>
#include <sstream>
#include <cstdint>
#include <tuple>
/*
* It's still not too obvious to me why this is the case, but when trying to use uint8_t here instead of uint16_t for the tuples,
* this resulted in the string not being colored. Changing this to uint16_t allowed the string to be colored successfully.
*/
@gregoryfmartin
gregoryfmartin / libzip-decompress-file.cpp
Created July 3, 2020 18:38
Demonstration of libzip and SFML to decompress and use a file in SFML
///////////////////////////////////////////////////////////////////////////////
//
// libzip-decompress-file.cpp
//
// Written by Gregory F Martin
//
//
// This source code is public domain. It references a Zip Archive which is
// not included in this Gist.
//
@gregoryfmartin
gregoryfmartin / libzip-openfile.c
Created February 24, 2020 16:03
libzip - Open a zip file
#include <stdio.h>
#include <zip.h>
int main () {
printf ("Attempting to open a ZIP file...\n");
int zfile_err = 0;
zip_t* zfile = zip_open ("./testarchive.zip", ZIP_CHECKCONS | ZIP_RDONLY, &zfile_err);
if (NULL == zfile) {
@gregoryfmartin
gregoryfmartin / SFMLNetAudioPlayground.cs
Last active March 24, 2021 14:37
SFML.NET - Playing Audio (Music/BGM) using WAV
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.System;
using SFML.Window;
using SFML.Graphics;
using SFML.Audio;
@gregoryfmartin
gregoryfmartin / SFMLNetGameCore.cs
Created February 21, 2020 13:29
SFML.NET - Game Core Basic Structure
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.System;
using SFML.Window;
using SFML.Graphics;
namespace SFMLNetGameCore {
@gregoryfmartin
gregoryfmartin / SFMLNetSpriteMoverPlayground.cs
Last active February 20, 2020 16:59
SFML.NET - Move an object in response to keyboard input
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Graphics;
using SFML.Window;
using SFML.System;
namespace SFMLNetSpriteMover {
@gregoryfmartin
gregoryfmartin / SFMLNetFontPlayground.cs
Last active February 20, 2020 17:02
SFML.NET - Draw Font
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Graphics;
using SFML.Window;
namespace SFMLNetFontPlayground {
static class SFMLNetFontPlayground {