Alright, here is the template.cpp
// Includes, namespace and prototypes
#include "template.h"
using namespace AGK;
app App;
/////////////////////////////////////////
// PROTOTYPES ///////////////////////////
/////////////////////////////////////////
#ifdef IDE_ANDROID
extern void exit(int);
#endif
/////////////////////////////////////////
// CLASS STATIC ATTRIBUTES //////////////
/////////////////////////////////////////
bool app::did_start = false;
bool app::did_end = false;
/////////////////////////////////////////
// CLASS IMPLEMENTATION /////////////////
/////////////////////////////////////////
// Begin app, called once at the start
void app::Begin( void )
{
agk::SetVirtualResolution(640, 480);
agk::CreateSprite(1, agk::LoadImage("Media/1x1.png"));
#ifdef IDE_MAC
// use device resolution
agk::SetVirtualResolution(m_DeviceWidth,m_DeviceHeight);
#endif
}
// Main loop, called every frame
void app::Loop ( void )
{
// indicate started
app::did_start = true;
// check for ended
if (app::did_end) return;
// check for closing
if (agk::GetRawKeyState(27))
{
// call method to close up
closeThisApp();
} else {
//Checking for input
if(Input::GetPointerPressed() == 1){
//Adding a new point
Vertex point;
points.push_back(point);
points.push_back(point);
points.back();
}
}
// sync display
agk::Sync();
}
// Called when the app ends
void app::End ( void )
{
}
#ifdef AGKIOS
// Called when the app returns from being in the background
void app::appGetResumed( void )
{
// do anything that needs to be handled after being paused
agk::Message("We have returned!");
}
#endif
void app::closeThisApp()
{
// indicate done
app::did_end = true;
// completely exit the app
#ifdef AGKWINDOWS
PostQuitMessage(0);
#endif
#ifdef AGKIOS
// forcing a quit in iOS is against recommended guidelines - use HOME button
// the exit button is disabled on AGKIOS builds
// but if you want to do so, this is the code
agk::MasterReset();
exit(1);
#endif
#ifdef IDE_ANDROID
// similar to iOS, an exit button should not be done
// but if you want to do so, this is the code
agk::MasterReset();
exit(0);
#endif
#ifdef IDE_MAC
glfwCloseWindow();
#endif
#ifdef IDE_MEEGO
g_appptr->quit();
#endif
#ifdef IDE_BADA
// Bada platform has a HOME button to quit apps
// but the END command can also quit a Bada App forcefully
Application::GetInstance()->Terminate();
#endif
}
This is template.h
#ifndef _H_APP
#define _H_APP
// Link to AGK libraries
#include "agk.h"
#include "Vertex.h"
#include "Triangle.h"
#include "Input.h"
#include <vector>
/////////////////////////////////////////
// CLASS DEFINITION /////////////////////
/////////////////////////////////////////
class app
{
public:
// static attributes
static bool did_start;
static bool did_end;
public:
// main vars
#ifdef IDE_MAC
unsigned int m_DeviceWidth;
unsigned int m_DeviceHeight;
#endif
public:
// constructor
app() {memset ( this, 0, sizeof(app));}
// main app functions
void Begin( void );
void Loop( void );
void End( void );
#ifdef AGKIOS
void appGetResumed( void );
#endif
private:
void closeThisApp();
//////////////////////////////////////////////////
std::vector<Vertex> points;
};
extern app App;
#endif
// Allow us to use the LoadImage function name
#ifdef LoadImage
#undef LoadImage
#endif
and vertex.cpp
#include "Vertex.h"
Vertex::Vertex(void)
{
}
Vertex::~Vertex(void)
{
}
void Vertex::create(float x, float y){
this->x = x;
this->y = y;
//Creating a sprite for the point
//This will clone sprite 1 which should be a 1x1 image;
SID = agk::CloneSprite(1);
agk::SetSpriteScale(1, 1, 1);
agk::SetSpritePositionByOffset(1, x, y);
}