Skip to content

Instantly share code, notes, and snippets.

View DCubix's full-sized avatar
💭
😄

Diego Lopes DCubix

💭
😄
View GitHub Profile
/*
* The MIT License
*
* Copyright 2016 twisterge.
*
* 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
@DCubix
DCubix / bot.py
Created November 14, 2016 21:31
Python IRC bot for the UPBGE team
import socket
import sys, os
import time
import random
import ast
from pws import Bing
from math import *
def tbytes(s):
return s.encode("utf-8")
@DCubix
DCubix / car.py
Last active November 1, 2016 11:25
2D Car Controller for BGE
from bge import logic, types, events, render
from mathutils import Vector
import math
def lerp(a, b, t):
return (1-t) * a + b * t
class Car(types.KX_GameObject):
def __init__(self, ob):
{
"styles": {
"dark": {
"skin": "//path/to/skin.png",
"font": "//path/to/font.ttf"
},
"light": {
"skin": "//path/to/skin.png",
"font": "//path/to/font.ttf"
}
@DCubix
DCubix / Test.java
Created September 16, 2016 01:54
Simple jumping box using LKGE
package logikers.lkge.test;
import logikers.lkge.components.*;
import logikers.lkge.core.*;
import logikers.lkge.math.Rect;
import logikers.lkge.math.Vector2;
import logikers.lkge.physics.Collision;
import logikers.lkge.physics.PhysicsType;
import logikers.lkge.physics.Polygon;
import logikers.lkge.scenegraph.Entity;
@DCubix
DCubix / Test.java
Created September 6, 2016 15:37
LKGE Demo
package logikers.lkge.test;
import logikers.lkge.components.SpriteRenderer;
import logikers.lkge.core.*;
import logikers.lkge.scenegraph.Entity;
import logikers.lkge.scenegraph.Scene;
class Rotator extends Component {
public float speed = 2f;
@DCubix
DCubix / concept.glsl
Last active August 21, 2016 15:08
Custom material shader concept for BGE
// Generated code. Not visible.
uniform struct TextureSlot {
vec2 offset;
vec2 scale;
float intensity;
float lodBias;
bool isNormalMap;
int blendMode; // Mix, Add, Subtract, Overlay, ...
int type; // Reflection, Refraction, Normal, UV, Generated.... This will determine which UV mapping algorithm to use.
/// and much more...
function SimpleAnimation() {
pix.Component.apply(this);
this.t = 0;
};
SimpleAnimation.prototype = new pix.Component();
SimpleAnimation.prototype.update = function(dt) {
this.t += dt;
if (this.t >= Math.PI * 2) {
this.t = 0;
}
package com.genesis2d.tests;
import com.genesis2d.core.BaseGame;
import com.genesis2d.core.Engine;
import com.genesis2d.core.Resources;
import com.genesis2d.graphics.Light;
import com.genesis2d.graphics.SpriteBatch;
import com.genesis2d.graphics.Texture;
import com.genesis2d.logic.Entity;
import com.genesis2d.logic.Sprite;
GLGraphics 640, 480
glewInit()
Local verts : Float[] = [-1.0, -1.0, 0.0, 1.0, -1.0, 0.0, 0.0, 1.0, 0.0]
Local vao : Int
Local vbo : Int
glGenVertexArrays(1, Varptr(vao))