Skip to main content
gamedev.net
🔒 Locked

engine interface?

Started by McZ May 14, 2003 at 4:16 AM 1 replies 500+ views
Original Post
McZ
McZ
how does your engine interface look like? in my winmain(...) I have it like this:
  

cEngine3D *Engine;
cWorld    *World;
cMyFrameListener *MyFrameListener;

winmain(...)
{
 Engine = cEngine3D::Create(); // create the singleton class.


 Engine->SetRenderer(USE_GL);  // choose a renderer to use


 // Creates a standard world (WT_STANDARD) using objects

 // Will create different world types later, using BSP 

 // or something else.

 World = Engine->CreateWorld(WT_STANDARD); 
 
 // This is a class that will be called from the render loop

 // every frame to update the object position and other stuff.

 World->AttachFrameListener( MyFrameListener );

 Engine->InitRenderSystem(); // enable rendersystem

 Engine->Start(); // Starts the renderloop


 // Windows message loop

 ...

 Engine->ShutDown();
}
  
is there anything else that could be usefull? the World class gives you access to an object manager, Light manager and a camera manager. frame listener example, Init() function will be called when the frame listener is attach to the world. The Update() function will be called every frame.
  
cMyFrameListener::Init(void)
{
 cCamera *Camera = new cCamera;
 Camera->SetPosition(...);
 Camera->SetLookat(...);
 World->AddCamera( Camera );

 cObject *Cube = new cObject;
 cObject *SpaceShip = new cObject;

 Cube->CreateCube(10.0f, 10.0f, 10.0f); // use buildt in function to create a cube.


 SpaceShip->Load("spaceship.mob"); // load my own object file type.


 // loads material to current object

 Cube->LoadMaterial("logo.mat"); 
 SpaceShip->LoadMaterial("ShinyRed.mat");

}

cMyFrameListener::Update(void)
{
 // Updates the object.

 Cube->m_Rotation.x += 1.9f;
}
  
treething
treething
quote:

is there anything else that could be usefull?


Umm, that depends on what youre trying to do.

Is that the OGRE engine that you''re using?
McZ
McZ
quote:
Original post by treething
[quote]
is there anything else that could be usefull?


Umm, that depends on what youre trying to do.

Is that the OGRE engine that you''re using?

no it is my own engine.. but I got the FrameListener idea from Ogre the problem is that I don''t get everything to work the way I want Ogre has different Scene managers (in my engine it is the world manager) that manage different types of scenes, Outside, Inside and a Generic one.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.