Skip to content

Instantly share code, notes, and snippets.

Wonder Boy: The Dragon's Trap
-----------------------------
Quick Guide for programmers
Last updated October 2018
Contact: Omar Cornut <XXXXXX
===============================================
INDEX
===============================================
// Test helper for imgui_freetype
#include "misc/freetype/imgui_freetype.h"
struct FreeTypeTest
{
enum FontBuildMode { FontBuildMode_FreeType, FontBuildMode_Stb };
FontBuildMode BuildMode = FontBuildMode_FreeType;
bool WantRebuild = true;
@ocornut
ocornut / dualshock4_via_directinput.cpp
Last active October 13, 2020 12:05
// Mapping for PlayStation 4 DualShock 4 (PS4, DS4) controller exposed via DirectInput
// FYI the numbers here don't make much sense out of context
// I am using https://github.com/ThemsAllTook/libstem_gamepad which remaps xinput and dinput states to arrays of button + arrays of axises.
// So those are my tables to read back from them and handle DS4 which provide dinput data.
// The PAD_*** enums are mine, the AXIS_*** enums tells which remapping function to use on the float data.
// You may prefer to handle the axises data in a different manner (e.g. some people like the analog trigger to go -1 to +1, I'm using 0 to 1).
// This is merely a loose reference to get you started if you want to support DS4 in your application.
// Mapping for PlayStation 4 DualShock 4 (PS4, DS4) controller exposed via DInput.
// VendorId = 0x0000054C, ProductId = 0x000009CC
static const GamePadMappingEntry g_DInputDS4Mapping[] =
// My game is using a Japanese font that doesn't seem to declare codepoint for Kanjis for those which only comprised of a simple radical.
// e.g. https://en.wikipedia.org/wiki/Radical_180
// Radical 180 (U+2FB3) ~~ 音 (U+97F3)
// I am remapping the codepoints in software but couldn't find an easy to parse list, ended up scraping from Unicode webpages
{ 0x4E00, 0x2F00 }, // Kangxi Radical One
{ 0x4E28, 0x2F01 }, // Kangxi Radical Line
{ 0x4E36, 0x2F02 }, // Kangxi Radical Dot
{ 0x4E3F, 0x2F03 }, // Kangxi Radical Slash
{ 0x4E59, 0x2F04 }, // Kangxi Radical Second

Common game localizations https://docs.google.com/spreadsheets/d/135HgMYcRDt6vnJN0d-xFMEZUeWjVbc61ETf8uVwHERE/edit#gid=339250473

Polyglot Gamedev Project : Master Sheet 0.9.0 https://docs.google.com/spreadsheets/d/17f0dQawb-s_Fd7DHgmVvJoEGDMH_yoSd8EYigrb0zmM/edit#gid=310116733

Game UI common translation https://docs.google.com/spreadsheets/d/197GYEhPpk0DQTEO0r80v_k_bkGVtUgBB08PP--hqCIA/edit#gid=0

Raw text files containing characters used in different languages such as English, French, German, Chinese, Japanese, Korean.

// pie menu test
// v0.00
#include <imgui_internal.h>
// Return >= 0 on mouse release
// Optional int* p_selected display and update a currently selected item
int PiePopupSelectMenu(const ImVec2& center, const char* popup_id, const char** items, int items_count, int* p_selected)
{
int ret = -1;

Last updated 2020/03/04

Some links from twitter on the topic of parsing PSD files (haven't looked into them in details). PSD include a flattened rasterized image so this is easy to load if that's the only thing you need. Most software / librairies have support for extracting this flattened data (e.g. stb_image.h does).

However if you want access to individual layers, render non-rasterized layers, emulate every photoshop features, extract or apply effects with more granularity, more code is needed. May range from easy to lots-of-work depending on what exactly you need.

As far as I know there isn't a trivial stb-like ready-to-use C++ library to do that sort of things. Posting all links here. Some are probably bloated or hard to use into your project, some lacking features.

TODO: Actually look into the pros/cons of all those.

@ocornut
ocornut / rrbits.h
Last active January 6, 2019 22:04 — forked from anonymous/rrbits.h
// Copyright 2008-2015 RAD Game Tools
#ifndef RADRR_BITSH
#define RADRR_BITSH
#include "radtypes.h"
RADDEFSTART
//===================================================================================