Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

126 Neutral

About DarioMicera

  • Rank
  1. "Creare un generatore di grafi randomicamente? E che ce vò!"
  2. PC restore: Complete
  3. "Curious people have an insane advantage because they can learn anything they want incredibly fast. People who are not curious are going to be left behind The most important thing we can do for our childrens is not to give them facts or figures or tecniques, but to make them curious" - Jesse Schell, CEO of Schell entertainment
  4. Today was really productive! Will take a rest playing Stealth Bastard!
  5. Shower time! I deserve it all!
  6. while (love) { love =true; }
  7. I worked with directX and made some little games witch c++. I was looking for a game engine that supported c++ and i would like to know your opinions on Panda 3d and Maratis for those who used at least one of them. I tried UDK but its specs are a bit high for me. Any other suggestions would be appreciated
  8. I solved the problem by subtracting the unit position from the cursor moveTo = cursor - unit.pos
  9. I'm trying to rotate a textured quad like in the image below: This is the code i'm using to rotate the arrow: //copies the current square position to a new vector moveTo = cursor; //these 2 floats store the magnitude of each vector part1 = D3DXVec3Length(&unit.pos); part2 = D3DXVec3Length(&moveTo); //tried to use both these formulae to calculate the angle //angle = acos((D3DXVec3Dot(&unit.pos,&moveTo)/(part1 * part2))); angle = atan2(moveTo.y,moveTo.x)- atan2(unit.pos.y,unit.pos.x); D3DXMATRIX center, rotate, reposition; //move to 0,0 -> Rotate -> reposition D3DXMatrixTranslation(&center,-unit.pos.x-16,-unit.pos.y,0.0f); D3DXMatrixRotationZ(&rotate,angle); D3DXMatrixTranslation(&reposition,unit.pos.x+16,unit.pos.y,0); D3DXMATRIX world; world = center *rotate * reposition; dev->SetTransform(D3DTS_WORLD,&world); //just draws the primitive with the selected Texture primitive.DrawPrimitive(dev,Arrow1,12); The problem is that the arrow rotates, ofc, relative to the origin instead of the position of the tank, so that if the arrow would be perpendicular to the tank, it is not. I'm probably missing something in my calculation, but i cannot figure out what's missin so that i can modify the behaviour of the rotation relative to the Tank. The tanks are Dynamically created during the game. Thanks in advance
  10. DarioMicera

    Getting to next level!

    Your next step would be using the DIrectX API or a game engine that supports C++ scripting. Keep in mind that game engines make your life easier since it simplifies many actions that would require lots of code. DirectX it's more complicated but will let you know all the stuff related to graphic cards.
  11. DarioMicera

    Vector of a Struct

    This sprite class was built before as a non-vector class to test a single instance. While trying to make it more dynamic i made my Sprite object in my main a pointer to the sprite class and that was what was causing the problem. I'm sorry for the trouble by realizing it was just a stupid error. Since it was the first time for me using the vectors i was more worried that i could have been wrong in that context Thanks as always everyone, the community it's just so cool :]
  12. DarioMicera

    Vector of a Struct

    Just in case it could help, here is the header file of the class i'm using. #ifndef SPRITE_H #define SPRITE_H #include <d3d9.h> #include <d3dx9.h> #include <vector> using namespace std; #define CUSTOMFVF D3DFVF_XYZ | D3DFVF_TEX1 class Sprite { public: struct CUSTOMVERTEX { D3DXVECTOR3 p; float tu,tv; }; struct BUFFER { LPDIRECT3DVERTEXBUFFER9 vertexBuffer; LPDIRECT3DINDEXBUFFER9 indexBuffer; }; vector<BUFFER> buffer; void CreatePrimitive(LPDIRECT3DDEVICE9 device,int width,int height,float x,float y,float z); void DrawPrimitive(LPDIRECT3DDEVICE9 device,LPDIRECT3DTEXTURE9 texture); void Destroy(); }; #endif The problem is that even if i create a vector for the vertex buffer and another for the index buffer i will get the same error now. I've noticed that if i declare the tempBuffer in the header of the class it won't let me initialize, throwing an exception, while if i do it into the method it will work normally.
  13. DarioMicera

    Vector of a Struct

    Initialise what objects? A std::vector instance is empty initially. Unless you put something in it, there is nothing to initialise. How are you attempting this initialisation? Because if i try to use an iterator to loop into the buffer vector, it will trigger an exception on the: [/quote] If you are using the following loop, and it doesn't work, then you must have corrupted your vector somehow. for(std::vector<Foo>::iterator i = v.begin() ; i != v.end() ; ++i) { // use *i } It seems related to the fact that my vector has no size, could it be possible? [/quote] It is perfectly legal to call size(), begin() and end() on an empty vector. If this is failing, you must have corrupted your vector. [/quote] what i meant by initializing the object of the vector is initializing the vertex buffer and index buffer pointer to NULL since i was suspicious that it could be related to that. I could clearly state that my vector it's corrupted, because i tried to use that loop. Also even if i call any vector method (resize, clear, etc) i will be given an exception.
  14. DarioMicera

    Vector of a Struct

    I'm trying to initialize the buffer's objects to NULL but more exception will be triggered. It seems related to the fact that my vector has no size, could it be possible? Because if i try to use an iterator to loop into the buffer vector, it will trigger an exception on the: size_type size() const { // return length of sequence return (this->_Mylast - this->_Myfirst); } or iterator begin() { // return iterator for beginning of mutable sequence return (iterator(this->_Myfirst, this)); } Any clue? :S
  15. DarioMicera

    Vector of a Struct

    These are vector objects, not pointers. I suspect removing the indirection from the declaration and use of the "buffer" variable should work fine. [/quote] thanks for pointing that out. I'm new to vectors and had messed up with managing it as a pointer. so it is now: vector<BUFFER> buffer; Still the program gives me the same error: [font="Tahoma, Arial, Helvetica, sans-serif"]First-chance exception 0x00be4329 in Warring Factions.exe: 0xC0000005: access violation reading location 0x00000008.[/font] It seems like nothing has changed.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!