Okay, here is a sample Base file... a template if you will... for an AppGameKit project.
This compiles and runs fine for me using Visual Studio. Of course you need to set up the references and external dependencies which should be done for you if you use the templates TGC provide.
The include file "Main.h" also came from that template.
The program itself is very simple it just creates 10 cubes on the screen. That is not the point of it though just to show this is what I do and works fine. So hopefully it will work for you.
This is "Main.cpp"
/******************************************************************************************
Project: BLANK TEMPLATE FOR AGK2 C/C++ GAME DEVELOPMENT
Started: 2018-03-07
Created By: GarBenjamin
*******************************************************************************************/
// *******************************************************************
// INCLUDE FILES
// *******************************************************************
#include "Main.h"
// Namespace
using namespace AGK;
// *******************************************************************
// FUNCTION PROTOTYPE DECLARATIONS
// *******************************************************************
void InitDisplay();
void CreateCubes(int count);
void ShowFPS();
// *******************************************************************
// CONSTANT KEY VALUE REFERENCES
// *******************************************************************
const int KEY_TAB = 9;
const int KEY_ENTER = 13;
const int KEY_SHIFT = 16;
const int KEY_CONTROL = 17;
const int KEY_ESCAPE = 27;
const int KEY_SPACE = 32;
const int KEY_LEFT = 37;
const int KEY_UP = 38;
const int KEY_RIGHT = 39;
const int KEY_DOWN = 40;
const int KEY_0 = 48;
const int KEY_1 = 49;
const int KEY_2 = 50;
const int KEY_3 = 51;
const int KEY_4 = 52;
const int KEY_5 = 53;
const int KEY_6 = 54;
const int KEY_7 = 55;
const int KEY_8 = 56;
const int KEY_9 = 57;
const int KEY_A = 65;
const int KEY_C = 67;
const int KEY_D = 68;
const int KEY_E = 69;
const int KEY_S = 83;
const int KEY_W = 87;
const int KEY_X = 88;
const int KEY_Z = 90;
const int KEY_F1 = 112;
const int KEY_F2 = 113;
const int KEY_F3 = 114;
const int KEY_F4 = 115;
const int KEY_F5 = 116;
const int KEY_F6 = 117;
const int KEY_F7 = 118;
const int KEY_F8 = 119;
// *******************************************************************
// CUSTOM TYPES
// *******************************************************************
// *******************************************************************
// CONSTANT VALUE REFERENCES
// *******************************************************************
const int CUBE_ID_BASE = 1;
// *******************************************************************
// GLOBAL DATA
// *******************************************************************
app App;
// *******************************************************************
// START OF PROGRAM EXECUTION
// *******************************************************************
void app::Begin(void)
{
// Init Window
InitDisplay();
CreateCubes(10);
agk::SetCameraPosition(0, 0,0,0);
agk::SetCameraLookAt(0, 0,0,3, 0);
}
// *******************************************************************
// MAIN GAME PROGRAM LOOP
// *******************************************************************
int app::Loop(void)
{
// Calls to functions to implement your game logic here
ShowFPS();
agk::Sync();
// Escape key exits
if (agk::GetRawKeyState(KEY_ESCAPE)) return 1;
return 0;
}
// *******************************************************************
// CLEAN-UP AT THE END
// *******************************************************************
void app::End(void)
{
agk::DeleteAllObjects();
}
// *******************************************************************
// GAME SPECIFIC CODE HERE
// *******************************************************************
void InitDisplay()
{
agk::SetWindowTitle("AGK Base Game Dev Template");
agk::SetWindowSize(1280, 720, false);
agk::SetWindowAllowResize(0);
// Init Display Properties
agk::SetVirtualResolution(1280, 720);
agk::SetOrientationAllowed(1, 1, 1, 1);
agk::SetSyncRate(60, 0);
agk::SetScissor(0, 0, 0, 0);
agk::SetAntialiasMode(0);
agk::UseNewDefaultFonts(1);
}
void CreateCubes(int count)
{
int id;
float xpos;
float ypos;
int red;
int green;
int blue;
for (int i = 0; i < count; i++)
{
id = CUBE_ID_BASE + i;
xpos = agk::Random(0, 32) - 16.0f;
ypos = agk::Random(0, 6) - 3.0f;
red = agk::Random(64, 255);
green = agk::Random(64, 255);
blue = agk::Random(64, 255);
agk::CreateObjectBox(id, 2.0f, 2.0f, 2.0f);
agk::SetObjectPosition(id, xpos, ypos, 3.0f);
agk::SetObjectColor(id, red, green, blue, 255);
}
}
void ShowFPS()
{
agk::Print(agk::ScreenFPS());
}
TI/994a (BASIC) -> C64 (BASIC/PASCAL/ASM/Others) -> Amiga (AMOS/BLITZ/ASM/C/Gamesmith) -> DOS (C/C++/Allegro) -> Windows (C++/C#/Monkey X/GL Basic/Unity/Others)