Thanks Tpb,
but I beg to differ,I have seen plenty of your posts on here helping people and to be honest I doubt you have much more knowledge than me,I will admit you are no doubt a better programmer than me from what I have gauged but not by much,if you declare me as beginner I would probably declare you as beginner++,
but I digress,I'm not a games programmer I actually have very little interest in game programming,I have used SDL a very minimal amount of times,I have followed a few tutorials here and there I'm just pretty much messing around and following a few tutorials to become a better programmer as I would,obviously this isn't a fully functioning program I'm just getting to grips with some basic concepts and uses of the SDL library,
and if you have ever programmed using the SDL library you should know that you do indeed declare the main function as SDL_main with command line arguments,I could be wrong but I'm almost certain I'm not. If I am please correct me but my compiler throws up a lot of error messages without main declared as SDL_main,
you are pointing out very obvious things I know you need to break out of the loop(have a bool) to quit if event.type equals the number for SDL_QUIT,but I'm only doing this for testing purposes,I also know I'm not freeing/deallocating my memory again it's not a fully
functioning program.
I could be doing a lot of things better and by the book,I should probably not be using globals,I should probably use oop instead of the C style functional programming approach I have taken here,I probably should free my resources.
Again I'm not upset at you,as mentioned you are a better programmer than me and I will admit that hands down I mean it's not a competition it's just insulting to judge my skills and knowledge from just asking a simple question,I mean I have seen your posts on here and you are not at the elite level yourself(but no doubt better than me),I have a long way to go no doubt and to be honest I will admit I am not a great programmer actually quite a poor one, but to call me a beginner after 2-3 years experience is kind of insulting seeing as you probably don't have much more experience yourself,and again I've gone off on a tangent, so now that I got that off my chest now to the problem.
It's not a good idea to "poll" for events if "waiting" is good enough (SDL_WaitEvent). With polling your program constantly uses about 10% of my CPU when it's doing absolutely nothing. With waiting it uses about 0.1% |
never knew that :o
sorry to go off on a rant I just found that a little disrespectful but I appreciate the help :)