Changed icon
This commit is contained in:
@@ -16,6 +16,10 @@ DataModelInstance::DataModelInstance(void)
|
|||||||
mouseButton1Down = false;
|
mouseButton1Down = false;
|
||||||
showMessage = false;
|
showMessage = false;
|
||||||
canDelete = false;
|
canDelete = false;
|
||||||
|
winMessage = "You Won!";
|
||||||
|
loseMessage = "You Lost. Try Again";
|
||||||
|
timer = 60.0F;
|
||||||
|
score = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataModelInstance::~DataModelInstance(void)
|
DataModelInstance::~DataModelInstance(void)
|
||||||
@@ -69,3 +73,59 @@ Instance* DataModelInstance::getGuiRoot()
|
|||||||
{
|
{
|
||||||
return guiRoot;
|
return guiRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char timerTxt[12];
|
||||||
|
char scoreTxt[12];
|
||||||
|
std::vector<PROPGRIDITEM> DataModelInstance::getProperties()
|
||||||
|
{
|
||||||
|
std::vector<PROPGRIDITEM> properties = Instance::getProperties();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
properties.push_back(createPGI("Messages",
|
||||||
|
"WinMessage",
|
||||||
|
"The message that shows when the player wins.",
|
||||||
|
(LPARAM)winMessage.c_str(),
|
||||||
|
PIT_EDIT));
|
||||||
|
properties.push_back(createPGI("Messages",
|
||||||
|
"LoseMessage",
|
||||||
|
"The message that shows when the player loses.",
|
||||||
|
(LPARAM)loseMessage.c_str(),
|
||||||
|
PIT_EDIT));
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(timerTxt, "%g", timer);
|
||||||
|
sprintf(scoreTxt, "%d", score);
|
||||||
|
properties.push_back(createPGI("Gameplay",
|
||||||
|
"InitialTimerValue",
|
||||||
|
"The ammount of time in seconds the player has to complete this level.\r\n\r\nPut 0 if time is limitless.",
|
||||||
|
(LPARAM)timerTxt,
|
||||||
|
PIT_EDIT));
|
||||||
|
properties.push_back(createPGI("Gameplay",
|
||||||
|
"InitialScoreValue",
|
||||||
|
"The ammount of points the player starts with.",
|
||||||
|
(LPARAM)scoreTxt,
|
||||||
|
PIT_EDIT));
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
void DataModelInstance::PropUpdate(LPPROPGRIDITEM &pItem)
|
||||||
|
{
|
||||||
|
if(strcmp(pItem->lpszPropName, "InitialTimerValue") == 0)
|
||||||
|
{
|
||||||
|
timer = atoi((LPSTR)pItem->lpCurValue);
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "InitialScoreValue") == 0)
|
||||||
|
{
|
||||||
|
score = atof((LPSTR)pItem->lpCurValue);
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "LoseMessage") == 0)
|
||||||
|
{
|
||||||
|
loseMessage = (LPSTR)pItem->lpCurValue;
|
||||||
|
}
|
||||||
|
if(strcmp(pItem->lpszPropName, "WinMessage") == 0)
|
||||||
|
{
|
||||||
|
winMessage = (LPSTR)pItem->lpCurValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Instance::PropUpdate(pItem);
|
||||||
|
}
|
||||||
@@ -24,4 +24,11 @@ public:
|
|||||||
void setMousePos(int x,int y);
|
void setMousePos(int x,int y);
|
||||||
void setMousePos(Vector2 pos);
|
void setMousePos(Vector2 pos);
|
||||||
bool mouseButton1Down;
|
bool mouseButton1Down;
|
||||||
|
|
||||||
|
float timer;
|
||||||
|
int score;
|
||||||
|
virtual std::vector<PROPGRIDITEM> getProperties();
|
||||||
|
std::string winMessage;
|
||||||
|
std::string loseMessage;
|
||||||
|
virtual void PropUpdate(LPPROPGRIDITEM &pItem);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,10 +4,8 @@
|
|||||||
WorkspaceInstance::WorkspaceInstance(void)
|
WorkspaceInstance::WorkspaceInstance(void)
|
||||||
{
|
{
|
||||||
GroupInstance::GroupInstance();
|
GroupInstance::GroupInstance();
|
||||||
name = "Instance";
|
name = "Workspace";
|
||||||
className = "Level";
|
className = "Workspace";
|
||||||
timer = 60.0F;
|
|
||||||
score = 0;
|
|
||||||
canDelete = false;
|
canDelete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ class WorkspaceInstance :
|
|||||||
public GroupInstance
|
public GroupInstance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float timer;
|
|
||||||
int score;
|
|
||||||
WorkspaceInstance(void);
|
WorkspaceInstance(void);
|
||||||
~WorkspaceInstance(void);
|
~WorkspaceInstance(void);
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
content/images/ArrowCursor.png
Normal file
BIN
content/images/ArrowCursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
44
main.cpp
44
main.cpp
@@ -68,7 +68,10 @@ static std::string cameraSound = "";
|
|||||||
static std::string clickSound = "";
|
static std::string clickSound = "";
|
||||||
static std::string dingSound = "";
|
static std::string dingSound = "";
|
||||||
static int cursorid = 0;
|
static int cursorid = 0;
|
||||||
|
static int cursorOvrid = 0;
|
||||||
|
static int currentcursorid = 0;
|
||||||
static G3D::TextureRef cursor = NULL;
|
static G3D::TextureRef cursor = NULL;
|
||||||
|
static G3D::TextureRef cursorOvr = NULL;
|
||||||
static bool running = true;
|
static bool running = true;
|
||||||
static bool mouseMovedBeginMotion = false;
|
static bool mouseMovedBeginMotion = false;
|
||||||
static const int CURSOR = 0;
|
static const int CURSOR = 0;
|
||||||
@@ -1234,9 +1237,9 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
//TODO--Move these to their own instance
|
//TODO--Move these to their own instance
|
||||||
|
|
||||||
std::stringstream stream;
|
std::stringstream stream;
|
||||||
stream << std::fixed << std::setprecision(1) << dataModel->getWorkspace()->timer;
|
stream << std::fixed << std::setprecision(1) << dataModel->timer;
|
||||||
fntdominant->draw2D(rd, "Timer: " + stream.str(), Vector2(rd->getWidth() - 120, 25), 20, Color3::fromARGB(0x81C518), Color3::black());
|
fntdominant->draw2D(rd, "Timer: " + stream.str(), Vector2(rd->getWidth() - 120, 25), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||||
fntdominant->draw2D(rd, "Score: " + Convert(dataModel->getWorkspace()->score), Vector2(rd->getWidth() - 120, 50), 20, Color3::fromARGB(0x81C518), Color3::black());
|
fntdominant->draw2D(rd, "Score: " + Convert(dataModel->score), Vector2(rd->getWidth() - 120, 50), 20, Color3::fromARGB(0x81C518), Color3::black());
|
||||||
|
|
||||||
//GUI Boxes
|
//GUI Boxes
|
||||||
Draw::box(G3D::Box(Vector3(0,25,0),Vector3(80,355,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
Draw::box(G3D::Box(Vector3(0,25,0),Vector3(80,355,0)),rd,Color4(0.6F,0.6F,0.6F,0.4F), Color4(0,0,0,0));
|
||||||
@@ -1262,19 +1265,34 @@ void Demo::onGraphics(RenderDevice* rd) {
|
|||||||
glEnable(GL_BLEND);// you enable blending function
|
glEnable(GL_BLEND);// you enable blending function
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
|
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
|
for(size_t i = 0; i < instances.size(); i++)
|
||||||
|
{
|
||||||
|
if(PartInstance* test = dynamic_cast<PartInstance*>(instances.at(i)))
|
||||||
|
{
|
||||||
|
float time = cameraController.getCamera()->worldRay(dataModel->mousex, dataModel->mousey, renderDevice->getViewport()).intersectionTime(test->getBox());
|
||||||
|
//float time = testRay.intersectionTime(test->getBox());
|
||||||
|
if (time != inf())
|
||||||
|
{
|
||||||
|
currentcursorid = cursorOvrid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else currentcursorid = cursorid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glBindTexture( GL_TEXTURE_2D, cursorid);
|
glBindTexture( GL_TEXTURE_2D, currentcursorid);
|
||||||
|
|
||||||
|
|
||||||
glBegin( GL_QUADS );
|
glBegin( GL_QUADS );
|
||||||
glTexCoord2d(0.0,0.0);
|
glTexCoord2d(0.0,0.0);
|
||||||
glVertex2f(mousepos.x-40, mousepos.y-40);
|
glVertex2f(mousepos.x-64, mousepos.y-64);
|
||||||
glTexCoord2d( 1.0,0.0 );
|
glTexCoord2d( 1.0,0.0 );
|
||||||
glVertex2f(mousepos.x+40, mousepos.y-40);
|
glVertex2f(mousepos.x+64, mousepos.y-64);
|
||||||
glTexCoord2d(1.0,1.0 );
|
glTexCoord2d(1.0,1.0 );
|
||||||
glVertex2f(mousepos.x+40, mousepos.y+40 );
|
glVertex2f(mousepos.x+64, mousepos.y+64 );
|
||||||
glTexCoord2d( 0.0,1.0 );
|
glTexCoord2d( 0.0,1.0 );
|
||||||
glVertex2f( mousepos.x-40, mousepos.y+40 );
|
glVertex2f( mousepos.x-64, mousepos.y+64 );
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
glDisable( GL_TEXTURE_2D );
|
glDisable( GL_TEXTURE_2D );
|
||||||
@@ -1367,8 +1385,8 @@ void Demo::onMouseLeftPressed(HWND hwnd,int x,int y)
|
|||||||
{
|
{
|
||||||
while(g_selectedInstances.size() > 0)
|
while(g_selectedInstances.size() > 0)
|
||||||
g_selectedInstances.erase(g_selectedInstances.begin());
|
g_selectedInstances.erase(g_selectedInstances.begin());
|
||||||
g_selectedInstances.push_back(dataModel->getWorkspace());
|
g_selectedInstances.push_back(dataModel);
|
||||||
_propWindow->SetProperties(dataModel->getWorkspace());
|
_propWindow->SetProperties(dataModel);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1399,7 @@ void Demo::onMouseLeftUp(int x,int y)
|
|||||||
//message = "Dragging = false.";
|
//message = "Dragging = false.";
|
||||||
//messageTime = System::time();
|
//messageTime = System::time();
|
||||||
std::vector<Instance*> instances_2D = dataModel->getGuiRoot()->getAllChildren();
|
std::vector<Instance*> instances_2D = dataModel->getGuiRoot()->getAllChildren();
|
||||||
std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
//std::vector<Instance*> instances = dataModel->getWorkspace()->getAllChildren();
|
||||||
for(size_t i = 0; i < instances_2D.size(); i++)
|
for(size_t i = 0; i < instances_2D.size(); i++)
|
||||||
{
|
{
|
||||||
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
|
if(BaseButtonInstance* button = dynamic_cast<BaseButtonInstance*>(instances_2D[i]))
|
||||||
@@ -1582,7 +1600,8 @@ void Demo::run() {
|
|||||||
UpdateWindow(_hWndMain);
|
UpdateWindow(_hWndMain);
|
||||||
|
|
||||||
// Load objects here=
|
// Load objects here=
|
||||||
cursor = Texture::fromFile(GetFileInPath("/content/cursor2.png"));
|
cursor = Texture::fromFile(GetFileInPath("/content/images/ArrowCursor.png"));
|
||||||
|
cursorOvr = Texture::fromFile(GetFileInPath("/content/images/DragCursor.png"));
|
||||||
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
|
Globals::surface = Texture::fromFile(GetFileInPath("/content/images/surfacebr.png"));
|
||||||
Globals::surfaceId = Globals::surface->getOpenGLID();
|
Globals::surfaceId = Globals::surface->getOpenGLID();
|
||||||
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
fntdominant = GFont::fromFile(GetFileInPath("/content/font/dominant.fnt"));
|
||||||
@@ -1592,7 +1611,8 @@ void Demo::run() {
|
|||||||
dingSound = GetFileInPath("/content/sounds/electronicpingshort.wav");
|
dingSound = GetFileInPath("/content/sounds/electronicpingshort.wav");
|
||||||
sky = Sky::create(NULL, ExePath() + "/content/sky/");
|
sky = Sky::create(NULL, ExePath() + "/content/sky/");
|
||||||
cursorid = cursor->openGLID();
|
cursorid = cursor->openGLID();
|
||||||
|
currentcursorid = cursorid;
|
||||||
|
cursorOvrid = cursorOvr->openGLID();
|
||||||
RealTime now=0, lastTime=0;
|
RealTime now=0, lastTime=0;
|
||||||
double simTimeRate = 1.0f;
|
double simTimeRate = 1.0f;
|
||||||
float fps=30.0f;
|
float fps=30.0f;
|
||||||
|
|||||||
Reference in New Issue
Block a user