Tag Info

New answers tagged

0

SDL doesn't really provide GUI functionality, it does however provide functionality to build a GUI like rendering, user input and events etc. You will need to use those features to build the functionality of a GUI yourself, so that takes some work on your part. So creating a simple label that displays text would be really easy, but when you start needing ...


1

The transform method of Vector class is wrong. If you want to perform a transformation of the vector that is equivalent to multiplying a vector by a transform matrix, you should modify your code as follows: void Vector2::transform(double a, double b, double c, double d) { double newX = a*x + b*y; y = c*x + d*y; x = newX; }


0

As pointed out to me, normalizing normals in the vertex shader and then passing them to the fragment shader doesn't ensure they are normalized after being passed. By only passing the normals in the vertex shader and then normalizing them in the fragment shader the problem was fixed. Another way to fix the error is centroid attribute interpolation between ...


2

From a quick glance at the SDL wiki at the function you provided, it says: "The returned resource is owned by SDL and should not be deallocated." from - https://wiki.libsdl.org/SDL_GetTouchFinger Therefor, you shouldn't need to worry about destroying the object, SDL will manage it for you.


0

The path you find with A* and the path a unit travels do not have to be exactly the same path. You can use methods like steering to follow paths found by A*, while avoiding the corners of your obstacles. Or you can change the input to your A* to allow it to find whatever kind of path you like (which can be followed directly). And you can find paths for ...


0

A "normal" project needs an entry point.


0

I am working on similar project right now and I think that you have two problems. First is that you compute direction in a wrong way. Try changing signs before sin and cos. For example: if (event.key.keysym.sym == SDLK_w) { t.GetPos()->x += glm::sin(glm::radians(t.GetRot()->y)) * 0.5; t.GetPos()->z -= ...


1

I think you shouldn't put bullets into a tower class. If you store bullets in the tower class you'll not be able to destroy tower when some bullets in way to the target. For example, if you have rocket launcher with slow rockets, it would be hard to sell it, because in any moment of game some rocket will be on the way. So, ArrayList (or special class called ...


1

The tower class should probably inherit a bigger class that manages bullets, weapons and the sort. That being said, it's a fairly simple game, so from the limited information you've provided, I'd say put it in the tower class so you can do Tower.Shoot() -- neat and logical.


1

I haven't used SDL or made anything for iOS so I might have missed something, but with that said. I think your best bet would be to look into OpenGL ES (Embedded System), using OpenGL with SDL can be enabled with SDL_SetVideoMode. Normally you would be able to use quadbuffering for stereoscopy in OpenGL, but I don't think the ES allows for that, in that ...


0

What are the effects of this: inline glm::mat4 GetModel() const { glm::mat4 matx; matx = glm::scale(matx, m_scaleV); matx = glm::rotate(matx, m_rotateV.x, glm::vec3(1.0, 0.0, 0.0)); matx = glm::rotate(matx, m_rotateV.y, glm::vec3(0.0, 1.0, 0.0)); matx = glm::rotate(matx, m_rotateV.z, glm::vec3(0.0, 0.0, 1.0)); matx = ...


1

I did not notice any performance issue with SDL_PollEvent, but be careful when compiling SDL2, you must have X11 dev headers and maybe some drivers headers like MESA. Without these, everything will run software and you may have performance issues, especially on low-cost hardware. So yes, you probably have to recompile SDL2.


0

I'm doing it using the following code: BufferRef LoadImage(std::string filename, bool &success) { SDL_Surface *surf = IMG_Load(filename.c_str()); if (!surf) { success = false; std::cout << "Cannot load " << filename << std::endl; BufferRef r; return r; } SDL_PixelFormat format; format.palette = 0; ...



Top 50 recent answers are included