Skip to content

Instantly share code, notes, and snippets.

View CaptainHandyman's full-sized avatar
🎯
Focusing

Sanya CaptainHandyman

🎯
Focusing
  • Georgia, Tbilisi
View GitHub Profile
@CaptainHandyman
CaptainHandyman / Guess the number.java
Created June 8, 2021 13:44
A game written in Java where you have to hit a number.
package org.redbull4.helloworld;
import java.util.Scanner;
public class Hello {
static Scanner sc = new Scanner(System.in);
public static int getRandomNumber(final int a, final int b) {
double output = Math.random() * ((b - a - 1) + a);
@CaptainHandyman
CaptainHandyman / OpenGL-ShaderLoader.cpp
Last active May 25, 2021 18:35
OpenGL vertex and fragment shader loading script.
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
void scanShaderForErrors(GLuint &shader, const GLuint &shaderType) {
int success;
char LOG[WCHAR_MAX];
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <iostream>
using namespace std;
GLFWwindow* window = NULL;
GLFWmonitor* monitor = NULL;
void setWindowFillColor(const uint16_t& r, const uint16_t& g,
---
BasedOnStyle: Google
AlignAfterOpenBracket: Align
AlignOperands: 'true'
AllowAllArgumentsOnNextLine: 'true'
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortBlocksOnASingleLine: 'true'
AllowShortFunctionsOnASingleLine: All
AlwaysBreakTemplateDeclarations: 'Yes'
@CaptainHandyman
CaptainHandyman / cross_and_zero.cpp
Last active March 25, 2021 11:55
cross and zero : )
#include <iostream>
using namespace std;
#define FIRST 'x'
#define SECOND '0'
char arr[3][3];
void check() {
string horizontally, vertically, oblique, _oblique;
@CaptainHandyman
CaptainHandyman / SImple_C++_String.hpp
Created December 11, 2020 16:03
Simple C++ String
#ifndef SimpleString_hpp
#define SimpleString_hpp
#include <cinttypes>
#include <iostream>
class SimpleString {
public:
SimpleString() {}
@CaptainHandyman
CaptainHandyman / SDL2_OpenGL_ES3_Triangle
Last active November 20, 2020 14:10
SDL2 + OpenGL + ES3 - Triangle
#include <GLES3/gl3.h>
#include <SDL2/SDL.h>
struct window_data {
const unsigned int width = 800, height = 600, x = SDL_WINDOWPOS_CENTERED,
y = SDL_WINDOWPOS_CENTERED;
SDL_Color fill_color;
} window_data;
SDL_Window *window;
@CaptainHandyman
CaptainHandyman / SDL2_OpenGL_ES3_window.cpp
Last active November 20, 2020 14:10
Simple SDL2 + OpenGL + ES3 - window
#include <GLES3/gl3.h>
#include <SDL2/SDL.h>
struct window_data {
const unsigned int width = 800, height = 600, x = SDL_WINDOWPOS_CENTERED,
y = SDL_WINDOWPOS_CENTERED;
SDL_Color fill_color;
} window_data;
SDL_Window *window;
@CaptainHandyman
CaptainHandyman / CollisionDetection.cpp
Last active August 22, 2020 22:11
SDL2 + OpenGL - Collision detection script
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
float MOVEMENT_SPEED=0.08;
const Uint8 *key=SDL_GetKeyboardState(NULL);
SDL_Window *window;
SDL_Event event;
SDL_GLContext glContext;
@CaptainHandyman
CaptainHandyman / OpenGL-3D-Cube.cpp
Created June 18, 2020 13:10
OpenGL and SDL2 - 3D Cube
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
float rotate_x=0;
float rotate_y=0;
SDL_Window *window;
SDL_Event event;