Skip to content

Instantly share code, notes, and snippets.

View HJfod's full-sized avatar
🐔
Chicken!

HJfod HJfod

🐔
Chicken!
View GitHub Profile

How to make Geode bindings for any programming language

So for this you're going to need two things:

  1. A generic library for dynamically generating assembly that wraps GD functions into non-static runtime structures that you can then easily manipulate into the target language's types
  2. A runtime for the target language that converts the library wrappers into language types and back

The generic library of step 1. can just be like a CMake file and a header + source file that are embedded in each runtime separately. This also requires TulipHook to expose its assembly generators (which I believe it does already).

So first you run through the bindings' codegen data and collect all the types and functions that are referred to in bindings and then you generate this epic code. I've marked everything that has to be generated from codegen data using the fictional [[generate]] attribute

@HJfod
HJfod / GeodeListExample.cpp
Created May 18, 2024 21:10
An example on how to create a simple scrollable list with Geode. Up-to-date with best practices in May 2024.
// Required for the ScrollLayer class, a Geode addition
#include <Geode/ui/ScrollLayer.hpp>
using namespace geode::prelude;
// `items` here is some content you want to use to generate the
// list nodes - this can be levels, posts, or whatever else you want
// to make a list of
ScrollLayer* createMyList(std::vector<Item> const& myItems) {
// The size here is the size of the visible area you can see and scroll in
/**
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
@HJfod
HJfod / BrownAlertDelegate.hpp
Created March 12, 2021 06:58
Simple class you can inherit from to create brown-background popups in GD
#pragma once
// i myself have one header file that
// includes cocos, gd.h, etc.
// i recommend that for you aswell
// include cocos2d
#include <cocos2d.h>
// if you don't use GD.h, just change