here is some of the cprogramming.com tutorials converted to AppGameKit that I did to start learning C++, it shows examples of the core C++ language that also uses the included AppGameKit command set that comes with AGK. These 3 examples compile and run on my android 2.3 device with no problems. hope this helps you out. I have not completed this tutorial series but if enough people want me to finish this series from cprogramming.com to AppGameKit, I can continue to work on it.
/*
Name: cprogramming.com to AGK C++ While loop Tutorial
Description: Learning AGK Native C++ Tutorial
*/
// include our main header file
#include "Main.h"
// let the compiler know we're using the AGK namespace
using namespace AGK;
// declare our app
app App;
void app::Begin ( void )
{
agk::SetVirtualResolution ( 320, 480 );
}
void app::Loop ( void )
{
int x = 0; // Don't forget to declare variables
while ( x < 10 ) { // While x is less than 10
agk::Print(x);
x++; // Update x so the condition can be met eventually
}
agk::Sync ( );
}
void app::End ( void )
{
}
/*
Name: cprogramming.com to AGK NATIVE C++ AGE IF Tutorial
Description: Learning AGK Native C++ Tutorial
*/
// include our main header file
#include "Main.h"
// let the compiler know we're using the AGK namespace
using namespace AGK;
// declare our app
app App;
int age;
char* age_char = NULL;
void app::Begin ( void )
{
agk::SetVirtualResolution ( 320, 480 );
agk::StartTextInput ( );
}
void app::Loop ( void )
{
if ( agk::GetTextInputCompleted ( ) )
age_char = agk::GetTextInput ( ); // Asks for age
age = agk::Val(age_char);
if ( age )
if (age < 100) { // If the age is less than 100
agk::Print ( "You are pretty young" ); // Just to show you it works...
}
else if (age == 100 ) { // I use else if just to show an example
agk::Print("You are old"); // Just to show you it works...
}
else {
agk::Print("You are really old"); // Executed if no other statement is
}
agk::Sync ( );
}
void app::End ( void )
{
}
/*
Name: cprogramming.com to AGK NATIVE C++ For loop Tutorial
Description: Learning AGK Native C++ Tutorial
*/
// include our main header file
#include "Main.h"
// let the compiler know we're using the AGK namespace
using namespace AGK;
// declare our app
app App;
void app::Begin ( void )
{
agk::SetVirtualResolution ( 320, 480 );
}
void app::Loop ( void )
{
for ( int x = 0; x < 10; x++ ) {
agk::Print(x);
}
agk::Sync ( );
}
void app::End ( void )
{
}
btw, a suggestion for the forum. It would be great if we could preview our post before actually posting it to the forum, don't know if this is currently available as I don't see it.