Skip to content

Instantly share code, notes, and snippets.

View vaiorabbit's full-sized avatar
🎮
busy playing video games

vaiorabbit

🎮
busy playing video games
View GitHub Profile
# CMakeLists for pocketlang (https://github.com/ThakeeNathees/pocketlang)
# - put this file in cli/ directory
file( GLOB POCKETCLI_HDRS "${CMAKE_CURRENT_LIST_DIR}/*.h" )
file( GLOB POCKETCLI_SRCS "${CMAKE_CURRENT_LIST_DIR}/*.c" )
add_executable(pocketcli ${POCKETCLI_SRCS} ${POCKETCLI_HDRS})
target_include_directories(pocketcli
PUBLIC ${CMAKE_CURRENT_LIST_DIR}/../src/include
)
@vaiorabbit
vaiorabbit / TLSLeakCheck.cpp
Last active March 27, 2021 12:41
SDL memory leak check (tested on v2.0.14)
// Ref.: https://stackoverflow.com/questions/4790564/finding-memory-leaks-in-a-c-application-with-visual-studio
#include "windows.h"
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <SDL.h>
class Application
{
public:
{
// Place your GLOBAL snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
# coding: utf-8
#
# Ref.: bgfx/examples/06-bump/bump.cpp
# https://github.com/vaiorabbit/sdl2-bindings
#
require 'rmath3d/rmath3d'
require 'sdl2'
require_relative '../../bindings/ruby/bgfx.rb'
require_relative './logo.rb'
require_relative './utils.rb'
# coding: utf-8
#
# Ref.: bgfx/examples/06-bump/bump.cpp
# https://github.com/vaiorabbit/ruby-opengl/tree/master/sample
#
require 'rmath3d/rmath3d'
require 'opengl'
require 'glfw'
require_relative '../../bindings/ruby/bgfx.rb'
require_relative './utils.rb'
@vaiorabbit
vaiorabbit / 06_bump.rb
Created May 31, 2020 04:02
06_bump.rb : Ruby-bgfx port of 'cubes.cpp' (WIP). Ref.: https://gist.github.com/vaiorabbit/29acb4ff3b94cefdbcfac3e2787eef50
#
# Ref.: bgfx/examples/06-bump/bump.cpp
# https://github.com/vaiorabbit/ruby-opengl/tree/master/sample
#
require 'rmath3d/rmath3d'
require 'opengl'
require 'glfw'
require_relative '../../bindings/ruby/bgfx.rb'
require_relative './utils.rb'
@vaiorabbit
vaiorabbit / 01_cubes.rb
Last active May 30, 2020 09:43
01_cubes.rb : Ruby-bgfx port of 'cubes.cpp' (WIP). Ref.: https://gist.github.com/vaiorabbit/29acb4ff3b94cefdbcfac3e2787eef50
#
# Ref.: bgfx/examples/01-cubes/cubes.cpp
# https://github.com/vaiorabbit/ruby-opengl/tree/master/sample
#
require 'rmath3d/rmath3d'
require 'opengl'
require 'glfw'
require_relative '../../bindings/ruby/bgfx.rb'
require_relative './logo.rb'
@vaiorabbit
vaiorabbit / 00_helloworld.rb
Last active May 24, 2020 10:46
00_helloworld.rb : Ruby-Bgfx port of 'helloworld.cpp' (WIP). Ref.: https://gist.github.com/vaiorabbit/29acb4ff3b94cefdbcfac3e2787eef50
#
# Ref.: bgfx/examples/00-helloworld/helloworld.cpp
# https://github.com/vaiorabbit/ruby-opengl/tree/master/sample
#
require 'opengl'
require 'glfw'
require_relative '../bindings/ruby/bgfx.rb'
require_relative './logo.rb'
OpenGL.load_lib()
@vaiorabbit
vaiorabbit / bgfx.rb
Last active May 30, 2020 07:42
WIP: bgfx.rb
require 'ffi'
#
# Typedefs
#
FFI.typedef :uint16, :Bgfx_view_id_t # [HACK] Hard-coded. Seems we can't get information about this from current 'bgfx.idl'.
FFI.typedef :int, :Bgfx_fatal_t
@vaiorabbit
vaiorabbit / launch.json
Last active February 17, 2022 07:59
VSCode settings for ruby debugging
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Local File",
"type": "Ruby",
"request": "launch",