This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main (int argc, const char * argv[]){ | |
// Create the main window | |
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); | |
// Load a sprite to display | |
sf::Texture texture; | |
if (!texture.loadFromFile(resourcePath() + "cute_image.jpg")) | |
return EXIT_FAILURE; | |
sf::Sprite sprite(texture); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Electricity: | |
resolution_ = 0; means straight line | |
pointA_, pointB_; are vec4s | |
*/ | |
void ElectricCurrent::createVertexData(){ | |
int tfloats = (2+resolution_) * 4; //num_points * num_floats_per_point | |
GLfloat data[tfloats]; | |
int atIndx = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This piece of shit that I wrote does one simple task: linearly interpolate between 0.0 and 1.0 for the value 'res'. | |
This is a sample run: | |
$ ./mix 1 | |
0: 0.500000 | |
$ ./mix 2 | |
0: 0.333333 | |
1: 0.666667 | |
$ ./mix 3 | |
0: 0.250000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// SJViewController.m | |
// TestSkybox | |
// | |
// Created by Sidharth Juyal on 22/06/12. | |
// Copyright (c) 2012 whackylabs. All rights reserved. | |
// | |
#import "SJViewController.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
What: Exception using throw and jmp/longjmp | |
Author: Sid | |
Note: Test run with 3 cases | |
1: x(10), y(2) : Returns 2 | |
2: x(10), y(0) : Catch exception DIVIDE_EXCP, prints error and quit | |
3: x(10), y(-2) : Catch exception NEG_EXCP, does nothing | |
*/ | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cmath> | |
#include <cstring> | |
bool debug; | |
bool isFactor(long double n, long double f){ | |
long double i = 1.0; | |
long double m = f * i; | |
while(m <= n){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test for two line segments intersection | |
// sid@whackylabs.com | |
// Inspired from: | |
// theory: http://www.bryceboe.com/2006/10/23/line-segment-intersection-algorithm/ | |
// source: http://www.bryceboe.com/wordpress/wp-content/uploads/2006/10/intersect.py | |
#include <iostream> | |
template<typename T> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
sid@whackylabs.com | |
Tool to test collision detection using Grapher.app | |
Create formatted data. | |
Input: cd.in | |
0.000000 320.000000 194.204971 -60.418026 244.204971 -10.418026 | |
0.000000 320.000000 194.249619 -60.418026 244.249619 -10.418026 | |
0.000000 320.000000 194.294266 -60.418026 244.294266 -10.418026 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using std::function for callback | |
#include <iostream> | |
#include <utility> | |
class Client; | |
// Calculator server | |
class Server{ | |
public: | |
typedef void (Client::*CB)(int result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// EventLoop.h | |
// HideousGameEngine | |
// | |
// Created by Sid on 27/03/13. | |
// Copyright (c) 2013 whackylabs. All rights reserved. | |
// | |
#ifndef __HideousGameEngine__EventLoop__ | |
#define __HideousGameEngine__EventLoop__ |