Skip to content

Instantly share code, notes, and snippets.

View danielytics's full-sized avatar
🚰

Dan Kersten danielytics

🚰
  • Dublin, Ireland
View GitHub Profile
@danielytics
danielytics / glfw.cpp
Created February 14, 2021 19:48
OpenGL with SDL and GLFW
// Code taken from GLFW documentation: https://www.glfw.org/documentation.html
#include <GLFW/glfw3.h>
int main(void)
{
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
@danielytics
danielytics / keybase.md
Created December 11, 2019 14:30
keybase.md

Keybase proof

I hereby claim:

  • I am danielytics on github.
  • I am guywithknife (https://keybase.io/guywithknife) on keybase.
  • I have a public key ASCfWEd74yrc1AWr28bUEd0t4hQWtWlaUtc7trWPJVU6two

To claim this, I am signing this object:

lock = RWLock()
with lock.read():
# Do some stuff
# Other threads can also use lock.read() at the same time, but no threads can lock.write() until current reads complete
with lock.write():
# Do some stuff
# No other thread can be reading or writing while this thread has the lock
@danielytics
danielytics / player.hpp
Last active March 19, 2018 17:12
Code snippets for "Using C++ and GDNative in Godot 3" tutorial, Part 2
#include <core/Godot.hpp>
#include <KinematicBody2D.hpp>
using namespace godot;
class Player : public GodotScript<KinematicBody2D>
{
public:
GODOT_SUBCLASS(Player, KinematicBody2D)
@danielytics
danielytics / SConstruct
Last active March 19, 2018 14:07
Code snippets for "Using C++ and GDNative in Godot 3" tutorial, Part 2
#!python
import os
# platform= makes it in line with Godots scons file, keeping p for backwards compatibility
platform = ARGUMENTS.get("p", "linux")
platform = ARGUMENTS.get("platform", platform)
target_arch = ARGUMENTS.get('a', ARGUMENTS.get('arch', '64'))
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
@danielytics
danielytics / project directory structure
Last active March 19, 2018 14:05
Code snippets for "Using C++ and GDNative in Godot 3" tutorial, Part 2
tutorial root directory/
├── playerlib/
│ └── src/
└── playerdemo/
└── libs/
@danielytics
danielytics / Main.gd
Created March 13, 2018 01:19
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
extends Node
func _ready():
var simple = load("res://simple.gdns").new()
simple.say(simple.hello("World"))
@danielytics
danielytics / compiling
Last active March 13, 2018 00:49
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
scons platform=osx use_llvm=yes
@danielytics
danielytics / SConstruct
Last active March 13, 2018 20:09
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
#!python
import os
# platform= makes it in line with Godots scons file, keeping p for backwards compatibility
platform = ARGUMENTS.get("p", "linux")
platform = ARGUMENTS.get("platform", platform)
target_arch = ARGUMENTS.get('a', ARGUMENTS.get('arch', '64'))
# This makes sure to keep the session environment variables on windows,
# that way you can run scons in a vs 2017 prompt and it will find all the required tools
@danielytics
danielytics / simple.cpp
Created March 13, 2018 00:29
Code snippets for "Using C++ and GDNative in Godot 3" tutorial
#include <core/Godot.hpp>
#include <Reference.hpp>
#include <core/String.hpp>
#include <core/Array.hpp>
using namespace godot;
class Simple : public GodotScript<Reference> {
GODOT_CLASS(Simple);
public: