This file contains 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
font = new Font(); | |
const int nBmpSize = Font::GetBmpSize(); | |
const int nCharSize = nBmpSize / 16; | |
// Read preferences | |
int iWidth = (bold) ? FW_BOLD : FW_DONTCARE; | |
DWORD dwItalic = (italic) ? TRUE : FALSE; | |
DWORD dwUnderline = (underline) ? TRUE : FALSE; | |
DWORD dwStrikeOut = (strikeout) ? TRUE : FALSE; |
This file contains 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
#include <iostream> | |
#include <chrono> | |
class ScopeTimer { | |
typedef std::chrono::high_resolution_clock clock; | |
typedef std::chrono::duration<float> seconds; | |
public: | |
ScopeTimer(const char* message) | |
: message_(message) | |
{ |
This file contains 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
#include <iostream> | |
#include <string> | |
const double trip_cost = 5000.0; // dollars | |
int main() | |
{ | |
// Compute exchange rate deltas (using russian trader BCS for money exchange) | |
const double e_sell_today = 69.19; | |
const double e_buy_today = 67.20; |
This file contains 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
// Enable fullscreen ability | |
NSWindowCollectionBehavior behavior = [g_window.object collectionBehavior]; | |
behavior |= NSWindowCollectionBehaviorFullScreenPrimary; | |
[g_window.object setCollectionBehavior:behavior]; | |
// Enable/disable fullscreen | |
[g_window.object toggleFullScreen:nil]; |
This file contains 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
@interface ShtilleEngineWindow : NSWindow | |
{ | |
ShtilleEngineFullscreenWindow * fullscreenWindow; | |
} | |
- (void)goFullscreen; | |
- (void)goWindow; | |
@end | |
@implementation ShtilleEngineWindow |
This file contains 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
#include <iostream> | |
#include <cmath> | |
const int kMaxLod = 20; | |
const double GetMaxLatitude() { return 90.0; } | |
const double GetMinLatitude() { return -90.0; } | |
const double GetMaxLongitude() { return 180.0; } | |
const double GetMinLongitude() { return -180.0; } | |
template <typename T> |
This file contains 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
@echo off | |
set src_folder=c:\source | |
set dst_folder=c:\destination | |
for /F "tokens=*" %%F in (list.txt) DO ( | |
xcopy "%src_folder%\%%~nxF*" "%dst_folder%\" /S /Y | |
) |
This file contains 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
template <typename T> | |
static T RoundToPowerOfTwo(T x) | |
{ | |
T n = 1; | |
while (n < x) | |
n <<= 1; | |
return n; | |
} | |
static int InterpolateColor(int c1, int c2, float alpha) | |
{ |
This file contains 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
static constexpr uint32_t crc_table[256] = { | |
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, | |
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, | |
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, | |
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, | |
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, | |
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, | |
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, | |
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, | |
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, |
This file contains 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
// Example program | |
#include <iostream> | |
#include <string> | |
#include <cmath> | |
struct vec3 { | |
vec3(float x) : x(x), y(x), z(x) {} | |
vec3(float x, float y, float z) : x(x), y(y), z(z) {} | |
vec3 operator +(const vec3& v) const { return vec3(x + v.x, y + v.y, z + v.z); } | |
vec3 operator -(const vec3& v) const { return vec3(x - v.x, y - v.y, z - v.z); } |
OlderNewer