Skip to content

Instantly share code, notes, and snippets.

View Mischa-Alff's full-sized avatar

Mischa Alff Mischa-Alff

View GitHub Profile
Clock gameClock;
while gameIsRunning:
frameTime = gameClock.restart()
process_input()
update_physics(frameTime)
update_graphics(frameTime)
section .data
fmt: db "%#06x", 0xA, 0x0
align 16
aabb1:
.left: dd 1
.top: dd 1
.right: dd 1
.bottom: dd 1
align 16
aabb2:
#include <SFML/Graphics.hpp>
#include "Ball.hpp"
Ball::Ball(int x, int y) : Entity(x, y, 10, 10, 4) {}
void Ball::checkCollision(int x, int y) {
;
}
@Mischa-Alff
Mischa-Alff / autoexp.dat
Last active March 1, 2016 17:32
VS2010 SSO debug fix
; AutoExp.Dat - templates for automatically expanding data
; Copyright(c) Microsoft Corporation. All Rights Reserved.
;---------------------------------------------------------------
;
; While debugging, Data Tips and items in the Watch and Variable
; windows are automatically expanded to show their most important
; elements. The expansion follows the format given by the rules
; in this file. You can add rules for your types or change the
; predefined rules.
;
@Mischa-Alff
Mischa-Alff / AABB.cpp
Last active October 31, 2022 11:12
Simple AABB implementation using SIMD instructions for x86-64
#include <chrono>
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <random>
struct AABB{int32_t left, top, right, bottom;};
extern "C" bool check_aabb(AABB *a, AABB *b);
extern "C" bool check_aabb_conventional(AABB *a, AABB *b);
@Mischa-Alff
Mischa-Alff / fps.cpp
Last active January 26, 2023 04:12
std::chrono::high_resolution_clock::time_point start, end, timetoprint;
timetoprint = start = end = std::chrono::high_resolution_clock::now();
long long frame_count=0;
long double frametime_total=0.f;
while(!glfwWindowShouldClose(win)) {
end = std::chrono::high_resolution_clock::now();
long int frametime_us = (std::chrono::duration_cast<std::chrono::microseconds>(end-start).count());
float frametime_s = ft/1e6f;