• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

incorporating graphics

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

djs488

Member
Joined
May 28, 2002
Location
Maryland
i've dabbled in programming, went a little in visual basic and now working on c++. i only know the extremes basics right now and am taking a course (in college) of an introduction to programming. how do i go about incorporating graphics into my programs. i really dont know where to begin. i dont need any sort of in depth answer, just a point in the right direction.
 
Your question is a little vague. What exactly do you want to do with these graphics? What libraries or toolkits are you using? We need to know this to point you in the right direction.
 
haha, yes my question is vague because i dont really know what i am doing. basically, i am currently making a "battleship" game (the one where u place ships in a grid and then guess on the opponents grid and see if you hit or miss). i am using the standard compiler in linux, and really dont know where to begin. i suppose i am asking how would i begin to add graphics to represent ships, as opposed to the 'H' character that i am using right now.
 
Alright, let me make sure I understand your question first:
Right now, you've got a battleship program that displays its grid on the console by printing out characters, and you want to make a graphical interface that displays the ships with pictures. You want something that will work on Linux.
Let me know if that's not what you are looking for.

Going from a command line program to one with a graphical interface can be a pretty sizable jump. You've probably noticed that C++ doesn't have a standard GUI library, like it has iostream for console IO. So you'll need to pick a seperate GUI toolkit. On Linux, you've several choices, including gtk, Qt, and wxWidgets. Each library has a tutorial on its website, so I encourage to try working through them to get an idea of the sort of programming involved. You can also look through their documentation to check if the libraries have the features you want.

The libraries I mentioned above aren't really designed specifically with games in mind, although, they are probably capable of doing what you want. SDL is a different sort of library geared more towards game development. It is also capable of doing what you want, but if you look at its tutorial, you'll see it does thing in a very different manner than the other libraries I mentioned, and its capablities are also different. I'm not going to recommend a specific choice, but instead encourage you to look at all of them and pick the one that suits your need best.
 
thank you so much. actually, though, I was hoping to start programming in windows pretty soon, i just use linux because it seems very simple. however, once i do decide to start programming in windows, will the libraries and how they are used be very similar to linux. i mean, i dont want to learn a whole thing in linux and then have to learn it in windows. over course, if they were similar (like as similar as c to c++) then this wouldnt be a problem.
 
SDL, wxWidgets, and gtk all work in Windows (and probably other platforms as well, check their websites for more info). Qt also works in Windows, but I'm not sure if you'll have to pay for a license or not (its free for non-commercial development in Linux).
 
alright, thanks a lot man. any one in particular you would recommend, im leaning more towards qt after a brief look. also, if i were to go with qt, do i want the embedded version or the x11 version.
 
Last edited:
I haven't used all of them, so I can't make a recommendation. One thing to note about Qt though, is to make sure you understand its licensing. It is less free than the others, and for some uses, you'll need to buy a license.

You want the X11 version for Linux development (X11 refers to the X Window System). And it's my pleasure to help :)
 
hey, thats cool

i just noticed that my linux version, mandrake, comes with qt developer pre-intstalled. it looks an awful lot like visual basic, which is perfect for making my battleship game :) . is visual c++ pretty much the same thing? now, if i can just remember how vb worked again...
 
Back