Skip to content

Instantly share code, notes, and snippets.

View DCubix's full-sized avatar
💭
😄

Diego Lopes DCubix

💭
😄
View GitHub Profile
@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):
@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")
/*
* 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
/*
* 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
/*
* File: Collections.h
* Author: twisterge
*
* Created on December 5, 2016, 11:50 PM
*/
#ifndef COLLECTIONS_H
#define COLLECTIONS_H
void SpriteBatch::Render() {
glBindVertexArray(m_vao);
/// 1. Draw normal maps to the buffer
glEnable(GL_DEPTH_TEST);
m_gbuffer->Bind();
glDepthFunc(GL_LESS);
glDepthMask(true);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@DCubix
DCubix / Ptr.h
Last active December 9, 2016 02:50
Simple Smart Pointer CLass for C++
/*
* 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
class Game : public GameWindow {
public:
Game()
: GameWindow(640, 480, "Test Game")
{
}
void OnLoad() override {
GetCurrentScene()->GetSpriteBatch()->SetAmbientColor(Color(0.01f, 0.02f, 0.07f));
import org.lwjgl.BufferUtils;
import java.nio.FloatBuffer;
import static org.lwjgl.opengl.GL11.*;
public class Mat4 {
public static final Mat4 IDENTITY = new Mat4().identity();
private float[][] m;
from bge import types, render, logic
class CustomTechnique(types.KX_RenderTechnique):
def __init__(self):
super(CustomTechnique, self).__init__()
self.normals_shader = types.BL_Shader(...)
def apply(self):
# render all the meshes with a specific shader