Jump to content

GameLib Templates for LEBuilder


Canardia
 Share

Recommended Posts

File Name: GameLib Templates for LEBuilder

File Submitter: Metatron

File Submitted: 04 Sep 2011

File Category: C++

 

Contains the following LEBuilder templates:


  •  
  • GameLib Cube

 

Click here to download this file

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

The GameLib Cube template produces a source code like this:

 

The idea behind the new overridable methods in the Application class is, that you can use the built-in default methods, then you don't have to code anything, or you can override them partially or fully as you like.

For example the Run method is the whole main loop, which can be overridden, or you can start with overriding parts of it, which are the RenderActive, RenderSuspended methods, or you can even override those partially by overriding the contained RenderActive3D, RenderActive2D, RenderSuspended3D, RenderSuspended2D methods.

 

Cube4.h

#pragma once
#include "GameLib.h"			// GameLib
#define APPNAME	"Cube4"
#define APPVER	"0.0.0.0"

class Cube4 : public Application
{
public:
Cube4(int argc, char* argv[]);	// Constructor
void RenderActive3D();		// Overridden 3D rendering
void RenderActive2D();		// Overridden 2D rendering
Cube cube, ground;		// Create cube and ground
void Load();			// Overridden scene loading and population stuff
Material material;		// Material for cube and ground
DirectionalLight sun;		// Create sun
};

Cube4.cpp

#include "Cube4.h"

Cube4::Cube4(int argc, char* argv[]):
Application("data",APPNAME" "APPVER)
{
// TODO: Add stuff here which is done once per application launch
}

void Cube4::Load()
{
game.scene.cam.Move(0,0,-2);
sun.Turn(Vec3(45));
material.Load("Models/CobbleStones/CobbleStones.mat");
cube.Paint(material);
ground.Paint(material);
ground.Scale(Vec3(10,1,10));
ground.SetPosition(Vec3(0,-2,0));
}

void Cube4::RenderActive3D()
{
if(Keyboard::I****()) Quit();
double n=AppSpeed();
cube.Turn(n,n*2,0);
}

void Cube4::RenderActive2D()
{
Draw::Text(50,50,"%0.0f",FPS());
}

RunClass(Cube4);

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...