Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 1 more developer from Canada and 12 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


Member Since 18 Dec 2011
Offline Last Active Aug 28 2015 03:31 AM

Topics I've Started

SDL 2.0 compiling for android

05 October 2013 - 01:20 PM

So I decided to use SDL 2.0 to develop for the android platform. I downloaded the Android SDK/eclipse/NDK, I installed eclipse and I've set up the project directory and everything ( took me a full day of research and downloading D: ).


So my eclipse project currently looks like this:





Now only thing left is to compile the SDL library with the NDK.






And here is where I get an error saying:


"Unresolved reference to SDL_main."


I tryed to search on google but I couldnt find any solutions. I tryed changing int main(...) to SDL_main but that didnt work either. I am totaly out of ideas and google doesnt seem to be of much help either D:, any help would be priceless <3. Thanks in advance


P.S: if you need me to provide any more info, let me know ^^.

P.S2: my Android.mk file looks like this:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)




# Add your application source files here...
LOCAL_SRC_FILES := $(SDL_PATH)/src/main/android/SDL_android_main.c \




virtual and class inherience

01 September 2013 - 01:31 PM

Hello there dear forum.


So my question is about class inheriences and virtual functions.


so lets say I got a class structure as following

class A{


virtual void f(){ //does w/e }


class B : public A{

void f(){ //does something diffrent }


B object;

so first thing is, in what order do constructers/deconstructers get called :o ? As far as I understand the constructurs are builed from the base up meaning the constructor of A will get called and then the constructor of B and deconstructers are the opposite, meaning B's deconstructor first and then A's. Am I right o.o ?

The main question tho once I "overload" the virtual function in the child class does the base's class function still get called or only the function in B. ( once I actually call the function ofc).


P.S all under the asumption I am creating only a object of B and no objects of A are used.


Thanks in advance ^^ <3

Question on conversion functions

29 August 2013 - 01:31 PM

Hello guys and thanks to all of you in advance for the help.


So for the question:


I have 2 simple classes

class Vector2D{

float X,Y;


class Point2D{

float X,Y;


as simple as it gets.


Now I want to be able to perform basic math on them like

Vector2D vec;
Position2D EntityPosition1;
Position2D EntityPosition2;

vec = EntityPosition1 - EntityPosition2;

Now I already have an operator overload for the - but when I try to do it says that there is no possible conversion from Point2D to Vector2D, fare nuff.

Simple googling pointed me to the conversion functions but while I was browsing I was left with the impression that conversion functions are actually a bad thing, is that true or did I just go too shallow on the googling :o ?


Also about the syntax itself.


So I added this peace of code into my Vector2D class header

operator Point2D();

so far so good but when I go into the Vector2D.cpp file and simply write

operator Point2D(){


without adding anything else I immidatly get an error message saying "conversion function must be a nonstatic member function", that doesnt really make sence considering its a member function and its not static ( atleast thats my understanding of the syntax while looking at the examples on google but I guess I am clearly wrong )

I dont understand the syntax of how this things works and quite frankly documentiation on google doesnt make it easyer as well, I am not sure how the syntax even works or if I should be using conversion functions to begin with.


Again thanks in advance for the help guys and sorry for the long post on this simple mather, any help appriciated <3


P.S: I've been loving the Game developing article project so much its really a great way to learn.

[SDL] Transparent entityes

05 January 2012 - 02:57 PM

Hello all.
First of all happy new year to everyone. I hope someone can help me with this:
Basickly I have a draw function, a transparent function and a function for loading entityes. My problem is that whenever I try to apply my transparent function on an entity it just keeps its color, nothing changes. Here are the functions :
//Draw Function
bool GameSurface::OnDraw(SDL_Surface* Surf_Dest, SDL_Surface* Surf_Src, int X, int Y) {
	if(Surf_Dest == NULL || Surf_Src == NULL) {
		return false;

	SDL_Rect DestR;

	DestR.x = X;
	DestR.y = Y;

	SDL_BlitSurface(Surf_Src, NULL, Surf_Dest, &DestR);

//Load Function

SDL_Surface* GameSurface::OnLoad(std::string filename) {
	SDL_Surface* Surf_Temp = NULL;
	SDL_Surface* Surf_Return = NULL;

	if((Surf_Temp = IMG_Load(filename.c_str())) == NULL) {
		return NULL;

	Surf_Return = SDL_DisplayFormatAlpha(Surf_Temp);

	return Surf_Return;

//Transparent function
bool GameSurface::Transparent(SDL_Surface* Surf_Dest, int R, int G, int B)
if(Surf_Dest == NULL) return true;
SDL_SetColorKey(Surf_Dest, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(Surf_Dest->format, R, G, B));
return true;

//Entity load function
bool Entity::OnLoad(std::string filename, int Widght, int Height, int MaxFrames){
if((Surf_Entity = GameSurface::OnLoad(filename.c_str())) == NULL) return false;

GameSurface::Transparent(Surf_Entity, 255, 0, 255);

this->Widght = Widght;
this->Height = Height;
Anim_Control.MaxFrames = MaxFrames;

return true;
Thanks in advance ! PS: I know there isnt much commenting going on but if needed I will provide some

C++ : objects with the same function

25 December 2011 - 06:38 AM

First of all I want to wish everyone a merry christmas and a happy new year. I've been learning C++ and SDL for some time now, but I can't seem to think of a way to call the same function from multiple objects ( of the same class, ofcourse) I am 100% sure there is a way so if someone can give me a hint, tutorial , an existing topic on this subject I will be more then happy.

Thanks in advanced