Skip to content

Instantly share code, notes, and snippets.

View CyberShadow's full-sized avatar

Vladimir Panteleev CyberShadow

View GitHub Profile
@CyberShadow
CyberShadow / hvalue.d
Created September 8, 2011 20:30
hvalue - show an integer constant from a C header file
// rm hvalue* ; wget --no-check-certificate https://raw.github.com/gist/1204580/hvalue.d ; dmd hvalue.d
import std.stdio, std.file, std.process, std.exception;
void cleanup()
{
try
foreach (fn; listDir("", "hvalue-test*"))
remove(fn);
catch {}
@CyberShadow
CyberShadow / namegen.d
Created November 24, 2011 01:51 — forked from bhelyer/namegen.d
module namegen;
import std.ascii;
import std.random;
import std.utf;
void main()
{
import std.stdio;
@CyberShadow
CyberShadow / namegen.d
Created November 24, 2011 01:51 — forked from bhelyer/namegen.d
void main()
{
import std.random, std.stdio, std.range, std.algorithm, std.string;
array(map!q{std.stdio.writeln(capitalize(array(map!q{cast(char)["aeiou", "bcdfghjklmnpqrstvwxyz"][a][std.random.uniform(0, $)]}([[1,0,1,1,0,1], [0,1,1,0,1,0]][std.random.uniform(0, $)][0..std.random.uniform(5, 7)])))), 42}(iota(12)));
}

Currently, we only only have SDL 1.2 support.

SDL 1.2 apparently does most rendering in software. This is fine for most of our use cases, except smooth resizing. Smooth resizing a large image in software is not fast enough for e.g. a fluid zoom animation. Smooth resizing is also useful at zoom levels <1 - nearest-neighbor-downscaled images are quite ugly, and realtime software downscaling, even at powers of two, is not feasable on older hardware at high resolutions. Other perks that 3D acceleration provides is rotation - equally slow in software, but fast in hardware.

All of these are not available when using only SDL.

@CyberShadow
CyberShadow / git-pullrequest.sh
Created February 22, 2012 16:21
Easy GitHub pull requests
#!/bin/bash
set -e
die() {
echo "$@" >&2 ; exit 1
}
BRANCH=$(git branch 2>/dev/null|grep -e ^* | tr -d \*\ )
test -n "$BRANCH" || die "No branch"
test $BRANCH != master || die "You should create a branch instead of working on master: git checkout -b my-awesome-contribution"
@echo off
:start
pause
Display.exe /rotate:0
pause
Display.exe /rotate:90
goto start
@CyberShadow
CyberShadow / common.d
Created March 25, 2012 11:05
XML escape research
module common;
import std.conv;
import xmlwriter;
__gshared:
enum M = 1000;
@CyberShadow
CyberShadow / .gitmodules
Created September 3, 2012 15:07
Word-wrap (rewrap) Markdown source
[submodule "ae"]
path = ae
url = https://github.com/CyberShadow/ae.git
module conemu_vistaswitcher_fixer;
import core.thread;
// http://github.com/CyberShadow/ae
import ae.sys.windows;
// http://dsource.org/projects/bindings/wiki/WindowsApi
import win32.windows;
@CyberShadow
CyberShadow / func.sh
Created March 8, 2013 14:47
Derelict conversion aids
#!/bin/bash
cat func.txt | sed --regexp-extended \
-e 's#extern DECLSPEC ##g' \
-e 's# \*#*#g' \
-e 's#const char#const(char)#g' \
-e 's#\(\s+#(#g' \
-e 's#\s+\)#)#g' \
-e 's#\(void\)#()#g' \
> func-edited.txt