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 <windows.h> | |
#include <d3d9.h> | |
#include <iostream> | |
#pragma comment(lib, "d3d9.lib") | |
int main() | |
{ | |
::D3DPERF_SetOptions(1); | |
std::cout << "Good job!\n" << std::endl; | |
} |
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
while (!::IsDebuggerPresent()) | |
{ | |
::Sleep(100); | |
} | |
::DebugBreak(); |
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
const size_t CUBE_SIZE = 16; | |
std::vector<float> red(CUBE_SIZE); | |
std::vector<float> green(CUBE_SIZE); | |
std::vector<float> blue(CUBE_SIZE); | |
for (size_t i = 0; i < CUBE_SIZE; ++i) | |
{ | |
float input = (float)i / (float)(CUBE_SIZE - 1); | |
float input255 = input * 255.0f; |
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
if (viewListener->GetTextureId() <= 0) | |
{ | |
material = gEnv->p3DEngine->GetMaterialManager()->FindMaterial("materials/placeholder_1280_720"); | |
if (material) | |
{ | |
const STexSamplerRT& sampler = material->GetShaderItem().m_pShaderResources->GetTexture(EFTT_DIFFUSE)->m_Sampler; | |
const int texId = sampler.m_pITex->GetTextureID(); | |
viewListener->SetTextureId(texId); | |
} |
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> | |
#define LIBAPI __declspec(dllexport) | |
#define LIBSTDCALL __stdcall | |
struct SimpleStruct | |
{ | |
SimpleStruct() : Value(0) {} | |
operator int () |
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
using System; | |
using System.Runtime.InteropServices; | |
namespace Executable | |
{ | |
struct SimpleStruct | |
{ | |
public SimpleStruct(int value) | |
{ | |
Value = value; |
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
public class AutomaticBinding : MonoBehaviour { | |
[Coherent.UI.CoherentMethod("ApplyOptions", false)] | |
public void ApplyOptions(GameOptions options) | |
{ | |
// Do something with options | |
} | |
} |
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
public class ManualBinding : MonoBehaviour { | |
private CoherentUIView m_View; | |
// Use this for initialization | |
void Start () { | |
m_View = GetComponent<CoherentUIView>(); | |
m_View.Listener.ReadyForBindings += HandleReadyForBindings; | |
} | |
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
bool CGame::Init(IGameFramework *pFramework) | |
{ | |
// Initialize Coherent UI | |
PluginManager::IPluginBase* pCoherentUIPlugin = gPluginManager->GetPluginByName("CoherentUI"); | |
m_pCoherentUIPlugin = static_cast<CoherentUIPlugin::IPluginCoherentUI*>(pCoherentUIPlugin ? pCoherentUIPlugin->GetConcreteInterface() : NULL); | |
if (m_pCoherentUIPlugin) | |
{ | |
m_pCoherentUIPlugin->InitializeSystem(); | |
} | |
} |
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
void CGame::OnActionEvent(const SActionEvent& event) | |
{ | |
switch(event.m_event) | |
{ | |
... | |
case eAE_inGame: | |
if (m_pCoherentUIPlugin) | |
{ |
OlderNewer