Skip to content

Instantly share code, notes, and snippets.

import "ecere"
#include <glad/glad.h>
#define property _property
#include <GL/glut.h>
#undef property
// GLAD_DEBUG is only defined if the c-debug generator was used
#ifdef GLAD_DEBUG
// logs every gl call to the console
void pre_gl_call(const char *name, void *funcptr, int len_args, ...)
{
@Einlander
Einlander / opengl triangle.ec
Last active December 7, 2015 06:13
test opengl
//https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Introduction
//https://gitlab.com/wikibooks-opengl/modern-tutorials/blob/master/tut01_intro/triangle.cpp
import "ecere"
#include "gl_core_3_3.h"
GLuint program;
GLint attribute_coord2d;
GLfloat triangle_vertices[] = {
@Einlander
Einlander / opengl_triangle_OO.ec
Created December 9, 2015 10:03
Object Oriented Version
//https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Introduction
/*
Object Oriented Version
By: Einlander
*/
import "ecere"
#include "gl_core_3_3.h"
class Example1_OO : Window
{
@Einlander
Einlander / read_text.ec
Last active December 12, 2015 08:24
Read entire text file at once
//load file to mem
import "ecere"
void file_read(const String filename)
{
// with code from http://rosettacode.org/wiki/Read_entire_file#C
char *buffer;
File FileHandler = FileOpen(filename, read);
if (FileHandler)
{
buffer = malloc(FileHandler.GetSize());
@Einlander
Einlander / scope.py
Last active December 13, 2015 05:51
testing scope
def my_function1(bool1):
if (bool1 = my_function2( insert_some_variable_here) ) = true :
dosomething
def my_function2(bool2):
return bool2
@Einlander
Einlander / freecam.gd
Last active May 4, 2020 12:35
free flight camera for godot
extends Camera
# member variables here, example:
# var a=2
# var b="textvar"
export var flyspeed= 0.1
var view_sensitivity = 0.3
var defaulCam = Matrix3()
var mousedifference = Vector3()
var yaw = 0
/*
Application : 3d Asset Browser
Author : Einlander
Purpose : Stores and keeps track of 3d assets
*/
/*
Future goals
Able to connect to remote multi-user server/database
@Einlander
Einlander / fps_player.gd
Last active January 19, 2022 20:01
Prototype Godot FPS Controller
extends KinematicBody
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
export(float) var walk_speed = 4
export(float) var run_speed = 6
export(float) var acceleration = 5
export(float) var deceleration = 8
@Einlander
Einlander / scene_debug.gd
Last active February 3, 2021 20:04
A super useful script for fps games. Attach it to the root node in your scene. Provides an FPS counter, fullscreen toggle, exits the game, and reloads the scene.
# Simple Utility Script
# Traps Mouse Cursor and hides it.
# ESCAPE to quit game
# F5 to reload current scene
# F9 to toggle collision shape dispay. Scene MUST be reloaded
# F10 to toggle fps Display
# F11 to switch from windowed to fullscreen
# F12 to take screenshot
#
# Works great for fps games
@Einlander
Einlander / cubemap_capture.gd
Created September 19, 2018 03:39
Takes the needed pictures to create a cube map.
extends Camera
# Takes the needed pictures to create a cube map.
# Read this to find where the files are saved. http://docs.godotengine.org/en/3.0/tutorials/io/data_paths.html?highlight=user%3A%2F%2F
# Go here to make it useable in godot. https://nadirpatch.com/cube2sphere/
var _pass = 0
func _ready():
get_viewport().size = Vector2(1024,1024)
self.rotation = Vector3(0,0,0)
pass