Jump to content

heh65532

Member Since 08 Apr 2010
Offline Last Active Apr 26 2017 11:31 AM

Topics I've Started

transformation and projection matrixes

26 March 2017 - 11:55 AM

HI

I want to have matrix that makes the coordinates go X right and Y down. can someone provide me a matrix to do this?

If I understand correctly this matrix goes to setTransformMatrix() in libgdx.

sorry I'm not very good at matrixes.

 

thx!

 


Generic method in Java

17 March 2017 - 05:21 AM

Hi

I'm learning to code in Java and having background of C++ I tried to create this generic method but I get lot of errors and don't know how to make this code work. can someone show me how it's done?

 

the code:

<T> Button createButton(String resourceName,String textName)
{
skin.add(resourceName, new Texture(textName));
T.TextButtonStyle buttonStyle = new T.TextButtonStyle();    // Error , cannot resolve
buttonStyle.up = skin.getDrawable(resourceName);
buttonStyle.down = skin.getDrawable(resourceName);
buttonStyle.checked = skin.getDrawable(resourceName);
buttonStyle.over = skin.getDrawable(resourceName);
buttonStyle.font = skin.getFont("default-font");

Button button = new T("", skin, resourceName );   // Error T cannot be instantiated directly
return button;
}

The code is supposed to make T be an different kind of Button object, for example TextButton. and then create button of that class and return it.

 

thx


LibGdx and GUI

08 March 2017 - 08:20 AM

Hi

I'm new to mobile developing (in fact I just started yesterday) and I want to create game with libGDX, my question is can you use the GUI you make with android studio with GDX? or if I choose GDX should I make my own GUI?

 

thanks


how to do this in c++

16 May 2013 - 08:03 PM

hi,

i've been using this simple OO approach with rather simple code of determining if buildings have access between each other, in my game. But the problem is that it's quite clumsy way of doing OO and i think there's better solution in doing this in c++ but i can't remember what? The problem with this code is that there's possibility of infinite loop if i make some mistake in adding more classes that need this check.

 

so can you make a better OO solution for this check (code below)? 

 

 


class Bridge: public BaseBuilding
{
// return true if This building can be accessed from building b
bool canAccessFrom(BaseBuilding & b)
{
 if(b.canAccessFrom(*this)) // use the code in the other class if any...
return true;

return false;
}

};

class House: public BaseBuilding
{

bool canAccessFrom(BaseBuilding & b)
{
 return this->isOnSameLevel(b);
}

};
 

 

thanks. i hoipe i was able to explain what the problem is.


c++ syntax error

03 April 2013 - 07:54 AM

Hi

i ran to this problem that I cannot figure out what's causing it. I'm using visual studio 2010 express (C++) and first this code seeme'd to work but running clean-build ends up in error.

 

code:

 

template<class Archive,class EntClass> inline 
void loadEntityConstructData(Archive & ar, EntClass * obj, const unsigned int version)
{

 Point2F pos;
 F32 angle;
 std::string data;

 EntityData *entData = 0;

  ::new(obj)EntClass(*entData,pos,angle);

}

 

 

 
 
 
Gives error:
 
Error 220 error C2061: syntax error : identifier 'obj'
 
 

the code above is called from another template function:

 

 

template<class Archive> inline void load_construct_data(Archive & ar, classname * t, const unsigned int version) 
{ loadEntityConstructData(ar,t,version); }  
 

 

maybe someone knows what's wrong?

 

thanks