|
HB posted:Manipulating a character display the way NetHack does isn't really the same as "lines or pixels". Yeah I know that much, I just haven't found the basic idea behind the graphics in that game, graphics that for some odd reason I really enjoy.[/QUOTE] HB posted:The best way to quickly make something appear on the screen is probably OpenGL with GLUT. A program that opens a window and draws some simple shapes can come in under 30 lines. Once you're comfortable with that, you can leave GLUT behind to do your own context setup, and you're off and running. Oh I never realized I'd have to use something like OpenGL. Haha I thought it'd be like QBASIC and have a command or two for drawing to the screen, I'm retarded. Thanks though, I'll look that up! edit: I checked out some of the sample source code, thanks again this is exactly what I was looking for fret logic fucked around with this message at 01:52 on Apr 1, 2008 |
# ? Apr 1, 2008 01:47 |
|
|
# ? May 18, 2024 09:12 |
|
fret logic posted:Yeah I know that much, I just haven't found the basic idea behind the graphics in that game, graphics that for some odd reason I really enjoy. If you want to examine a simpler game using ncurses, read the source code for bombardier. If you want something shinier, SDL is probably a better choice than GLUT.
|
# ? Apr 1, 2008 03:20 |
|
Scaevolus posted:If you want something shinier, SDL is probably a better choice than GLUT. I was also going to suggest SDL. It handles everything you need for media applications in a cross-platform manner. It has methods for handling input, audio, video, and even networking. All of its facilities are very low-level, but there are libraries that abstract it up further, as well as the ability to just use OpenGL. I personally use SDL with OpenGL for video and SDL_mixer for audio and handle input on my own. My games compile in any of the three major operating systems with no modifications and only one #if, so that's awful nice.
|
# ? Apr 1, 2008 04:50 |
|
I am looking into programming a game and I had a question which google is proving useless to answer, possibly because I am asking it the wrong questions. The art assets for this project I want to store in such a way that only the program can retrieve them(the artists are VERY protective of their work). By this I mean how most games you play don't have big folders of jpgs for everything, they have some sort of data file that is read when loading a level. What is the best way to implement this?
|
# ? Apr 1, 2008 18:31 |
|
TurtleBoy posted:I am looking into programming a game and I had a question which google is proving useless to answer, possibly because I am asking it the wrong questions. Point out to the artists that no matter how much work you spend hiding the art, people will still be able to take screenshots of it.
|
# ? Apr 1, 2008 18:50 |
|
TurtleBoy posted:I am looking into programming a game and I had a question which google is proving useless to answer, possibly because I am asking it the wrong questions. The best way to implement it is zlib; the data files are just compressed directory trees. You won't be able to stop people from taking the art if they really want it, so you may as well save yourself some work.
|
# ? Apr 1, 2008 18:56 |
|
TurtleBoy posted:What is the best way to implement this? Do not distribute your game.
|
# ? Apr 1, 2008 19:01 |
|
tef posted:Do not distribute your game. Haha, pretty much. If someone wants the assets in your game, they're going to get it.
|
# ? Apr 1, 2008 19:43 |
|
HB posted:The best way to implement it is zlib; the data files are just compressed directory trees. this sounds like what I am looking for. We only really want to keep idiots at bay. Of course anyone can screenshot it but we just want the source files somewhat hidden from... "Hur! look at all jpegs thats just what I needed to make my own game! I can't wait to tighten up those graphics on level 3!"
|
# ? Apr 1, 2008 19:48 |
|
TurtleBoy posted:this sounds like what I am looking for. Scaevolus fucked around with this message at 05:07 on Apr 2, 2008 |
# ? Apr 2, 2008 02:34 |
|
In c++, is there anyone to code this: Switch statement.. { . . . } if (default case in above switch statement was reached) return false; ?
|
# ? Apr 4, 2008 00:16 |
|
Is there something wrong with doing this?code:
|
# ? Apr 4, 2008 00:24 |
|
Soldat posted:In c++, is there anyone to code this: code:
|
# ? Apr 4, 2008 00:27 |
|
Thank you for the quick response, it's what I needed, although I feel sort of stupid for not thinking of it...must be stressed. Thanks again
|
# ? Apr 4, 2008 00:32 |
|
Is there a way to truncate a stream at a certain offset? That is, suppose I have a file open and want to delete a line of text and shorten a file by so many bytes. I can shift the subsequent lines of text with no problem, but there'll be extra space at the end, which kind of defeats the purpose in this case.
|
# ? Apr 6, 2008 02:53 |
|
Avenging Dentist posted:Is there a way to truncate a stream at a certain offset? That is, suppose I have a file open and want to delete a line of text and shorten a file by so many bytes. I can shift the subsequent lines of text with no problem, but there'll be extra space at the end, which kind of defeats the purpose in this case. The ftruncate(2) system call is probably what you want.
|
# ? Apr 6, 2008 02:56 |
|
It's pretty much essential that this work with stream objects, since the only guarantee I have is that the stream is open for writing, and supports random access. Nine times out of ten, it'll be a file, but it's entirely possible that the file will be run through a Boost.Iostreams filter like gzip.
|
# ? Apr 6, 2008 03:07 |
|
Can anyone recommend any good books on compiler / interpreter / language theory, lex and yacc, etc? Thanks.
|
# ? Apr 6, 2008 07:35 |
|
xgalaxy posted:Can anyone recommend any good books on compiler / interpreter / language theory, lex and yacc, etc? Compilers: Principles, Techniques, and Tools, aka the Dragon Book, is the gold standard.
|
# ? Apr 6, 2008 07:38 |
|
Aside from the Dragon book, I would also recommend Modern Compiler Implementation in Java by Appel (or ML or whatever the other one is)
|
# ? Apr 6, 2008 16:07 |
|
I am trying to write a program in C that will read a text file as input and store the numbers in several arrays. I have code that will read the first line in the file and store it into the array 'L', but I can't find anything about reading in more than one line. I want to use fscanf instead of get so I don't have to go through the hassle of conversions, since I already know what the format of the file will be, and I'm using spaces and newlines as delimiters. Does anyone know how to read separate lines into different arrays using fscanf?code:
code:
Morgen fucked around with this message at 16:44 on Apr 6, 2008 |
# ? Apr 6, 2008 16:23 |
|
Morgen posted:attributes.txt code:
&L[2] is the same thing as L+2, but I think the first is clearer. Scaevolus fucked around with this message at 19:23 on Apr 6, 2008 |
# ? Apr 6, 2008 19:16 |
|
Scaevolus posted:If that's all your attributes.txt is, then try... I can't seem to make it work, it gives me a runtime error. Am I missing something important? I didn't realize that fscanf would treat spaces and newlines the same and continue putting things into the array until it reached the end of the file until I saw your code though. Thank you! As a (hopefully) temporary solution, I've just saved all of the numbers into a temp array, and then copied the relevant parts to the right arrays from it. It still seems rather inelegant though, and I wish I could make your solution work.
|
# ? Apr 6, 2008 19:56 |
|
Morgen posted:I can't seem to make it work, it gives me a runtime error. Am I missing something important? Well, I did omit "#include <stdio.h>" from the first line.
|
# ? Apr 7, 2008 01:06 |
|
Can anyone see anything wrong with these function declarations? I keep getting "previous declaration of 'readFlights' was here" and "previous declaration of 'print_flight' was here" when I try and compile it.code:
|
# ? Apr 7, 2008 04:20 |
|
Is your header protected by #ifdefs? That error means that the compiler passed over the same declarations twice.
|
# ? Apr 7, 2008 04:23 |
|
Captain Frigate posted:Can anyone see anything wrong with these function declarations? I keep getting "previous declaration of 'readFlights' was here" and "previous declaration of 'print_flight' was here" when I try and compile it. It means you're including declarations of those functions more than once, and the different declarations don't match. The most obvious way is if you accidentally have an older version in a different header file or something. I see you use a lot of custom types (airport, route, etc.) so, assuming that's in a header file, it could be you're including the header file twice and redefining one of those types in between.
|
# ? Apr 7, 2008 04:27 |
|
well, that wasn't the whole thing. The whole one is:code:
|
# ? Apr 7, 2008 04:35 |
|
Does your header include #ifndef guards?
|
# ? Apr 7, 2008 04:42 |
|
JoeNotCharles posted:Does your header include #ifndef guards? No. Could that be what is causing the problem?
|
# ? Apr 7, 2008 04:45 |
|
Captain Frigate posted:No. Could that be what is causing the problem? No, I was just wondering.
|
# ? Apr 7, 2008 04:46 |
|
JoeNotCharles posted:No, I was just wondering. I had no idea what that was before you brought it up and I searched for it. Some people don't already know a language back and forth.
|
# ? Apr 7, 2008 04:55 |
|
Captain Frigate posted:I had no idea what that was before you brought it up and I searched for it. Some people don't already know a language back and forth. The point is, why would I have asked (not to mention I'm the second person to bring it up) if it wouldn't be causing the problem?
|
# ? Apr 7, 2008 05:04 |
|
JoeNotCharles posted:The point is, why would I have asked (not to mention I'm the second person to bring it up) if it wouldn't be causing the problem? I have no idea. As far as I know, you might have assumed that they were in there and that the problem was that they were interacting with something else in a strange way.
|
# ? Apr 7, 2008 05:09 |
|
...this is the thread for answering programming questions. Is that process really so complicated? Yes, it's almost certainly the lack of that that is causing the problem. There's a point in your code where airport.h can be reached through two different include statements (one to airport.h itself, one to another file that also includes airport.h), so the compiler thinks it's been defined twice. haveblue fucked around with this message at 05:19 on Apr 7, 2008 |
# ? Apr 7, 2008 05:16 |
|
JoeNotCharles posted:The point is, why would I have asked (not to mention I'm the second person to bring it up) if it wouldn't be causing the problem? It would only cause a problem if there is another header file, which he's already said there is not. Unless he's doing something weird like including C files.
|
# ? Apr 7, 2008 16:03 |
|
Llama Patrol posted:It would only cause a problem if there is another header file, which he's already said there is not. Unless he's doing something weird like including C files. No, only one header file is needed for the problem JoeNotCharles is diagnosing. If the file Captain Frigate mentioned is called header.h and is included by both file1.cpp and file2.cpp, it is enough to cause a problem. This problem is fixed exactly as JoeNotCharles said, with ifndef guards.
|
# ? Apr 7, 2008 16:11 |
|
6174 posted:No, only one header file is needed for the problem JoeNotCharles is diagnosing. If the file Captain Frigate mentioned is called header.h and is included by both file1.cpp and file2.cpp, it is enough to cause a problem. This problem is fixed exactly as JoeNotCharles said, with ifndef guards. You're definitely wrong in C. I'm a C programmer primarily and don't do much in C++, but I'm pretty certain it's the same. Two files, file1.c and file2.c, can include the same header file without a problem, because both C files get compiled independently of each other. They have no idea about each other at compile time, so there's no conflict. When it's time to link, again there's no problem, because the contents of the header file are "hidden" in file1.o and file2.o.
|
# ? Apr 7, 2008 17:17 |
|
Llama Patrol posted:You're definitely wrong in C. I'm a C programmer primarily and don't do much in C++, but I'm pretty certain it's the same. Two files, file1.c and file2.c, can include the same header file without a problem, because both C files get compiled independently of each other. They have no idea about each other at compile time, so there's no conflict. I just checked it and you're right, you need two headers and one header to include the other header. I know this kind of poo poo happens in Fortran as that is what I spent several hours last week fixing exactly this problem, I must have gotten confused.
|
# ? Apr 7, 2008 17:31 |
|
|
# ? May 18, 2024 09:12 |
|
I would like some help figuring out how to use ncurses or something similar under Visual C++. I am a bit new to both C++ and MSVC++, but I would like to do some text-based GUIs. With some google searching, I have at least figured out that people have been able to use pdcurses in VC++, but I haven't found any clear how-to. Can someone give me a link to a how-to for installing ncurses or pdcurses for use in VC++ 2005 EE, or else give me a clear step-by-step?
|
# ? Apr 7, 2008 21:54 |