This file contains hidden or 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
| cmake_minimum_required(VERSION 3.9.0) | |
| project(proj0) | |
| file(GLOB_RECURSE sources ../src/*.cpp) | |
| file(GLOB_RECURSE sources_test ../src/test/*.cpp) | |
| file(GLOB_RECURSE data ../resources/*) | |
| add_executable(main ${sources} ${data}) | |
| set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/../bin) |
This file contains hidden or 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 <SDL.h> | |
| int w = 800; | |
| int h = 600; | |
| SDL_Window *window = NULL; | |
| SDL_Surface *screenSurface = NULL; | |
| void mainLoop(); | |
| void initSDL(); |
This file contains hidden or 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
| glTranslate, glRotate, glScale | |
| Are these hardware accelerated? | |
| No, there are no known GPUs that execute this. The driver computes the matrix on the CPU and uploads it to the GPU. | |
| All the other matrix operations are done on the CPU as well : glPushMatrix, glPopMatrix, glLoadIdentity, glFrustum, glOrtho. | |
| This is the reason why these functions are considered deprecated in GL 3.0. You should have your own math library, build your own matrix, upload your matrix to the shader. |
This file contains hidden or 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
| Window window = Window(); | |
| window.openWindow("Main Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w, h); | |
| ################################ | |
| #include "Window.h" | |
| #include <glew.h> | |
| Window::Window() | |
| { |
This file contains hidden or 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
| //http://ysonggit.github.io/2015/01/26/efficient-implementation-of-mergesort-using-stl.html | |
| #include <vector> | |
| #include <iostream> | |
| #include <algorithm> | |
| template<class Iter> | |
| void merge_sort(Iter first, Iter last){ | |
| if (last - first > 1) { | |
| Iter middle = first + (last - first) / 2; |
This file contains hidden or 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
| http://bigocheatsheet.com/ | |
| https://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/ | |
| https://en.wikipedia.org/wiki/Big_O_notation#Orders_of_common_functions |
This file contains hidden or 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 "DLLLoad.h" | |
| int func1() { | |
| printf("func1\n"); | |
| func2(); | |
| printf("done\n"); | |
| return 132; | |
| } | |
| void func2() { | |
| printf("func2\n"); func3(); } |
This file contains hidden or 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
| // https://stackoverflow.com/questions/9568150/what-is-a-c-delegate | |
| Option 1 : functors: | |
| A function object may be created by implementing operator() | |
| struct Functor | |
| { | |
| // Normal class/struct members | |
| int operator()(double d) // Arbitrary return types and parameter list | |
| { |
This file contains hidden or 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
| import time | |
| class Benchmark(): | |
| def __init__(self, txt): | |
| self.txt = str(txt) | |
| self.start = time.time() | |
| def __enter__(self): | |
| return self |