Game Development Community

Fun with Calendar Gui

by game4Rest · 07/29/2009 (7:09 am) · 2 comments

You can download the related zip file here.

To make it work, we need to add lines of code.

In winTime.cpp,
add
//HJ: Need to get localTime for Calender
#include "console/console.h"
#ifndef _STRINGFUNCTIONS_H_
#include "core/strings/stringFunctions.h"
#endif

//HJ: added to make Calender
ConsoleFunction( getLocalTime, const char *, 1, 1, "Return the current local time as: month day year hour min sec.nn" "Local time is platform defined.")   
{   
	Platform::LocalTime lt;   
	Platform::getLocalTime(lt);   

	char *retBuffer = Con::getReturnBuffer(128);   
	dSprintf(retBuffer, 128, "%d %d %d %02d %02d %02d",   
		lt.month + 1,   
		lt.monthday,   
		lt.year + 1900,   
		lt.hour,   
		lt.min,   
		lt.sec);   

	return retBuffer;   
}  
//End:

After that, unzip the downloaded file in the appropriate place.
You need to execute two script files like this way.
exec("./ui/zCalendarGui.gui");
 exec("./scripts/z_CalendarGui.cs");

If you want to bring the calendar out, do something like this.
Canvas.pushDialog(zCalendarGui);

That's all.

#1
07/29/2009 (7:38 am)
Ah cool! Now I'm gonna change it to be a game world calendar :D
#2
07/30/2009 (12:48 am)
cool, and appointments? :D