Thank you very much for your answers.
Not tryed copy the files because i thought that if it's a new version framewerk.cpp and framewerk.h don't will work. but i will try.
Yes i found the page and i'm try the appropriate changes but i have an error.
Here is the code:
//#include "framewerk.h"
#include "engine.h"
#include <math.h>
#include <string>
#include <vector>
#include "monsterfuncs.h"
//#include <iostream>
#include <sstream>
using namespace std;
string nametext;
string picname;
int countimage=0;
#pragma warning(disable:4996)
int state;
float fb;
float fe;
int animtex;
TController player;
TMesh mirillasprite;
TMaterial mirillamat[2];
TTexture mirillatex;
TMesh telaranya1;
TTexture electrictex[5];
TTexture electrictexdot[5];
TMaterial electricmat;
//TTexture electrictex;
//TTexture electrictexdot;
string StringToInt(int number)
{
stringstream ss;//create a stringstream
ss << number;//add number to the stream
return ss.str();//return a string with the contents of the stream
//return (str)ss.c_str();
}
class Monster
{
public:
TController monstercont;
TMesh monsterent;
TVec3 monsterpos;
TVec3 monsterrot;
int monsterstate;
float mstartframe;
float mendframe;
//TMaterial monstermat;
};
vector<Monster> monsterarray;
vector<Monster>::iterator monsteriter;
void LoadTextureSeq(string name,int num)
{
string tn;
string tndot;
int n=0;
for(n=0;n!=num;n++)
{
tn="objs/monsters/DK1/";
tn+=name;
tn+=StringToInt(n+1);
tn+=".dds";
electrictex[n]=LoadTexture((str)tn.c_str());
tndot="objs/monsters/DK1/";
tndot+=name;
tndot+=StringToInt(n+1);
tndot+="dot3";
tndot+=".dds";
electrictexdot[n]=LoadTexture((str)tndot.c_str());
}
}
void UpdateTexture(int num)
{
animtex++;
if(animtex > num-1)
{
animtex=0;
}
SetMaterialTexture(electricmat,electrictex[animtex],0);
SetMaterialTexture(electricmat,electrictexdot[animtex],1);
}
void UpdateMonsters()
{
for(monsteriter=monsterarray.begin();monsteriter!=monsterarray.end();monsteriter++)
{
SlowPointEnt((*monsteriter).monstercont,player,.5);
//PointEntity((*monsteriter).monstercont,player,3,0.5f,.0f);
(*monsteriter).monsterrot=EntityRotation((*monsteriter).monstercont);
UpdateController((*monsteriter).monstercont,(*monsteriter).monsterrot.Y,0.0f,0.0f,0.0f,500);
RotateEntity((*monsteriter).monsterent,(*monsteriter).monsterrot);
PositionEntity((*monsteriter).monsterent,Vec3((*monsteriter).monsterpos.X,(*monsteriter).monsterpos.Y-1.02,(*monsteriter).monsterpos.Z));
if(KeyHit(KEY_UP))
{
if((*monsteriter).monsterstate <3)
{
monsteriter->monsterstate++;
}
else
{
monsteriter->monsterstate=0;
}
}
if(KeyHit(KEY_DOWN))
{
if((*monsteriter).monsterstate >0)
{
monsteriter->monsterstate--;
}
else
{
monsteriter->monsterstate=3;
}
}
switch ((*monsteriter).monsterstate)
{
case 1:
monsteriter->mstartframe=41.0f;
monsteriter->mendframe=85.0f;
break;
case 2:
monsteriter->mstartframe=90.0f;
monsteriter->mendframe=117.0f;
break;
case 3:
monsteriter->mstartframe=149.0f;
monsteriter->mendframe=184.0f;
break;
default:
monsteriter->mstartframe=1.0f;
monsteriter->mendframe=40.0f;
break;
}
AnimeEntitySeq((*monsteriter).monsterent,(*monsteriter).mstartframe,(*monsteriter).mendframe,3.0f,100.0f);
//PaintEntity((*monsteriter).monsterent,electricmat);
}
}
float IntToFloat1(int n)
{
return(float(float(n)/float(255.0)));
}
TVec4 StringToVec4(string s, int noconv=0)
{
flt a[4], cf=0;
int p=0, q=0, i=0, ci=0;
string c;
if(s.length()>0)
{
while(p<=(signed)s.length())
{
q=p+1;
p=(s+" ").find(" ",q)+1;
c=s.substr(q-1,p-q);
if((c.find(".")!=-1)|(noconv))
{
sscanf(c.c_str(),"%f",&cf);
a[i]=cf;
}
else
{
sscanf(c.c_str(),"%d",&ci);
a[i]=IntToFloat1(ci);
}
i++;
}
}
return(Vec4(a[0],a[1],a[2],a[3]));
}
void ProcessSceneObjects(TEntity scene)
{
TEntity ent;
TModel entmesh;
TVec3 entpos;
string s="";
string cname;
string cname2;
TVec4 color;
int intensity;
//TMaterial doormat;
for (int i = 1; i <= CountChildren(scene); i++)
{
ent = GetChild(scene,i);
cname=GetEntityKey(ent,"classname","");
if(cname=="room")
{
EntityType(ent,2);
}
if(cname=="playerstart")
{
PositionEntity(player,EntityPosition(ent));
}
}
}
int main( int argn, char* argv[] )
{
int screenx=1280, screeny=960, camx=screenx/2, camy=screeny/2;
Initialize() ;
//Create a graphics context
Graphics(screenx,screeny);
TFramework framework=CreateFramework();
TLayer layer = GetFrameworkLayer(0);
TCamera cam=GetLayerCamera(layer);
PositionEntity(cam,Vec3(0,0,0));
TListener listener=GetFrameworkListener();
EntityParent(listener,cam);
//Set Lua variable
BP L=GetLuaState();
lua_pushobject(L,framework);
lua_setglobal(L,"fw");
lua_pop(L,1);
// Setup Initial Post Processing FX
SetGodRays(1);
SetHDR(0);
SetSSAO(1);
SetBloom(0);
SetAntialias(1);
SetStats(2);
// Setup Collisions
Collisions(1, 1, 1);
Collisions(1, 2, 1);
Collisions(1, 3, 1);
Collisions(2, 2, 1);
Collisions(2, 3, 1);
Collisions(3, 3, 1);
Monster m;
m.monstercont=CreateController(2.7f,0.9f,0.25f,45);
//GetFrameworkLayer(1);
m.monsterent=LoadMesh("objs/monsters/DK1/Material4/dk1.gmf");
//GetFrameworkLayer(0);
m.monsterrot=Vec3(0.0f,0.0f,0.0f);
m.monsterpos=Vec3(0.0f,1.5f,-2.0f);
m.monsterstate=0;
RotateEntity(m.monstercont,m.monsterrot);
RotateEntity(m.monsterent,m.monsterrot);
PositionEntity(m.monstercont,m.monsterpos);
PositionEntity(m.monsterent,m.monsterpos);
EntityType(m.monstercont,2);
SetBodyMass(m.monstercont,80.0f);
//electricmat=LoadMaterial("objs/monsters/DK1/electric1.mat");
//PaintEntity(m.monsterent,electricmat);
monsterarray.push_back(m);
int sequence=1;
float framebegin;
float frameend;
float frame;
////Load Texture Seq
//LoadTextureSeq("electric",5);
//Create a physics body
TBody body=CreateBodyBox();
SetBodyMass(body,10.0f);
TMesh mesh=CreateCube();
EntityParent(mesh,body);
PositionEntity(body,Vec3(-6,5,0));
EntityType(body,2);
TMaterial meshmat=LoadMaterial("objs/Pruebas/a1.mat");
PaintEntity(mesh,meshmat);
//Create another physics body
TModel oildrum=LoadModel("scene/oildrum.gmf");
PositionEntity(oildrum,Vec3(6,5,0));
EntityType(oildrum,2);
SetBodyMass(oildrum,10.0f);
player=CreateController(1.84f,0.50f,0.5f,45);
//player=CreateController(1.84f,0.50f,0.5f,45);
EntityType(player,1);
//SetBodyDamping(player,.5f,.5f);
SetBodyMass(player,60.0f);
//SetWorldGravity(Vec3(0,-9.8f,0));
float move=0.0;
float strafe=0.0;
bool crouch=0;
float cameraheight=1.74f;
TVec3 camrotation=Vec3(0);
TVec3 playerpos;
float mx=0;
float my=0;
HideMouse();
//MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
MoveMouse(camx,camy);
PositionEntity(player,Vec3(0.0f,3.0f,-3.0f));
GetFrameworkLayer(1);
mirillasprite=LoadMesh("Sprites/simplesprite1.gmf",GetLayerCamera(layer));
mirillamat[0]=LoadMaterial("Sprites/white.mat");
mirillamat[1]=LoadMaterial("Sprites/green.mat");
mirillatex=mirillamat[0];
PaintEntity(mirillasprite,mirillatex);
PositionEntity(mirillasprite,Vec3(0,0,0.15));
ScaleEntity(mirillasprite,Vec3(.08f,.08f,1.0f));
telaranya1=LoadMesh("Sprites/simplesprite2.gmf");
ScaleEntity(telaranya1,Vec3(2.0f,2.0f,1.0f));
PositionEntity(telaranya1,Vec3(3.0f,1.5f,.0f));
RotateEntity(telaranya1,Vec3(.0f,45.0f,.0f));
GetFrameworkLayer(0);
LoadScene("scene/prueba5.sbx");
int debphy=0;
//Main loop
// Game loop
while( !KeyHit(KEY_ESCAPE) && !AppTerminate() )
{
if( !AppSuspended() ) // We are not in focus!
{
if(KeyHit(KEY_P)){debphy=1-debphy;DebugPhysics(debphy);}
move=(KeyDown(KEY_W)-KeyDown(KEY_S));
strafe=(KeyDown(KEY_D)-KeyDown(KEY_A));
//Jumping
float jump=0.0;
if (KeyHit(KEY_SPACE)) {
if (!ControllerAirborne(player)) {
jump=4.0;
}
}
//Run
if (KeyDown(KEY_LSHIFT)||KeyDown(KEY_RSHIFT)) {
if (!ControllerAirborne(player)) {
move/=2.0;
strafe/=2.0;
}
}
//crouch
if (KeyHit(KEY_C)){
//if (ControllerCrouched(player)){
if (crouch==1){
crouch=0;
cameraheight=1.74f;
}
else{
crouch=1;
cameraheight=0.80f;
}
}
playerpos=EntityPosition(player);
//Camera looking
mx=Curve(MouseX()-GraphicsWidth()/2,mx,6);
my=Curve(MouseY()-GraphicsHeight()/2,my,6);
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);
camrotation.X=camrotation.X+my/5.0;
if (camrotation.X < -90){ camrotation.X = -90;}
if (camrotation.X > 90){ camrotation.X = 90;}
camrotation.Y=camrotation.Y-mx/5.0;
RotateEntity(cam,camrotation);
////Set controller input
UpdateController(player,camrotation.Y,move*3.0,strafe*3.0,jump,500,1,crouch);
PositionEntity(cam,Vec3(playerpos.X,playerpos.Y+cameraheight,playerpos.Z));
TVec3 camerapos=EntityPosition(cam);
TVec3 poscont=EntityPosition(player);
if(MouseDown(2))
{
mirillatex=mirillamat[1];
}
else
{
mirillatex=mirillamat[0];
}
GetFrameworkLayer(1);
PaintEntity(mirillasprite,mirillatex);
GetFrameworkLayer(0);
UpdateAppTime();
UpdateWorld(AppSpeed()) ;
PositionEntity(cam,camerapos);
//UpdateTexture(5);
UpdateMonsters();
UpdateFramework();
RenderFramework();
if(KeyHit(KEY_F1)) // Press F1 to save a screenshot
{
countimage+=1;
picname="Pics/ScreenShoot_";
picname+=StringToInt(countimage);
picname+=".jpg";
char fn[32] = {0};
_snprintf(fn, 31, (str)picname.c_str(), GetTickCount());
SaveBuffer(BackBuffer(), fn, 100);
}
// Send to screen
Flip(0) ;
}
}
//// Done
////exitapp:
FreeFramework(framework);
return Terminate() ;
}
and the error (it's not an error but it appears in the engine text):
Leadwerks Engine 2.40
Initializing Renderer...
OpenGL Version: 3.0.0
GLSL Version: 1.30 NVIDIA via Cg compiler
Render device: GeForce 9800 GT/PCI/SSE2
Vendor: NVIDIA Corporation
DrawBuffers2 supported: 1
32 texture units supported.
GPU instancing supported: 1
Max batch size: 64
Shader model 4.0 supported: 1
Conditional render supported: 0
Error: Shader file "abstract::query.vert" not found.
i don't know what is that file because i never had that error before. Thank you