initial
This commit is contained in:
73
public/examples/toolframeworkdemo/runtimedemo1.h
Normal file
73
public/examples/toolframeworkdemo/runtimedemo1.h
Normal file
@@ -0,0 +1,73 @@
|
||||
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef RUNTIMEDEMO1_H
|
||||
#define RUNTIMEDEMO1_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "materialsystem/materialsystemutil.h"
|
||||
#include "tier1/utlvector.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Initial state: Quad rendering library
|
||||
// Contains two main classes; First is a quad
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadV1
|
||||
{
|
||||
public:
|
||||
CQuadV1() { m_x0 = m_x1 = m_y0 = m_y1 = 0; m_Color.r = m_Color.g = m_Color.g = m_Color.a = 255; }
|
||||
|
||||
int m_x0;
|
||||
int m_x1;
|
||||
int m_y0;
|
||||
int m_y1;
|
||||
color32 m_Color;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Second main class is the manager which contains a list of quads
|
||||
// to render and the code to do the rendering
|
||||
// It's usually a good idea to start with the run-time implementation
|
||||
// because it will impose the most constraints on the data and therefore
|
||||
// on how the editor should work
|
||||
//
|
||||
// Should the runtime lib be a static lib or a DLL?
|
||||
// It needs to be a DLL if it needs to have global state which is accessible
|
||||
// across many other DLLs. There are some advantages to having it be a static
|
||||
// lib, however: for example, some editors, like the particle system, use
|
||||
// the runtime lib to render the preview. In this case, you want to have it
|
||||
// be a static lib so that the editor + the game have different notions about
|
||||
// what data is associated with the particle systems.
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadManagerV1
|
||||
{
|
||||
public:
|
||||
// Init, shutdown
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
// Quad management
|
||||
CQuadV1* AddQuad( );
|
||||
void RemoveQuad( CQuadV1* pQuad );
|
||||
void RemoveAllQuads();
|
||||
|
||||
// Quad rendering
|
||||
void DrawQuads();
|
||||
|
||||
private:
|
||||
CUtlVector< CQuadV1 * > m_Quads;
|
||||
CMaterialReference m_Material;
|
||||
};
|
||||
|
||||
extern CQuadManagerV1 *g_pQuadManagerV1;
|
||||
|
||||
#endif // RUNTIMEDEMO1_H
|
||||
70
public/examples/toolframeworkdemo/runtimedemo2.h
Normal file
70
public/examples/toolframeworkdemo/runtimedemo2.h
Normal file
@@ -0,0 +1,70 @@
|
||||
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef RUNTIMEDEMO2_H
|
||||
#define RUNTIMEDEMO2_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "materialsystem/materialsystemutil.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "dmxloader/dmxelement.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Demo 2: Loads from a DMX
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadV2
|
||||
{
|
||||
// NOTE: This is necessary to allow the fast dmx unpacker to work
|
||||
DECLARE_DMXELEMENT_UNPACK();
|
||||
|
||||
public:
|
||||
CQuadV2() { m_x0 = m_x1 = m_y0 = m_y1 = 0; m_Color.r = m_Color.g = m_Color.g = m_Color.a = 255; }
|
||||
|
||||
int m_x0;
|
||||
int m_x1;
|
||||
int m_y0;
|
||||
int m_y1;
|
||||
color32 m_Color;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Demo 2: Loads from a DMX
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadManagerV2
|
||||
{
|
||||
// NEW METHODS FOR DEMO 2
|
||||
public:
|
||||
// Loads from a DMX file
|
||||
bool Unserialize( CUtlBuffer &buf );
|
||||
|
||||
// OLD METHODS FROM DEMO 1
|
||||
public:
|
||||
// Init, shutdown
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
// Quad management
|
||||
CQuadV2* AddQuad( );
|
||||
void RemoveQuad( CQuadV2* pQuad );
|
||||
void RemoveAllQuads();
|
||||
|
||||
// Quad rendering
|
||||
void DrawQuads();
|
||||
|
||||
private:
|
||||
CUtlVector< CQuadV2 * > m_Quads;
|
||||
CMaterialReference m_Material;
|
||||
};
|
||||
|
||||
extern CQuadManagerV2 *g_pQuadManagerV2;
|
||||
|
||||
#endif // RUNTIMEDEMO2_H
|
||||
67
public/examples/toolframeworkdemo/runtimedemo3.h
Normal file
67
public/examples/toolframeworkdemo/runtimedemo3.h
Normal file
@@ -0,0 +1,67 @@
|
||||
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef RUNTIMEDEMO3_H
|
||||
#define RUNTIMEDEMO3_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "materialsystem/materialsystemutil.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "dmxloader/dmxelement.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Nothing in this file changed from Demo 2
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadV3
|
||||
{
|
||||
// NOTE: This is necessary to allow the fast dmx unpacker to work
|
||||
DECLARE_DMXELEMENT_UNPACK();
|
||||
|
||||
public:
|
||||
CQuadV3() { m_x0 = m_x1 = m_y0 = m_y1 = 0; m_Color.r = m_Color.g = m_Color.g = m_Color.a = 255; }
|
||||
|
||||
int m_x0;
|
||||
int m_x1;
|
||||
int m_y0;
|
||||
int m_y1;
|
||||
color32 m_Color;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Quad manager class
|
||||
//-----------------------------------------------------------------------------
|
||||
class CQuadManagerV3
|
||||
{
|
||||
public:
|
||||
// Init, shutdown
|
||||
void Init();
|
||||
void Shutdown();
|
||||
|
||||
// Loads from a DMX file
|
||||
bool Unserialize( CUtlBuffer &buf );
|
||||
|
||||
// Quad management
|
||||
CQuadV3* AddQuad( );
|
||||
void RemoveQuad( CQuadV3* pQuad );
|
||||
void RemoveAllQuads();
|
||||
|
||||
// Quad rendering
|
||||
void DrawQuads();
|
||||
|
||||
private:
|
||||
CUtlVector< CQuadV3 * > m_Quads;
|
||||
CMaterialReference m_Material;
|
||||
};
|
||||
|
||||
extern CQuadManagerV3 *g_pQuadManagerV3;
|
||||
|
||||
#endif // RUNTIMEDEMO3_H
|
||||
Reference in New Issue
Block a user