Skip to content

Instantly share code, notes, and snippets.

View fowlmouth's full-sized avatar
🦃

Tim E fowlmouth

🦃
  • United States of America
View GitHub Profile
import json
import fowltek/tmaybe, fowltek/vector_math
type
TRecordID = int
TDataSet* = object ## acts as a counter for the IDs, after data is read, can be used to validate IDs
itemCount, projectileCount, vehicleCount: int
items: seq[PItemRecord]
projectils: seq[int] #pprojectilerecord
vehicles: seq[PVehicleRecord]
Single-shot
AR 606 - like
mines, rockets, grenades
multi-shot
Shotguns
pulsar
Healing
stim-packs, energizer
team heal
proc foo(): int =
return(if true: 1
else: 0 )
echo foo()
import fowltek/pointer_arithm
proc get_shiterator[T] (some: var seq[T]; idx: TSlice[int]): tuple[start,fin: ptr T] =
(some[idx.a].addr, some[idx.b].addr)
var x = @[1,2,3,4,3,2,1]
var (start,fin) = x.get_shiterator(1..5)
while start <= fin:
@fowlmouth
fowlmouth / ncurses.nim
Created July 1, 2013 22:19
NCurses wrapper
#***************************************************************************
# Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
# *
# 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, distribute with modifications, 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: *
@fowlmouth
fowlmouth / pic.png
Last active December 26, 2015 08:59
verlet physics
pic.png
type
TEither[L,R] = object
case which: bool
of true: left: L
else: right: R
var x : TEither[string,int]
x.right = 42
x.repr.echo
# https://fedorahosted.org/newt/
# http://gnewt.sourceforge.net/index_en.html
when defined(LINUX):
const DLL_NAME = "libnewt.so"
else:
{.error: "Newt is not set up for your operating system.".}
const
NEWT_COLORSET_ROOT* = 2
import fowltek/parsetools/g_parse, fowltek/parsetools/g_lex
import strutils
const
tkCascade = tkComma
tkKeyword = tkUser1
tkBlockStart = tkBracketOpen
tkBlockEnd = tkBracketClose
{.emit: """
struct Foo {
union {
int x;
float y;
};
} Foo;
""".}
type TFoo {.importc: "struct Foo".} = object