Skip to content

Instantly share code, notes, and snippets.

View DavidLudwig's full-sized avatar

David Ludwig DavidLudwig

View GitHub Profile
@DavidLudwig
DavidLudwig / log_sdl_clocs.sh
Last active May 13, 2016 17:26
SDL2 backend(s), line-counts (via 'cloc')
#!/bin/bash
SRC="$1"
if [ "$SRC" == "" ]; then
SRC="src/video"
fi
HG_REV="$(hg summary | grep parent | awk '{print $2}')"
HG_REV_DATE="$(hg log -r $HG_REV | grep date | perl -pne 's/^[^:]*:\W*//')"
HG_CHANGESET="$(echo $HG_REV | perl -pne 's/.*://')"
HG_URL="https://hg.libsdl.org/SDL/rev/$HG_CHANGESET"
[Info][00:00:00.0004760] AppSession: Starting Xamarin Inspector client
[Error][00:00:03.0925560] AgentSessionWindowController: Unable to open workbook: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: There is an error in XML document (0, 0). ---> System.Xml.XmlException: Root element is missing.
at System.Xml.XmlTextReaderImpl.Throw (System.Exception e) <0x11dd41a40 + 0x000b1> in <filename unknown>:0
at System.Xml.XmlTextReaderImpl.ThrowWithoutLineInfo (System.String res) <0x11dd413f0 + 0x0008b> in <filename unknown>:0
at System.Xml.XmlTextReaderImpl.ParseDocumentContent () <0x11cbebb80 + 0x006db> in <filename unknown>:0
at System.Xml.XmlTextReaderImpl.Read () <0x11cbe05f0 + 0x0007c> in <filename unknown>:0
at System.Xml.XmlTextReader.Read () <0x11cbe05d0 + 0x0001a> in <filename unknown>:0
at System.Xml.XmlReader.MoveToContent () <0x11cbe0480 + 0x00084> in <filename unknown>:0
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationRe
#include <boost/utility/string_ref.hpp>
#include <stdio.h>
void process(boost::string_ref part) {
printf("process(\"%s\")\n", part.to_string().c_str());
}
void split(boost::string_ref s, const char delim) {
size_t p;
@DavidLudwig
DavidLudwig / SDLBugCount.sh
Last active August 29, 2015 14:22
SDL 2.0.4 bug tracker for OS X or KDE
#!/bin/bash
#
# SDL 2.0.4 Bug-"Count" Checker for Mac OS X or KDE
# Version 1.6
#
# Requirements:
# - any one of the following command-line notification tools:
# - Growl and growlnotify, for Mac OS X, available at http://growl.info
# - kdialog, for KDE
# - notify-send, for generic Linux notifications
@DavidLudwig
DavidLudwig / sdl2gles2gears.c
Last active November 15, 2022 09:45
GLGears for SDL2 + OpenGL ES 2
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
extern SDL_Renderer * _renderer;
static SDL_bool UI_SaveScreenshotBMP(const char * fileName)
{
int w = 0;
int h = 0;
SDL_GetWindowSize(_window, &w, &h);
const int bytesPerPixel = 4;
const int pitch = w * bytesPerPixel;