Skip to content

Instantly share code, notes, and snippets.

Mārtiņš Možeiko mmozeiko

  • RAD Game Tools
  • Kirkland, WA
Block or report user

Report or block mmozeiko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mmozeiko
mmozeiko / win32_crt_float.cpp
Last active May 28, 2020
Visual C/C++ CRT functionality
View win32_crt_float.cpp
extern "C"
{
int _fltused;
#ifdef _M_IX86 // following functions are needed only for 32-bit architecture
__declspec(naked) void _ftol2()
{
__asm
{
@mmozeiko
mmozeiko / ods.c
Created Apr 16, 2019
Example how to capture OutputDebugString on Windows
View ods.c
#include <windows.h>
#include <intrin.h>
#define Assert(x) do { if (!(x)) __debugbreak(); } while (0)
static struct
{
DWORD process_id;
char data[4096 - sizeof(DWORD)];
}* ods_buffer;
@mmozeiko
mmozeiko / custom_draw_window.c
Last active Apr 24, 2020
no title/border window
View custom_draw_window.c
#include <windows.h>
#include <windowsx.h>
#include <uxtheme.h>
#pragma comment(lib, "user32.lib")
#pragma comment(lib, "gdi32.lib")
#pragma comment(lib, "uxtheme.lib")
LRESULT WINAPI WindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
@mmozeiko
mmozeiko / win32_handmade.cpp
Created Dec 13, 2014
win32_handmade.cpp with WASAPI from Day 19
View win32_handmade.cpp
/* ========================================================================
$File: $
$Date: $
$Revision: $
$Creator: Casey Muratori $
$Notice: (C) Copyright 2014 by Molly Rocket, Inc. All Rights Reserved. $
======================================================================== */
/*
TODO(casey): THIS IS NOT A FINAL PLATFORM LAYER!!!
@mmozeiko
mmozeiko / test.c
Created Apr 13, 2020
passing custom information to and from win32 message loop
View test.c
#include <windows.h>
#include <stdio.h>
typedef struct
{
int width;
int height;
} Context;
static LRESULT CALLBACK WindowProc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
@mmozeiko
mmozeiko / meow_hash_bench.c
Last active Apr 7, 2020
Meow hash in generic C (v0.2)
View meow_hash_bench.c
#ifdef _MSC_VER
#define MEOW_API static __declspec(noinline)
#include <intrin.h>
#else
// assume clang
#define MEOW_API static __attribute__((noinline))
#define __rdtsc __builtin_readcyclecounter
#endif
#include "meow_hash_c.h"
@mmozeiko
mmozeiko / xbox_test.c
Last active Apr 2, 2020
Getting xbox controller input without xinput
View xbox_test.c
// cl.exe xbox_test.c /link setupapi.lib user32.lib
#include <windows.h>
#include <setupapi.h>
#include <dbt.h>
#include <stdio.h>
/// interface
#define XBOX_MAX_CONTROLLERS 16
@mmozeiko
mmozeiko / main.cpp
Created Feb 13, 2019
Windows drag & drop example
View main.cpp
/*
Minimal Drag and Drop Application for Windows
Copright (C) Alexandre LHUILLIER - 2019
===
This application creates an application window and a console window.
Whenever you drag a file or a set of files from the Windows explorer
to the application window, the absolute paths of the dropped files
are printed in the console window.
@mmozeiko
mmozeiko / dxgl.c
Last active Mar 4, 2020
WGL_NV_DX_interop2 example
View dxgl.c
#define COBJMACROS
#define INITGUID
#include <intrin.h>
#include <windows.h>
#include <d3d11.h>
#include <gl/GL.h>
#include "glext.h" // https://www.opengl.org/registry/api/GL/glext.h
#include "wglext.h" // https://www.opengl.org/registry/api/GL/wglext.h
You can’t perform that action at this time.