Skip to content

Instantly share code, notes, and snippets.

@CeytiX
CeytiX / cpplibs.sh
Created November 22, 2015 11:45
Install c++ libraries
#!/bin/bash
# sdl 1.2
apt-get install libsdl1.2-dev
apt-get install libsdl-image1.2 libsdl-image1.2-dev
apt-get install libsdl-ttf2.0-dev
# sfml
@CeytiX
CeytiX / sfmlbug.cpp
Created September 13, 2015 10:35
use `g++ sfmlbug.cpp -o sfmlbug -std=c++11 -lsfml-window -lsfml-system -lGL -lGLU && ./sfmlbug`
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
void draw()
{
gluLookAt(3,4,2,0,0,0,0,0,1);
glBegin(GL_QUADS);
glColor3ub(255,0,0);
glVertex3d(1,1,1);
@CeytiX
CeytiX / opengl.cpp
Last active September 13, 2015 10:18
Let's play with SFML and OpenGL !
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
#include <map>
#include <string>
void draw(int angle1, int angle2, int length)
{
glPushMatrix();
/** first rectangle **/
#include "Card.h"
/**************
* constructor *
**************/
Card::Card()
{
family = "";
number = 0;
@CeytiX
CeytiX / binary.cpp
Last active September 6, 2015 16:58
Converts a decimal number to a binary number
#include <iostream>
#include <bitset>
int main(int argc, char* argv[])
{
int a(0);
if(argc >= 1) a = atoi(argv[1]);
else cin >> a;
std::cout << a << " : " << std::bitset<sizeof(int)*8>(a) << std::endl;
@CeytiX
CeytiX / epic.sh
Created June 29, 2015 08:20
very nice effect in your terminal
ls -R /
@CeytiX
CeytiX / Randint.cpp
Last active September 6, 2015 16:53
Return a random integer between MIN and MAX
#include "Randint.h"
Randint::Randint()
{
srand(time(0));
m_MIN = 1;
m_MAX = 10;
}
Randint::Randint(int min, int max)
@CeytiX
CeytiX / random.cpp
Last active August 29, 2015 14:22
In how many tries can you randomly find a text ?
#include <iostream>
#include <string>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
srand(time(0));
@CeytiX
CeytiX / oom.cpp
Last active August 29, 2015 14:22
Use it to destroy your memory
#include <fstream>
using namespace std;
int main()
{
ofstream oom ("outOfMemory.txt",ofstream::app);
for(;;) oom << "outOfMemory ";
return 0;
++++++++++
[
>+++++++ 70
>++++++++++ 100
>+++++++++++ 110
>+++++++++++ 110
>+++++++++++ 110
>+++ 30
>+++++++++ 90
>+++++++++++ 110