Skip to content

Instantly share code, notes, and snippets.

View hadronized's full-sized avatar
🐺
Oublie qu’t’as aucune chance, va-y, fonce.

Dimitri Sabadie hadronized

🐺
Oublie qu’t’as aucune chance, va-y, fonce.
View GitHub Profile
void application::init() {
if (!glfwInit())
throw runtime_error::dead_ctor("Cannot initialize GLFW");
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
if (glfwOpenWindow(_width, _height, 0, 0, 0, 0, 0, 0, (_fullscreen ? GLFW_FULLSCREEN : GLFW_WINDOW_NO_RESIZE))) {
glfwTerminate();
throw runtime_error::dead_ctor("Cannot open a window");
}
@hadronized
hadronized / fuckit.cpp
Created October 20, 2011 13:36
glEnableVertexAttribArray suck dicks
auto &vs = _vsLoader.from_disk("../../src/vs.glsl");
auto &fs = _fsLoader.from_disk("../../src/fs.glsl");
/* shader part */
vs.compile();
fs.compile();
_sp.attach(vs);
_sp.attach(fs);
_sp.link();
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <pthread.h>
pthread_mutex_t mutex;
int *played;
int *scores;
enum resource_type { A, B, C, D, E, UNKNOWN }
class foo {
this(resource_type rt) {
switch (rt) {
/* do shit here depending on the type of rt */
default :;
}
[email protected] ~/Code/space_defence % git checkout unstable 17:19:33
Switched to branch 'unstable'
[email protected] ~/Code/space_defence % ls include/view 17:19:40
frame.hpp gui.hpp view_interface.hpp
[email protected] ~/Code/space_defence % git checkout unstable-view 17:19:44
Switched to branch 'unstable-view'
[email protected] ~/Code/space_defence % git clean -ndx 17:19:59
[email protected] ~/Code/space_defence % ls include/view 17:20:08
Button.hpp GUI.hpp Text.hpp WidgetComposite.hpp
Frame.hpp Listeners.hpp WidgetBase.hpp
void platform_controller::select_platform(select_mode m) {
switch (m) {
case NONE :
_selected = 0;
break;
case CLUSTER :
/* ... */
break;
class A {
void foo() {
writeln("in A.foo()");
}
}
class B : A {
void foo() { /* WARNING ici, on "devrait" utiliser override */
writeln("in B.foo()");
}
private void generate_mines_() {
auto new_mine_index_() {
auto index = [ uniform(0u, _height), uniform(0u, _width) ];
/* check if index is in _mines. if is, loop again till find a good index */
return index;
}
while (_mines.length < _minesNb) {
/* TODO */
}
module lol;
import std.stdio;
class A {
this() {
debug writeln("ctor");
}
~this() {
bool run(gfx &gfx, ms_t p) {
auto *f = _intervals.front();
if (!f->running(p)) {
_intervals.pop();
if (_intervals.empty())
return false;
f = _intervals.front();
}