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
| // To run on laptops: | |
| #ifdef _WIN32 | |
| #include <windows.h> | |
| extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; | |
| extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; | |
| #endif | |
| #include <QtGui/QOpenGLFunctions> | |
| #include <QtGui/QSurfaceFormat> | |
| #include <QtOpenGL/QOpenGLBuffer> |
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
| # | |
| # Skeleton for SDL2/OpenGL application in Python | |
| # with fixed logic time step, rendering is going still at full speed. | |
| # | |
| # To turn debug logging messages on, run with -v parameter: | |
| # python <script_name.py> -v | |
| # | |
| import argparse | |
| import logging |
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
| CC = g++ | |
| INC = -I"E:\Libs\SDL2-2.0.12-mingw-32bit\include" -I"E:\Libs\box2d-2.4.0-mingw-32bit\include" | |
| LIB = -L"E:\Libs\SDL2-2.0.12-mingw-32bit\lib" -L"E:\Libs\box2d-2.4.0-mingw-32bit\lib" | |
| FLAGS = -c | |
| all: main.o | |
| $(CC) main.o $(LIB) -lSDL2.dll -lbox2d -o app | |
| main.o: main.cpp | |
| $(CC) $(FLAGS) $(INC) main.cpp |
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
| let verts = new Float32Array( [ 0, 2, 0, -1, 0.2, 0, 1, 0.2, 0 ] ); | |
| let v = base64_test( verts ); | |
| function base64_test( fary ){ | |
| //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| // ENCODING TEST | |
| console.log("Origin Data", fary ); | |
| let uint = new Uint8Array( fary.buffer ); | |
| console.log( "Convert F32 to Uint8 : Byte Length Test", fary.length * 4, uint.length ); |
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
| using SFML.Window; | |
| using SFML.Graphics; | |
| using SFML.System; | |
| using OpenToolkit.Graphics.OpenGL; | |
| using OpenToolkit.Windowing.Desktop; | |
| using System.IO; | |
| using System; | |
| namespace SfmlNetAndOpenTK4DotNetCore | |
| { |
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
| using OpenToolkit.Graphics.OpenGL; | |
| using OpenToolkit.Windowing.Desktop; | |
| using OpenToolkit.Mathematics; | |
| using System.IO; | |
| using System; | |
| namespace ColoredTriangleVaoOpenTK4OpenGL31 | |
| { | |
| class Program | |
| { |
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
| from PySide2 import QtCore | |
| class Console(QtCore.QObject): | |
| def __init__(self, msg): | |
| super(Console, self).__init__() | |
| self.msg = msg | |
| self.timer = QtCore.QBasicTimer() | |
| self.timer.start(500, self) |
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
| grid = [ | |
| [" ", " ", " "], | |
| [" ", " ", " "], | |
| [" ", " ", " "]] | |
| def is_winner(player): | |
| return ( | |
| # Rows | |
| grid[0][0] == player and grid[0][1] == player and grid[0][2] == player or | |
| grid[1][0] == player and grid[1][1] == player and grid[1][2] == player or |
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 unittest | |
| from grid import grid, is_winner | |
| # python -m unittest discover tests | |
| class TestGridWinner(unittest.TestCase): | |
| def test_first_row_is_winner(self): | |
| grid[0][0] = "x" | |
| grid[0][1] = "x" |
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 glfw | |
| from OpenGL.GL import * | |
| import numpy as np | |
| class Window: | |
| def __init__(self, width: int, height: int, title: str): | |
| # Initializing glfw library | |
| if not glfw.init(): | |
| raise Exception("glfw can not be initialized!") |