• Content count

  • Joined

  • Last visited

Community Reputation

171 Neutral

About heh65532

  • Rank
  1. Thanks ErnieDingo. I went through those links and I believe only thing I need is this: matrix.setToRotation(new Vector3(0,0,1),-90); It works but the problem I'm having is that now all the sprites get rendered sideways. I could just rotate them but I believe there is cleaner way of doing this with matrixes. Or is there?   thx!
  2. 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!  
  3. Generic method in Java

    I have a question about "?" usage in method. I was watching tutorial where that was used with a list like this: void someMethod(List<? extends Number> numbers) {} But when I tried to get that same working for single object (not list) it would not compile. can the "?" not be used with single objects then?   this: void test(<? extends Number> num) { } gives error: "wildcards may be used only as reference parameters"
  4. Generic method in Java

      errors are in the comments of the code   So I need to learn reflection and erasure.   thx
  5. 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
  6. 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
  7. how to do this in c++

      I'm not sure the why the tower would care that there are walls or water blocking the doors. It should just say "I have a door that opens here, a door that opens here, and a door that opens here", and provide some description of the kind of objects that can travel through the tower.   The pathfinder would then be responsible for examining each of those routes, and checking to see if there is a wall or water blocking the way (as it would be if there were open land immediately outside each of those doors, but which was then discovered to be walled or watered in a short distance from the doors).   Also, you can reduce the complexity of your multiple dispatch problem if you can attempt to categorize your buildings and other objects as to the kind of things they let pass through.   yes i very much agree. problem is with the complexity. but i'm going to use common attributes for each object (both path traveler and geometry) to determine in single function can the path go through an tile. this can get probably quite complex but at least there's no duplicated code or any other problems. 
  8. how to do this in c++

      that sounds like a good way. but the thing is i added access logic to each building so they can tell the pathfinder in which various ways they can be traveled through. for example there maybe a tower with one door on ground level and two doors at the top leading outside where a wall can be. So the tower needs to tell pathfinder the ground door can be used if there's ground and not water for example or some other obstacle and the top doors can be used if there's some connection like walls/platform next to the doors.  this seems to require rather complex set of portals. so i might use some kind of portal component system or try to do better OO design. 
  9. how to do this in c++

    thanks frob. So you say better OO approach is to let the world logic tell what accessibility there is between buildings? the reason for each building to have this information is because if there's a wooden bridge then humans can travel across it, but heavy donkey carts cannot because the bridge might collapse so they need to use stone bridge instead.  every time i add new type of these buildings the pathing possibilities increase. so i might be moving the conditional code outside the class but that seems to require keeping a list of class vs class accessibilities.
  10. 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.
  11. c++ syntax error

    i found the problem. the new was actually overrided and that caused the problem.   #define DEBUG_NEW new(_NORMAL_BLOCK,__FILE__, __LINE__)_) #define new DEBUG_NEW   for the memory leak detecting code. not sure if there's better way overloading the new.   thanks in anycase
  12. c++ syntax error

      did now but it didn't help. thanks
  13. 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    
  14. Point To Polygon

    Ok i made this image to show what I'm trying to do. There's a grid which represents an area. the green cells means area which borders I want to draw. First i have found the borders cells of the green area, i have them In x,y format (points). and now I want to draw the red line (border). But the problem is that the points i have collected are not in order (no indices). I can either use some other algorithm to find the border cells and find them in correct order. Or find a way to determine in which order the points are so the border can be drawn, [img]http://img266.imageshack.us/img266/6487/examplese.png[/img] hope you see now what I'm trying to accomplish
  15. Point To Polygon

    can anyone recommend math book or game programming book that teaches these things? thanks. or answer to this post will do as well