///////////////////////////////////////////////////////////////////////////////
// This file is generated by GL Studio. DO NOT EDIT.
// To modify, run "glstudio timer.gls", edit, then select Code/Generate All.
// Generated from timer.gls using GL Studio 3.2.1006
///////////////////////////////////////////////////////////////////////////////
#ifdef _AFXDLL
#include "stdafx.h"
#endif
#include "timerApp.h"
#include "version.h"
#include "disti_assert.h"
#define LIB_BASE_NAME "gls"
#include "gls_auto_lib.h"
#undef LIB_BASE_NAME
using namespace disti;
timerClass *timer;
//////////////////// User Code from section: "file timerApp.cpp" ////////////
///////////////////////////////////////////////////////////////////////////////
void timerClass::Initialize ()
{
curtime = 0;
}
void timerClass::Calculate (double time)
{
objects->Group::Calculate(time); // Do not remove (for normal operations)
timerServer();
}
void timerClass::timerServer ()
{
if(Starttimer())
{
char ct[250];
if(timer)
{
curtime = timer->ElapsedSeconds();
sprintf(ct,"%d",curtime);
time_num->String(ct);
}
}
}
void timerClass::Starttimer (const bool& value)
{
_starttimer = value;
}
bool timerClass::Starttimer ()
{
return _starttimer;
}
// Object generated implementations
int timerClass::button_ObjectCallback(GlsPushButton* self, DisplayEvent* ev)
{
MouseEvent* mev = (ev->eventType == EVENT_MOUSE ? (MouseEvent*)ev : NULL);
KeyboardEvent* kev = (ev->eventType == EVENT_KEYBOARD ? (KeyboardEvent*)ev : NULL);
int i = 0;
if(ObjectEventIs(ev,"StateChange"))
{
i = self->State();
Starttimer(true);
timer = new Timer;
timer->Reset();
}
return i;
}
InterfaceListType* timerClass::GetCppInterfaceDescription(InterfaceListType* addToThisList)
{
// Create a list if it doesn't exist
if (!addToThisList)
addToThisList = new InterfaceListType;
#ifndef GLS_NO_DESCRIPTION
static char* localList[][3] = {
{"","------ timerClass ------",""},
{"Initialize(","void Initialize()",""},
{"Calculate(","void Calculate(double time)",""},
{"timerServer(","void timerServer()",""},
{"Resource(\"Starttimer\")","DistiAttributeBase& Resource(\"Starttimer\")","Retrieves reference: "},
{"Starttimer(","bool Starttimer(const bool&)","Sets: "},
{"SetResource(\"Starttimer\",\"","void SetResource(\"Starttimer\",const char* value)","Sets: "},
{"Starttimer()","bool Starttimer()","Gets: "},
{"GetResource(\"Starttimer\")","std::string GetResource(\"Starttimer\")","Gets: "},
NULL
};
int index = 0;
while(localList[index][0])
{
addToThisList->InsertObject(InterfaceDescriptionClass(
localList[index][0],
localList[index][1],
localList[index][2]));
index++;
}
#endif //GLS_NO_DESCRIPTION
return addToThisList;
}
void timerClass::GetCppInterfaceDescriptionFree(InterfaceListType* list)
{
// Delete the list itself
delete list;
}
#ifdef WIN32
#pragma optimize("", off)
#endif
#ifdef GLS_CREATEOBJECTS_OPTIMIZE
#ifdef WIN32
#pragma optimize("", on)
#endif
#endif
void timerClass::CreateObjects(void)
{
const unsigned int frameAvailableAttributes = 17;
// Instance all fonts referenced by text objects in this class
GlsArialRegular12::Instance();
objects->InitialGroupCount(3);
//--------------------------------------------------------------------
// Initialization code for GlsTextGrid time_num
// Base class initializers will be set up first.
//--------------------------------------------------------------------
// Initialization code for GlsTextGrid time_num
time_num = new GlsTextGrid();
time_num->VaSetVertices(4,
134, 13, 13,255, 0.000000f, 0.000000f, 0.000000f,
255,255,255,255, 128.000000f, 0.000000f, 0.000000f,
255,255,255,255, 128.000000f, 17.000000f, 0.000000f,
255,255,255,255, 0.000000f, 17.000000f, 0.000000f);
time_num->VaSetNormals(4,
0.000000f, 0.000000f, 1.000000f,
0.000000f, 0.000000f, 1.000000f,
0.000000f, 0.000000f, 1.000000f,
0.000000f, 0.000000f, 1.000000f);
// Initialization code generated by DisplayObject class
time_num->SetAvailableAttributes(frameAvailableAttributes);
time_num->Set(
GLS_INSTANCE_NAME, "time_num",
GLS_LOCATION, 225.000000f, 250.000000f, 0.000000f,
GLS_TEXTURE_REPEAT, TRUE,
GLS_TEXTURE_MAP_MODE, TEXTURE_MAP_REPLACE,
GLS_TEXTURE_MIN_FILTER, TEXTURE_FILTER_LINEAR,
GLS_TEXTURE_MAG_FILTER, TEXTURE_FILTER_LINEAR,
GLS_LIGHTING_ENABLED, 0,
GLS_MATERIAL_INDEX, 0,
GLS_TEXTURE_POINTS, 0.000000f, 0.000000f, 0.000000f,
0.000000f, 0.000000f, 0.000000f,
0.000000f, 0.000000f, 0.000000f,
0.000000f, 0.000000f, 0.000000f,
NULL);
// Set GlsTextGrid specific initializers now
time_num->Set(
GLS_TEXT_BORDER, 0.000000f,
GLS_TEXT_CELL_HEIGHT, 17.000000f,
GLS_TEXT_CELL_WIDTH, 16.000000f,
GLS_TEXT_CONSTRAIN_CELL_RATIO, true,
GLS_TEXT_CONTROL_CELL_SIZE, false,
GLS_TEXT_FONT, "Arial", "Regular", 12,
GLS_TEXT_GRID_SIZE, 8, 1,
GLS_TEXT_LINESPACING, 1.000000f,
GLS_TEXT_HALO, false, 0, 0, 0, 0,
GLS_TEXT_LOCK_CELL_SIZE, true,
GLS_TEXT_JUSTIFY, 0,
GLS_TEXT_SHADOW, false, 0.130000f, 128, 128, 128, 255,
GLS_TEXT_STRING,
"00:00:00",
GLS_TEXT_UPPERCASE, false,
GLS_TEXT_WRAP, true,
NULL);
// Call initialize on the object after the Set methods so that the grid
// will be sized properly before any row,column specific (individual characters) calls are made.
time_num->Initialize();
// Call GlsTextGrid methods to set up individual character attributes.
time_num->Baseline(0.000000f);
time_num->BgColor(glsColor(255,255,255,0));
time_num->TextColor(glsColor(255,0,0,255));
time_num->CharScaling(1.000000f);
time_num->CharSpacing(1.000000f);
time_num->FauxBold(false);
time_num->Inverse(false);
time_num->StrikeThru(false);
time_num->Underline(false);
// Call initialize on the object after all character attribute methods
// in case character settings affect the extents of the grid.
time_num->Initialize();
// End of initialization code for GlsTextGrid time_num
//--------------------------------------------------------------------
DisplayFrame::InsertObject(time_num,true,false);
// Initialization code for GlsPushButton button
button = new GlsPushButton();
// Initialization code generated by DisplayObject class
button->SetAvailableAttributes(frameAvailableAttributes);
button->Set(
GLS_INSTANCE_NAME, "button",
GLS_LOCATION, 130.500000f, 58.500000f, 0.000000f,
GLS_TEXTURE_POINTS, 30.500000f, -16.500000f, 0.000000f,-30.500000f, -16.500000f, 0.000000f,-30.500000f, 44.500000f, 0.000000f,30.500000f, 44.500000f, 0.000000f,
NULL);
button->CallbackCaller(
new CallbackMethodCallerTemplate< timerClass, GlsPushButton >(
(disti::CallbackMethodCallerTemplate< timerClass, GlsPushButton >::MethodType1)
&disti::timerClass::button_ObjectCallback, this ));
button->PerformGroupCullCheck(false);