Skip to content

Instantly share code, notes, and snippets.

View RSDuck's full-sized avatar
🦢
stay cool!

RSDuck

🦢
stay cool!
  • Germany
View GitHub Profile
import bitops
proc min*[T](s: set[T]): T =
let internalSet = cast[ptr UncheckedArray[byte]](unsafeAddr s)
const sizeNotByteAligned = ord(high(T)) - ord(low(T)) != 7
block done:
var i = 0
when sizeof(set[T]) >= 8:
var remaining = sizeof(set[T])
@RSDuck
RSDuck / deko3d_notes.md
Last active April 12, 2024 22:48
deko3d Notes

So you want to use deko3d for maximum speed and minimum bloat?

Great!

deko3d is fantastic, working on the same layer of abstraction or even lower than Vulkan, but (even without the C++ wrapper) you tend to only need half as much code to do the same thing.

I've used it for a while now and kind of done the same thing wrong one too many times, so here's a list of those things.

Some things listed here are also documented in the primer while others are not documented there.

# Blender v2.79 (sub 0) OBJ File: ''
# www.blender.org
mtllib ico.mtl
o Icosphere
v 0.000000 -1.000000 0.000000
v 0.723607 -0.447220 0.525725
v -0.276388 -0.447220 0.850649
v -0.894426 -0.447216 0.000000
v -0.276388 -0.447220 -0.850649
v 0.723607 -0.447220 -0.525725
// Include the most common headers from the C standard library
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <stdint.h>
// Include the main libnx system header, for Switch development
#include <switch.h>
/*---------------------------------------------------------------------------------
Based upon https://github.com/devkitPro/nds-examples/tree/master/Graphics/Effects/windows
A very simple window demo which displays a square window
---------------------------------------------------------------------------------*/
#include <nds.h>
#include "drunkenlogo.h"
@RSDuck
RSDuck / entity.nim
Created May 22, 2019 18:23
ECS in Nim
#[
Copyright (c) 2019 RSDuck/Kemal Afzal
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:
The above copyright notice and this permission notice shall be included in all copies or
@RSDuck
RSDuck / vlong.nim
Last active October 25, 2017 21:31
Vlong
import
../../felis/core/[context, engine, entity, systems, assetmanager], ../../felis/scene/transform2d,
../../felis/gfx/[sprite, texture], ../../felis/input/input, ../../felis/helper/box,
glm
type
PaddleController {.pure.} = enum
Player0, Player1, Cpu
Paddle = object
@RSDuck
RSDuck / thing.hx
Last active October 25, 2017 02:23
anonymous structure completion
static var reFieldPart = ~/(\.|@(:?))(\w*)$/;
static function calculateCompletionPosition(text:String, index:Int):CompletionPosition {
if (reFieldPart.match(text))
return {
pos: index - reFieldPart.matched(3).length,
toplevel: false,
};
var bracketLevel = 0;
var i = index;
#based of this: https://github.com/yglukhov/sound
#[
The MIT License (MIT)
Copyright (c) 2015 Yuriy Glukhov
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
@RSDuck
RSDuck / event.nim
Last active May 26, 2017 19:39
Nim event system
import macros, tables, hashes, strutils, oids
type
VariantTypes* = enum
variInt, variFloat32, variString, variBool
Variant* = object
case variant: VariantTypes
of variInt: intVal: int
of variFloat32: float32Val: float32
of variString: stringVal: string