Skip to content

Instantly share code, notes, and snippets.

View RafaelOliveira's full-sized avatar

Rafael Oliveira RafaelOliveira

View GitHub Profile
@mmozeiko
mmozeiko / win32_d3d11.c
Last active May 19, 2025 02:53
setting up and using D3D11 in C
// example how to set up D3D11 rendering on Windows in C
#define COBJMACROS
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d11.h>
#include <dxgi1_3.h>
#include <d3dcompiler.h>
#include <dxgidebug.h>
@kobalicek
kobalicek / blend2d-sdl2-sample.cpp
Created November 12, 2020 11:10
Blend2D & SDL Sample
#include <blend2d.h>
#include <SDL.h>
#define ARRAY_SIZE(X) uint32_t(sizeof(X) / sizeof(X[0]))
// ============================================================================
// [SDL_Application]
// ============================================================================
class SDL_Application {
@chrisdill
chrisdill / RayForm.cs
Last active March 17, 2025 01:05
Using raylib from inside a win forms application
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Raylib_cs;
using Color = Raylib_cs.Color;
namespace Rayforms
{
public class RayForm : Form
@romamik
romamik / KhaImageFromEncodedBytes.hx
Created January 11, 2017 08:29
Create kha image from encoded (png, jpg, etc...) bytes
package;
import haxe.io.Bytes;
import kha.Image;
#if sys_kore
@:cppFileCode('
#include <Kore/Graphics/stb_image.h>
#ifndef INCLUDED_kha_graphics4_TextureFormat
#include <kha/graphics4/TextureFormat.h>
@marcgg
marcgg / notevalues.json
Created November 1, 2016 10:56
note frequency value
var noteValues = {
'C0': 16.35,
'C#0': 17.32,
'Db0': 17.32,
'D0': 18.35,
'D#0': 19.45,
'Eb0': 19.45,
'E0': 20.60,
'F0': 21.83,
'F#0': 23.12,

Let's do some cppia

Note! Created a repo to replace this gist: https://github.com/cambiata/Haxe-Cppia-Basics Easier to testrun, fork and pr! Thanks, @PDeveloper!

This is a simple testproject created for the single purpose of learning how to use cppia, the scripable "cpp subtarget" for Haxe, created by Hugh Sanderson.

Info about cppia can be found in Hugh's WWX2015 talk (cppia part starts around 15:45).

Please note that this is WORK IN PROGRESS, and that I haven't yet found out to create a working cppia host..! Please step in with discussion and contributions!

@xem
xem / readme.md
Last active April 18, 2025 20:19
Maths & trigonometry cheat sheet for 2D & 3D games

Conventions

  • A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
  • lengths are in any unit (ex: pixels)
  • code snippets are in JavaScript

Degrees to radians

angleRad = angleDeg * Math.PI / 180;

@wighawag
wighawag / Main.hx
Last active March 21, 2017 17:50
Kha White Noise
import kha.System;
import kha.Scheduler;
class Main{
public static function main(){
System.init({
title: "dsp",
width: 800,
height: 600,
}, initialized);
@zaynyatyi
zaynyatyi / Game.hx
Last active June 28, 2019 21:37
Actuate in kha using manual update
package;
import motion.actuators.SimpleActuator;
class Game
{
public function new()
{
}
@user890104
user890104 / si7021.c
Last active September 5, 2017 08:06
Si7021 Linux app
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/i2c-dev.h>
#define BYTES2SHORT(X) (X[0] << 8 | X[1])