So iv been Coding in C++ for a while, but I only recently started in SDL. After reveiwing my code for hours, and even comparing it with the code available for download, I only found differences were I changed the names of files and chose not to make new files for each progress, and just continued working were the last tut left off. Iv been using Lazyfoo's (Lazy Foo' Productions) Amazingly nice tuts, im on lesson #7 (Lazy Foo' Productions) and this is where I started having the problem.

The problem is: My window closes instantly after opening without showing any images.

I get no errors what so ever, and suspected the png/bmp files to be corrupt so I made new ones and still no progress. I also thought that it might have been in the quit loop where it got caught and closed, however I looked over and even copied his and it didn't fix it. Iv got no clue what else it could be so I turned to here. (on an off topic, im currently in a huge blizzard, so if i try a suggestion that works, or I dont reply, im just trying to do stuff as quickly as possible) Im not sure(or I am just stupid) how to post my code as a text file or whatever, so im uploading it to google docs(https://docs.google.com/document/d/1...yoCzNfQm8/edit ) - view only. im putting the link to the editable one here (https://docs.google.com/demo/edit?id...+docs#document )
If you know for a fact something will fix it just edit there and let me know!

My guess is either init() or load-files() is returning 1. Since I can't test your PNGs I would ask you to do one of two things.

Either
1. Comment out your return 1; inside the load files function.
Or better.
2. Comment out all the calls to load the images. If the program runs then test each picture one at a time and see which one is crashing the program.

Side note I have spent hours on something like this only to realize I saved it as a wrong filetype or a letter wasn't capitalized properly.

If you do all those things and still it doesn't work report back here.

I should probably clarify don't apply surface on a surface after you comment out the line that loads an image to it. Since it will be null.

12-26-2012

bigfatmeany

:P sorry I didnt see that, iv been really stressed with Xmas, and this was the last thing i needed, so i just wanted to get it out there.

My suggestion is to take your time and comment out lines that you think may be breaking the code. If you comment something and it does not fix the problem then uncomment that line.

Do not keep a change in your code that you made to "fix" something if it did not fix it as this will lead to more and more bugs.

1. Take your time
2. Analyze each line
3. If you don't understand a line google it.
4. Once you understand move to another line.
5. When u stumble on a line that could break your code adjust it
6. If step 5. doesn't fix it revert the line back to its original condition
7. Start back at step one.

By the end you will understand every line which will fix the problem.

Once I get home in an hour or two I will post an example of your code adjusted to how I would troubleshoot it. Hope you find the problem first though.

12-27-2012

bigfatmeany

Ok, well I fixed it. For some reason, EVERY time I extracted the font file it would corrupt, so what I did was remove it, which didnt fix the problem, and I never put it back. and after stopping for a while then coming back to the tuts I forgot that I needed to extract to windows/fonts and then Copy-Paste ( which worked) and as You said the image quality was a little blurry or i would have thought you might have caught the .ttf file wasnt in the correct folder. So I have now fixed my problem. Also, your right that didnt compile, that was an error on my part which I fixed after making that post, I just didnt catch it then and there. Those errors are not errors, as my last build did include be successful other than the insta-closing.
Otherwize, Thanks if I seemed hard to work with, its my first time using these forums, or really any forums that has to do with C/C++.

P.S. I do understand what every single line of my code does, and what is affected by each one. also like I said originally I spent HOURS looking through code and other stuff, and even re-writ the program.
P.S.S I played your colorblocks game, and unless I missed something, an instruction page is much needed, otherwize it feels like something I would play when im not coding/watching youtube

12-27-2012

Lesshardtofind

Quote:

Otherwize, Thanks if I seemed hard to work with, its my first time using these forums, or really any forums that has to do with C/C++.

Welcome to the forums!

Not at all hard to work with. The fact that you went through the problem solving techniques needed to solve the problem shows that you are at least putting forward the effort to fix and understand the solution. These are extremely important qualities when it comes to programming. You are always going to end up running in to walls and trying to solve new issues and fix bugs that you created! I can't grab the name right now but one of the user's here has a signature that says something like "If you know what you are doing you then you aren't learning." I love that because it really describes what programming is like. When you are learning new things it can be tough escpecially SDL. I remember spending hours trying to get true type fonts to work. Honestly I remember giving up for a week and then coming back and still not getting it. Programming is like anything and it will just take time.

I would suggest bookmarking the forum if you haven't already! If you stick with programming then I know this forum will turn out to be in invaluable resource to you.

Quote:

I played your colorblocks game, and unless I missed something, an instruction page is much needed, otherwize it feels like something I would play when im not coding/watching youtube

Thanks!

Yea alot of content is on my list to add. I just kinda whipped the whole thing up yesterday. I just learned JavaScript last week and I had a thought last night.

"What if I finish this game and it only works in the browser on the OS I have?" (ubuntu 12.1 & firefox)

That would be a disaster so I figured I should post it for beta and see if any bug reports showed up, since I don't have access to all the resources to test it myself.

That being said can you tell me what OS/Browser version you tested it with?

12-27-2012

bigfatmeany

Quote:

I would suggest bookmarking the forum if you haven't already! If you stick with programming then I know this forum will turn out to be in invaluable resource to you.

Done and Done

Quote:

That being said can you tell me what OS/Browser version you tested it with?

Im using windows 8, and i tested on Google chrome, firefox, and Internet explorer, and safari. The only one it wouldnt work with was safari, in that case I just got a blank page, however I never used safari and im not sure why its on my computer. So maybe someone more experienced with it could help in that sense.

The only bugs I found with the game itself, is that when you click 3 block in a ' ' formation, then they dont add the correct score. Also, the score thing to the left is really buggy, doesn't appear in full AT ALL, and i can barley make out what they are. '

I also noticed, that if you go to www.lesshardtofind.com then click the tab that is supposed to take you to the game, it throws a 404 error.