Skip to content

Instantly share code, notes, and snippets.

View ultimateprogramer's full-sized avatar

Ahmed Maawy ultimateprogramer

View GitHub Profile
@ultimateprogramer
ultimateprogramer / README.md
Last active December 18, 2023 17:59
Multiple Defold Build Targets

One way of doing this is to build using the command line tool and change your project dependencies depending on which platform/portal you are building for.

You can have project setting "stub" files, like this:

poki.settings configuration:

[project]
dependencies#0 = https://github.com/defold/extension-poki-sdk/archive/refs/tags/1.4.3.zip
@ultimateprogramer
ultimateprogramer / astar.java
Created September 10, 2023 10:59 — forked from jrenner/astar.java
Libgdx A* A Star path finding example
package org.jrenner.tac.ai;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.BinaryHeap;
import com.badlogic.gdx.utils.DelayedRemovalArray;
import com.badlogic.gdx.utils.GdxRuntimeException;
import com.badlogic.gdx.utils.ObjectFloatMap;
import com.badlogic.gdx.utils.ObjectMap;
import com.badlogic.gdx.utils.ObjectSet;
@ultimateprogramer
ultimateprogramer / description.md
Last active December 30, 2023 23:57 — forked from fenix-hub/#description.md
GDScript JSON <> Class Serializer/Deserializer

You can find usages in the GDScript Unirest plugin

This is a fast serializer/deserializer written in GDScript to convert a JSON (Dictionary) to a class, using something similar to the Reflection concecpt. json_to_class can be used to convert a Dictionary to a Class. All keys in the Dictionary will be treated as variables and their types will be guessed in the best way possible. A class (defined by the class_name keyword) must extend Reference or Object or be an inner class, or else Godot will not able to see its properties. It is also possible to deserialize a JSON key to a class property with a different name using the export hint as a variable name.

example usage:

// https://www.shadertoy.com/view/lslSR7
shader_type canvas_item;
vec3 hsv(float h,float s,float v) {
return mix(vec3(1.),clamp((abs(fract(h+vec3(3.,2.,1.)/3.)*6.-3.)-1.),0.,1.),s)*v;
}
float circle(vec2 p, float r) {
return smoothstep(0.1, 0.0, abs(length(p)-r)); // try changing the 0.1 to 0.3
}
void fragment() {
@ultimateprogramer
ultimateprogramer / gist:83aeca704a904310025bbe45ba0125dd
Last active October 27, 2022 10:23 — forked from gaspard/gist:1087380
Simple C++ class with C interface for Luajit ffi bindings
// g++ simple.cpp -shared -o libsimple.dylib
#include <stdio.h>
class Simple {
int id_;
public:
Simple(int id);
~Simple();
int id();
};
@ultimateprogramer
ultimateprogramer / GodotWebFilesExample.gd
Created May 30, 2022 14:02 — forked from nisovin/GodotWebFilesExample.gd
Godot Web File Open/Save Dialogs
extends Control
func _ready():
WebFiles.connect("file_opened", self, "_on_file_opened")
func _on_Button_pressed():
WebFiles.open_file(".jpg,.jpeg")
func _on_file_opened(file, content):
$Label.text = file
@ultimateprogramer
ultimateprogramer / open_source_and_videogames.md
Created January 6, 2022 11:05 — forked from raysan5/open_source_and_videogames.md
Open Source and Videogames - Resources

open_source_and_videogames

Open Source and Videogames - Resources

This git include a list of programs, tools, engines and libraries free and open source intended to make videogames.

NOTE: This gist is a support material for the talk "Open Source and Videogames" given by me, Ramon Santamaria, on October 26th 2021 in Canòdrom, Barcelona. All the materials listed here were explained in detail in a +2 hours talk.

Contents

@ultimateprogramer
ultimateprogramer / Perspective
Created December 16, 2021 09:59 — forked from GymbylCoding/ Perspective
Perspective Virtual Camera System
Perspective Virtual Camera System
Licensed under the MIT license, which basically means you can do anything you want with it.
@ultimateprogramer
ultimateprogramer / angular_velocity.lua
Last active January 20, 2022 18:42
Linear Movement along a direction set by an angle
Movement = Class{}
function Movement:init(x, y, angle, speed)
self.position = vector(x, y)
self.angle = angle
self.speed = speed
self.velocity = self.speed * vector(math.cos(self.angle), math.sin(self.angle))
end
function Movement:update(dt)
@ultimateprogramer
ultimateprogramer / start-defold.sh
Created May 23, 2021 20:45
Start Defold with MESA Override on Ubuntu 20.04
export MESA_GL_VERSION_OVERRIDE=2.1
./Defold