Skip to content

Instantly share code, notes, and snippets.

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

RSDuck

🦢
stay cool!
  • Germany
View GitHub Profile
@RSDuck
RSDuck / render.c
Last active July 10, 2016 12:37
Rendering
#include <stdio.h>
#include <string.h>
#include <citro3d.h>
#include "render.h"
#include "world.h"
#include "player.h"
// When it's this way it flickers with 3D disabled
BufInfo_Init(bufInfo);
for (int i = 0; i < CHUNK_HEIGHT / CHUNK_CLUSTER_HEIGHT; i++)
if (c->data[i].vbo) BufInfo_Add(bufInfo, c->data[0].vbo, sizeof(world_vertex), 3, 0x210);
if (bufInfo->bufCount) C3D_DrawArrays(GPU_TRIANGLES, 0, c->vertexCount);
// But this way the flickering is gone
BufInfo_Init(bufInfo);
for (int i = 0; i < CHUNK_HEIGHT / CHUNK_CLUSTER_HEIGHT; i++) {
@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
#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 / 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;
@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 / 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
/*---------------------------------------------------------------------------------
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"
// 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>
# 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