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
| size_t len = strlen(path); | |
| assert(len < MAX_STRLEN); | |
| len = MIN(len, MAX_STRLEN); | |
| if (len < 1) | |
| return; | |
| strncpy(be->fs->path, path, len); | |
| be->fs->path[len-1] = 0; |
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
| // Source code to Pieballs in Processing 3 | |
| // by Michael Labbe @frogtoss | |
| // | |
| // Reverse engineered after watching a similar video by @scienceporn | |
| // | |
| // Download processing at http://processing.org | |
| // Paste code in the window and run! | |
| // | |
| // Source is released into the public domain. |
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
| import os | |
| import shutil | |
| import os.path | |
| class AppleBundle: | |
| def __init__(self, app_name, exe_path, icon_path, version_tuple=('1','0','0')): | |
| self.app_name = app_name | |
| self.exe_path = exe_path | |
| self.icon_path = icon_path |
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
| /* detect target enviroment bits */ | |
| #if _WIN64 | |
| # define FTG_BITS 64 | |
| #elif _WIN32 | |
| # define FTG_BITS 32 | |
| #endif | |
| #if __GNUC__ | |
| # if __x86_64__ || __ppc64__ | |
| # define FTG_BITS 64 |
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
| // usage: FTG_STATIC_ASSERT(1==0) | |
| // error message contains "assertion_at_line_xxx" | |
| // | |
| // usage: FTG_STATIC_ASSERT_MSG(1==0, one_is_not_zero) | |
| // error message contains: "one_is_not_zero" | |
| // | |
| // tested on GCC, Clang, MSVC 98 and MSVC 2015 | |
| // | |
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
| // My goal is to perform endian detect in the preprocessor without | |
| // breaking C89 compatibility. YES, I know how rare big endian is in 2016. I don't care. | |
| #if (0xFF<<8) & 65280 | |
| # define LITTLE_ENDIAN | |
| #else | |
| # define BIG_ENDIAN | |
| #endif |
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
| CC=/usr/bin/gcc | |
| if [[ $# -gt 0 ]] | |
| then | |
| CC=$1 | |
| fi | |
| touch ___temp.c | |
| $CC -dM -E ___temp.c | |
| rm ___temp.c |
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
| /* append num strings, returning heap-allocated string. | |
| caller must free() returned ptr. */ | |
| char * | |
| ftg_strcatall(size_t num, ...) | |
| { | |
| size_t i, alloc_size = 0; | |
| va_list va1, va2; | |
| char *buf, *p_buf; | |
| va_start(va1, num); |
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
| /* returns true if the dir or file exists */ | |
| FTGDEF bool | |
| ftg_path_exists(const char *path) | |
| { | |
| #ifdef FTG_POSIX_LIKE | |
| return access(path, F_OK) != -1; | |
| #elif defined(_WIN32) | |
| ftg_wchar_t u8_path[MAX_PATH]; | |
| DWORD attrib; | |
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
| /* ftg_core.h - v0.5 - Frogtoss Toolbox. Public domain-like license below. | |
| ftg libraries are copyright (C) 2015 Frogtoss Games, Inc. | |
| http://github.com/mlabbe/ftg_toolbox | |
| ftg header files are single file header files intended to be useful | |
| in C/C++. ftg_core contains generally useful functions | |
| Special thanks to STB for the inspiration. |