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
int32 GuardedMain( ... ) | |
{ | |
// make sure GEngineLoop::Exit() is always called. | |
struct EngineLoopCleanupGuard | |
{ | |
~EngineLoopCleanupGuard() | |
{ | |
EngineExit(); | |
} | |
} CleanupGuard; |
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
int32& FIOSAudioDevice::GetSuspendCounter() | |
{ | |
static int32 SuspendCounter = 0; | |
return SuspendCounter; | |
} | |
void FIOSAudioDevice::ResumeContext() | |
{ | |
int32& SuspendCounter = GetSuspendCounter(); | |
... |
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
enum Animals { Bear, Cat, Chicken }; | |
//enum Birds { Eagle, Duck, Chicken }; // error! | |
enum class Fruits { Apple, Pear, Orange }; | |
enum class Colours { Blue, White, Orange }; // no problem! | |
Colours r = Colours::Orange; | |
// int n = r; // error ! | |
int n = static_cast<int>(r); // OK, n = 2 |
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 <memory> | |
std::weak_ptr<int> gw; | |
void f() | |
{ | |
// Has to be copied into a shared_ptr before usage | |
if (auto spt = gw.lock()) { | |
std::cout << *spt << "\n"; |
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
#pragma pack(1) | |
struct s_t { // sizeof s_t = 11 | |
char a; // offset = 0, align = 1 | |
int b; // offset = 1, align = 1 | |
short c; // offset = 5, align = 1 | |
int d; // offset = 7, align = 1 | |
}S; | |
#pragma pack() | |
struct s_t { // sizeof s_t = 11 |
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
class B { | |
friend class A; | |
private: | |
int i; | |
}; | |
class A { | |
public: | |
A(B b) { |
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
------------------------------------------------------------------ | |
Technology | |
(Ordered by how close to my current task - OpenGL Optimization) | |
------------------------------------------------------------------ | |
* OpenGL ES 3.0 Programming Guide | |
* Interactive 3D Graphics : Udacity | |
+ 3D Math Primer for Graphics and Game Development | |
+ Computer Graphics - Principles and Practice (Third Edition) | |
+ Mathematics for 3D Game Programming and Computer Graphics |
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
float Interpolate( float normalizedValue, float begin, float end ) | |
{ | |
// first check input values | |
assert( normalizedValue >= 0.0f ); | |
assert( normalizedValue <= 1.0f ); | |
assert( end > begin ); | |
return ( normalizedValue * ( end - begin ) ) + begin; | |
} |
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
typedef std::list< shared_ptr< IScreenElement > > ScreenElementList; | |
class HumanView : public IGameView | |
{ | |
protected: | |
GameViewI m_ViewId; | |
optional< ActorId > m_ActorId; | |
// this CProcessManager is for things like button animations, etc. | |
CProcessManager * m_pProcessManager; |
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
package main | |
import ( | |
"golang.org/x/tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
ret := map[string]int{} | |
OlderNewer