Here is a tiny portion of the engine header (with permission from Josh Klint, author of Leadwerks):
Code: Select all
//******************************************************************************
//**** ****
//**** Leadwerks Engine 2.51 ****
//**** C/C++ Headers 2.51 ****
//**** (c) 1999-2011 Leadwerks Corporation ****
//**** http://www.leadwerks.com ****
//**** ****
//******************************************************************************
// engine.h
#pragma once
#ifndef LEADWERKS_ENGINE_H
#define LEADWERKS_ENGINE_H
#include <windows.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
namespace LE
{
extern HMODULE le_hlib;
extern double Pi;
extern int sgn(float num);
typedef float flt; // floating point type which is used by GPU
typedef flt* FP; // floating number pointer
typedef byte* BP; // byte pointer
typedef char* str; // char pointer
typedef const char* const_str; // const char pointer
// Unified syntax
typedef BP TEntity;
typedef BP TBody;
typedef BP TBuffer;
typedef BP TCamera;
typedef BP TController;
typedef BP TCorona;
typedef BP TEmitter;
typedef BP TFont;
typedef BP TFramework;
typedef BP TGroup;
typedef BP TJoint;
typedef BP TLayer;
typedef BP TLight;
typedef BP TListener;
typedef BP TMaterial;
typedef BP TMesh;
typedef BP TModel;
typedef BP TPivot;
typedef BP TScript;
typedef BP TShader;
typedef BP TSound;
typedef BP TSource;
typedef BP TSurface;
typedef BP TTerrain;
typedef BP TTire;
typedef BP TTexture;
typedef BP TVehicle;
typedef BP TWorld;
typedef FP TVector;
struct TVec2{union{struct{flt X;flt Y;};flt a[2];};}; // textureUV value
struct TVec3{union{struct{flt X;flt Y;flt Z;};flt a[3];};}; // color, vertex, etc... value
struct TVec4{union{struct{flt X;flt Y;flt Z;flt W;};flt a[4];};}; // color+alpha value
struct TVec6{union{struct{
flt X0;flt Y0;flt Z0;
flt X1;flt Y1;flt Z1;};
flt a[6];};}; // AABB
struct TVec9{union{struct{
flt A0;flt A1;flt A2;
flt B0;flt B1;flt B2;
flt C0;flt C1;flt C2;};
flt a[9];};}; // 3x3 matrix
struct TVec16{union{struct{
flt A0;flt A1;flt A2;flt A3;
flt B0;flt B1;flt B2;flt B3;
flt C0;flt C1;flt C2;flt C3;
flt D0;flt D1;flt D2;flt D3;};
flt a[16];};}; // 4x4 matrix
const flt MAX_DEC = 9999999999.9999999999;
TVec2 Vec2(flt X=0, flt Y=MAX_DEC);
TVec2 Vec2(flt X, flt Y);
TVec3 Vec3(flt X=0, flt Y=MAX_DEC, flt Z=MAX_DEC);
TVec3 Vec3(flt X, flt Y, flt Z);
TVec4 Vec4(flt X=0, flt Y=MAX_DEC, flt Z=MAX_DEC, flt W=MAX_DEC);
TVec4 Vec4(flt X, flt Y, flt Z, flt W);
TVec6 Vec6 (flt X0=0, flt Y0=MAX_DEC, flt Z0=MAX_DEC,
flt X1=MAX_DEC, flt Y1=MAX_DEC, flt Z1=MAX_DEC);
TVec6 Vec6 (flt X0, flt Y0, flt Z0,
flt X1, flt Y1, flt Z1);
TVec9 Vec9 (flt A0=0, flt A1=MAX_DEC, flt A2=MAX_DEC,
flt B0=MAX_DEC, flt B1=MAX_DEC, flt B2=MAX_DEC,
flt C0=MAX_DEC, flt C1=MAX_DEC, flt C2=MAX_DEC);
TVec9 Vec9 (flt A0, flt A1, flt A2,
flt B0, flt B1, flt B2,
flt C0, flt C1, flt C2);
TVec16 Vec16(flt A0=0, flt A1=MAX_DEC, flt A2=MAX_DEC, flt A3=MAX_DEC,
flt B0=MAX_DEC, flt B1=MAX_DEC, flt B2=MAX_DEC, flt B3=MAX_DEC,
flt C0=MAX_DEC, flt C1=MAX_DEC, flt C2=MAX_DEC, flt C3=MAX_DEC,
flt D0=MAX_DEC, flt D1=MAX_DEC, flt D2=MAX_DEC, flt D3=MAX_DEC);
TVec16 Vec16(flt A0, flt A1, flt A2, flt A3,
flt B0, flt B1, flt B2, flt B3,
flt C0, flt C1, flt C2, flt C3,
flt D0, flt D1, flt D2, flt D3);
struct TPick
{
TEntity entity;
TEntity surface;
flt X, Y, Z;
flt NX, NY, NZ;
int triangle;
int vegetationindex;
};
#ifndef LEADWERKS_NO_MATHLIB
#include "mathlib.h"
#endif
typedef int (_stdcall *TGraphics) (int, int, int, int, int);
typedef void (_stdcall *TFlip) (int);
typedef int (_stdcall *TGraphicsWidth) (void);
typedef int (_stdcall *TGraphicsHeight) (void);
typedef void (_stdcall *TEndRender) (void);
typedef int (_stdcall *TGraphicsModeExists) (int, int, int, int);
typedef int (_stdcall *TGetGraphicsVendor) (void);
typedef int (_stdcall *TGetShaderModel) (void);
typedef TBuffer (_stdcall *TCreateBuffer) (int, int, int);
typedef TBuffer (_stdcall *TBackBuffer) (void);
typedef int (_stdcall *TBufferWidth) (TBuffer);
typedef int (_stdcall *TBufferHeight) (TBuffer);
typedef void (_stdcall *TSetBuffer) (TBuffer);
typedef int (_stdcall *TMaxColorBuffers) (void);
typedef TBuffer (_stdcall *TGetColorBuffer) (TBuffer, int);
typedef TBuffer (_stdcall *TGetDepthBuffer) (TBuffer);
typedef TBuffer (_stdcall *TCreateCustomBuffer) (byte*, byte*);
typedef int (_stdcall *TSaveBuffer) (TBuffer, const_str, int);
typedef void (_stdcall *TClearBuffer) (int);
typedef void (_stdcall *TFreeBuffer) (TBuffer);
typedef TBuffer (_stdcall *TCurrentBuffer) (void);
typedef void (_stdcall *TCopyBuffer) (TBuffer, TBuffer, int);
typedef int (_stdcall *TSetColorBuffer) (TBuffer, TTexture, int, int);
typedef int (_stdcall *TSetDepthBuffer) (TBuffer, TTexture);
typedef TWorld (_stdcall *TCreateWorld) (void);
typedef void (_stdcall *TSetWorld) (TWorld);
typedef void (_stdcall *TSetWorldSize) (const TVec3&);
typedef void (_stdcall *TSetWorldCullRange) (flt, flt, flt);
typedef void (_stdcall *TClearWorld) (void);
typedef void (_stdcall *TFreeWorld) (TWorld);
typedef TWorld (_stdcall *TCurrentWorld) (void);
typedef void (_stdcall *TUpdateWorld) (float);
typedef void (_stdcall *TRenderWorld) (int);
typedef TEntity (_stdcall *TLoadScene) (const_str);
typedef TTerrain (_stdcall *TCreateTerrain) (int);
typedef int (_stdcall *TLoadTerrainHeightmap) (TTerrain, const_str);
typedef int (_stdcall *TLoadTerrainAlphamap) (TTerrain, const_str);
typedef int (_stdcall *TSaveTerrainHeightmap) (TTerrain, const_str);
typedef int (_stdcall *TSaveTerrainAlphamap) (TTerrain, const_str);
typedef void (_stdcall *TTerrainDetail) (int);
typedef void (_stdcall *TSetTerrainHeight) (TTerrain, int, int, flt);
typedef flt (_stdcall *TTerrainHeight) (TTerrain, int, int);
typedef void (_stdcall *TUpdateTerrainNormals) (TTerrain, int, int, int, int);
typedef void (_stdcall *TUpdateTerrainNormal) (TTerrain, int, int);
typedef void (_stdcall *TUpdateTerrainAlphaMap) (TTerrain, int, int, int, int);
typedef flt (_stdcall *TTerrainElevation) (TTerrain, flt, flt);
typedef void (_stdcall *TTerrainNormal) (TTerrain, flt, flt, TVec3*);
typedef void (_stdcall *TSetTerrainTexture) (TTerrain, TTexture, int, int);
typedef void (_stdcall *TSetTerrainTextureScale) (TTerrain, flt, int);
typedef void (_stdcall *TSetTerrainTextureRotation) (TTerrain, flt, int);
typedef void (_stdcall *TSetTerrainTextureMappingMode) (TTerrain, int, int);
typedef void (_stdcall *TBlendTerrainTexture) (TTerrain, int, int, flt, int);
typedef void (_stdcall *TSetTerrainTextureConstraints) (TTerrain, flt, flt, flt, flt, int);
typedef void (_stdcall *TSetVegetationShadowMode) (int);
If you want, I could send you the entire engine.h file - I have permission to do so.
I was just given permission by Josh, the author, to share the entire engine.h file with anyone - it's included with the free demo, so it's no secret.