Skip to content

Instantly share code, notes, and snippets.

@codingminecraft
codingminecraft / Main.java
Created July 7, 2021 17:14
Bitwise Operators
class Main {
static int[] someArray = {0, 1, 2, 3, 4};
public static void main(String args[]) {
System.out.println("SomeArray[0]: " + someArray[0]);
System.out.println("SomeArray[1]: " + someArray[1]);
System.out.println("SomeArray[2]: " + someArray[2]);
System.out.println("SomeArray[3]: " + someArray[3]);
System.out.println("SomeArray[4]: " + someArray[4]);
@codingminecraft
codingminecraft / Vector3.cpp
Created April 2, 2021 17:10
C++ Episode 7 Solution
#include "Vector3.h"
#include <stdio.h>
namespace Math
{
float Dot(Vector3 a, Vector3 b)
{
return a.x * b.x + a.y * b.y + a.z * b.z;
}
@codingminecraft
codingminecraft / PracticeProject.premake5.lua
Created March 22, 2021 00:33
Build Files and Code for C++ Episode: 6 (Premake)
-- This is in PracticeProject/premake5.lua, I just can't create a subdirectory in a Github gist
project "PracticeProject"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
staticruntime "on"
targetdir("../bin/" .. outputdir .. "/%{prj.name}")
objdir("../bin-int/" .. outputdir .. "/%{prj.name}")
@codingminecraft
codingminecraft / Log.cpp
Created March 21, 2021 20:25
Simple Logger
#include <stdio.h>
#include <stdarg.h>
#include "Log.h"
void LogInternal(const char *file, int line, const char *format, ...)
{
printf("'%s' Line: %d\n", file, line);
printf("\t");
va_list argptr;
@codingminecraft
codingminecraft / build.bat
Created March 16, 2021 23:41
GuessNumber.cpp
@echo off
IF NOT EXIST bin mkdir bin
IF NOT EXIST bin-int mkdir bin-int
pushd bin-int
cl ..\guessNumber.cpp /link
popd
@codingminecraft
codingminecraft / Program.vb
Created December 19, 2020 16:47
OpenGL VB Debugging
' I changed lines 85-88 to this
Renderer.AddLayer(BackgroundBuffer.RenderID)
'Renderer.AddLayer(BackgroundBuffer.FrameBufferID, Source, Destination)
Renderer.UpdateImage(GB.RenderID, GB.Image)
Renderer.AddLayer(GB.RenderID)
@codingminecraft
codingminecraft / clicker.java
Last active December 7, 2020 14:35
Mouse Click Debounce
public class MoneyButton extends GameObject{
public Sprite buttonClickable;
public Sprite buttonClicked;
public int money = 0;
// Add a debounce time so that you can wait before registering the next click
private double mouseDebounceTime = 0.1;
private double mouseDebounceTimeLeft = 0.1;
@codingminecraft
codingminecraft / export.cpp
Last active September 11, 2020 21:02
GLFW breaks windows CreateProcess function
#include "export.h"
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
static GLFWwindow* window = nullptr;