Error 1 error LNK2001: unresolved external symbol "public: virtual void __thiscall IRoom::setup(class irr::video::IVideoDriver *,class irr::IrrlichtDevice *,int,int)" (?setup@IRoom@@UAEXPAVIVideoDriver@video@irr@@PAVIrrlichtDevice@4@HH@Z) Room1.obj
Error 2 error LNK2001: unresolved external symbol "public: virtual void __thiscall IRoom::render(int,int)" (?render@IRoom@@UAEXHH@Z) Room1.obj
Error 3 error LNK2001: unresolved external symbol "public: virtual struct IRoom::roomLoad __thiscall IRoom::loadRoom(void)" (?loadRoom@IRoom@@UAE?AUroomLoad@1@XZ) Room1.obj
Error 4 error LNK2019: unresolved external symbol "public: virtual __thiscall IRoom::~IRoom(void)" (??1IRoom@@UAE@XZ) referenced in function "public: virtual void * __thiscall IRoom::`scalar deleting destructor'(unsigned int)" (??_GIRoom@@UAEPAXI@Z) Room1.obj
Error 5 fatal error LNK1120: 4 unresolved externals bin\Adventure-debug.exe
Room1.h
Code: Select all
#include "Room.h"
#include <irrlicht.h>
class Room1 : public IRoom{
public:
irr::video::IVideoDriver* driver;
irr::video::ITexture* doorImages[30];
irr::video::ITexture* image;
irr::video::ITexture* player;
irr::IrrlichtDevice *device;
int DoorFrameNumber;
double playerX ;
double playerY ;
int oldTime;
Room1();
~Room1();
void setup(irr::video::IVideoDriver* driverLink,irr::IrrlichtDevice *deviceLink,int PlayerX,int PlayerY);
void render(int MoveX,int MoveY);
IRoom::roomLoad loadRoom();
};
#endif
Code: Select all
#include "room1.h"
#include <irrlicht.h>
Room1::Room1(){
}
Room1::~Room1(){
}
void Room1::setup(irr::video::IVideoDriver* driverLink,irr::IrrlichtDevice *deviceLink,int newPlayerX,int newPlayerY ){
//155,614
driver=driverLink;
device=deviceLink;
DoorFrameNumber = 0;
image = driver->getTexture("media/0001.png");
player = driver->getTexture("media/player.bmp");
for(int i=1;i<31;i++){
irr::core::stringc doorImageStr = "media/00";
if(i < 10){
doorImageStr.append("0");
}
irr::core::stringc number (i);
doorImageStr.append(number.c_str() );
doorImageStr.append("-cropped.png");
doorImages[i-1] = driver->getTexture(doorImageStr);
}
playerX=newPlayerX;
playerY=newPlayerY;
oldTime = device->getTimer()->getTime();
}
void Room1::render(int MoveX,int MoveY){
const irr::f32 MOVEMENT_SPEED = 100.f;
irr::u32 newTime = device->getTimer()->getTime();
irr::u32 time = newTime-oldTime;
oldTime = newTime;
irr::core::rect<irr::s32> playerCrop(0,0,128,128);
if(time < 100){
if(playerY <520 && playerX > 270 && playerX < 760 ){
DoorFrameNumber=DoorFrameNumber+time;
}else{
DoorFrameNumber=DoorFrameNumber-time;
}
if(DoorFrameNumber < 0){
DoorFrameNumber = 0;
}else if(DoorFrameNumber > 1500){
DoorFrameNumber = 1500;
}
const irr::f32 frameDeltaTime = (irr::f32)(time) / 1000.f * MOVEMENT_SPEED; // Time in seconds
playerX += frameDeltaTime*MoveX;
playerY += frameDeltaTime*MoveY;
if(playerY < 378){
if(playerX < 467){playerX=467;}else if(playerX > 584){playerX=584;}
}
if(playerX < 0){playerX = 0;} else if(playerX > 1072){playerX =1072; }
if(playerX > 466 && playerX < 586 && playerY < 380){
if(playerY < 256){playerY = 256;}
playerCrop.UpperLeftCorner.Y =380-playerY;
}else{
if(playerY < 380){playerY = 380;} else if(playerY > 672 ){playerY =672; }
}
}
irr::u32 actualDoorImage = DoorFrameNumber / 50;
if (actualDoorImage >29){
actualDoorImage = 59-actualDoorImage;
}
driver->draw2DImage(image, irr::core::position2d<irr::s32>(0,0));
driver->draw2DImage(doorImages[actualDoorImage], irr::core::position2d<irr::s32>(450,350),
irr::core::rect<irr::s32> (0,0,512,216) , 0, irr::video::SColor(255,255,255,255), false);
int tempPlayerY=playerY;
if(tempPlayerY < 380){tempPlayerY = 380;}
driver->draw2DImage(player, irr::core::position2d<irr::s32>(playerX,tempPlayerY),
playerCrop, 0, irr::video::SColor(255,255,255,255), false);
printf("%i \n",(int)playerX);
}
IRoom::roomLoad Room1::loadRoom(){
roomLoad newStruct;
newStruct.roomNum = -1;
newStruct.x = -1;
newStruct.y = -1;
return newStruct;
}
Code: Select all
#include <irrlicht.h>
#include <iostream>
using namespace irr;
#ifdef _MSC_VER
#pragma comment(lib, "Irrlicht.lib")
#endif
#include "eventReciever.cpp"
#include "Room.h"
#include "Room1.h"
/*
At first, we let the user select the driver type, then start up the engine, set
a caption, and get a pointer to the video driver.
*/
int main()
{
MyEventReceiver receiver;
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
IrrlichtDevice *device = createDevice(driverType,
core::dimension2d<s32>(1024, 800),32, false, false, false, &receiver);
if (device == 0)
return 1; // could not create selected driver.
device->setWindowCaption(L"costumeverse:The Game");
video::IVideoDriver* driver = device->getVideoDriver();
IRoom* Room[30];
Room[1] = new Room1();
Room[1]->setup(driver,device,155,614);
while(device->run() && driver)
{
if (device->isWindowActive())
{
u32 y = 0;
u32 x = 0;
if(receiver.IsKeyDown(irr::KEY_UP)){
y = y-1;
}else if(receiver.IsKeyDown(irr::KEY_DOWN)){
y = y+1;
}else if(receiver.IsKeyDown(irr::KEY_LEFT)){
x = x-1;
}else if(receiver.IsKeyDown(irr::KEY_RIGHT)){
x = x+1;
}
driver->beginScene(true, true, video::SColor(255,255,255,255));
Room[1]->render(x,y);
driver->endScene();
}
}
device->drop();
return 0;
}
Code: Select all
#ifndef ROOM_H
#define ROOM_H
#include <irrlicht.h>
class IRoom{
public:
struct roomLoad{
int x;
int y;
int roomNum;
};
virtual ~IRoom();
virtual void setup(irr::video::IVideoDriver* driverLink,irr::IrrlichtDevice *deviceLink,int PlayerX,int PlayerY);
virtual void render(int MoveX,int MoveY);
virtual roomLoad loadRoom();
};
#endif