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 "array.h" | |
// arenasize: | |
// virtual address size of the backing arenai | |
void * | |
make_array(usize arenasize, usize elementsize, char *name) | |
{ | |
struct arena *arena = make_arena(arenasize, name); | |
struct array_header *array = arena_alloc_align(arena, 16, sizeof *array); |
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
bits 64 | |
default rel | |
%define R_PITCH (160 * 4) | |
%define R_PITCH_SHIFT 10 | |
section .data | |
float_1 dd 1.0 | |
align 32 |
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
#define COBJMACROS | |
#include <windows.h> | |
#include <d3d11.h> | |
#include <dxgi1_3.h> | |
cvar_t vid_dxgi = {"vid_dxgi", 0, CVAR_BOOL | CVAR_ALLOW | CVAR_INIT}; // DXGI layer for OpenGL | |
cvar_t vid_waitsync = {"vid_waitsync", 0, CVAR_BOOL | CVAR_ALLOW}; // lower latency, lower framerate | |
cvar_t vid_display = {"vid_display", -1, CVAR_INT | CVAR_ALLOW}; // -1 = primary | |
cvar_t vid_fullscreen = {"vid_fullscreen", 1, CVAR_BOOL | CVAR_ALLOW}; |
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
struct arena { | |
usize commitsize; | |
char *name; | |
char *start; // start of reserved address space | |
char *end; // end of reserved address space | |
char *heap; // start of user block | |
char *allocated; // end of allocated block | |
char *commited; // end of commited block | |
}; |
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
// Initializes an OpenGL device context for a given window. | |
void | |
gl_create_context(HWND hwnd) | |
{ | |
HDC hdc; | |
HGLRC hglrc; | |
int pfd_index; | |
PIXELFORMATDESCRIPTOR pfd, device_pfd; |
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 "core/vector.h" | |
#include "core/math.h" | |
#include "physics/clip.h" | |
struct phys_world { | |
unsigned static_clips_count; | |
struct aabb static_clips[PHYS_MAX_CLIP]; | |
}; | |
static struct phys_world phys; |
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
spacing=1 | |
id=1 | |
nodes={} | |
rects={} | |
parent=nil | |
child=nil | |
function setpos(node) | |
local d=0 | |
local p=node.p |
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
// Copyright 2022 [email protected] | |
// | |
// Permission to use, copy, modify, and/or distribute this software for | |
// any purpose with or without fee is hereby granted, provided that the | |
// above copyright notice and this permission notice appear in all copies. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL | |
// WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED | |
// WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE | |
// AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
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
#define DEFER_CAT_(A, B) A ## B ## _ | |
#define DEFER_CAT(A, B) DEFER_CAT_(A, B) | |
template <typename Func> | |
struct Defer { | |
Func fn; | |
Defer(Func fn_) : fn(fn_) {} | |
~Defer() { fn(); } | |
}; |
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
// Copyright (c) 2023 [email protected] | |
// | |
// Redistribution and use in source and binary forms, with or without | |
// modification, are permitted provided that the following conditions are met: | |
// 1. Redistributions of source code must retain the above copyright | |
// notice, this list of conditions and the following disclaimer. | |
// 2. Redistributions in binary form must reproduce the above copyright | |
// notice, this list of conditions and the following disclaimer in the | |
// documentation and/or other materials provided with the distribution. | |
// |
NewerOlder