• Content count

  • Joined

  • Last visited

Community Reputation

109 Neutral

About Ryan_Burnside

  • Rank
  1. Hello fellow programmers! After some thought I've decided that I'd like to launch a little project. I've created a different forum where the focus is on presentation of effects and amusements platform independent pseudocode. The core concept of my forum is presentation of classic effects in such a way that any programmer can implement them in any language. A C++ programmer need not struggle through Lisp nor a Python programmer get lost in x86 assembly language to learn a neat effect. The effects and amusements we focus on are mostly static raster effects such as fractals. That said we also have some cellular automaton examples that are meant to be enjoyed in real time. My moderators and hand selected members have done a great job laying down some examples for you to try. We look forward to more user contributed pseudocode. It is not about compiled works, it is about giving other programmers some recreations to try on a lazy afternoon. Please join if you want to contribute! (The URL is a bit hard to remember, so do bookmark and come back ) We do have an approval system to avoid bots so please give me a few hours to approve you (I do actually sleep sometimes) http://forums.pixeloutlaw.smakweb.com/index.php <- Ultimate Effects Universe Forum Here is one such example we cover "Attractors" Learn to make such things in your language today! [img]http://i129.photobucket.com/albums/p208/Madcap-13/orderlyattractor2.jpg[/img]
  2. [C++] Execute from command line with path to file

    [quote name='grouse' timestamp='1307832291' post='4822193'] This article explains it pretty well, [url="http://www.cplusplus.com/forum/articles/13355/"]http://www.cplusplus...articles/13355/[/url] In short, assuming a main function that looks like [code]int main(int argc, char* argv[]) { /** ... **/ }[/code] the argc integer contains the size of the argv array which contains all the values passed by the command line. Doing myprogram.exe -f myfile would mean that myfile is the second value of the argv array, the first value is -f. [/quote] Thank you very much. I intend to use this file path as an argument for loading files. I seem to recall somebody mentioning that C++ cannot see outside of the current directory the application is running from. This might be a problem I guess even though I can pass an absolute path via the command line to the starting program Is this true?
  3. Hello, I'm trying to make a terminal based program that will take a path to a file as a parameter. How can this be done with C++? Something like: run my_program <pathname parameter here>
  4. Code::Blocks, CImg

    [quote name='nife87' timestamp='1307714778' post='4821709'] A quick search on Google ([url="http://msdn.microsoft.com/en-us/library/dd162974%28v=vs.85%29.aspx"]SetDIBitsToDevice[/url]) revealed that you need to link with libgdi32.a (assuming MinGW). Under Build Options - Linker Settings - Link Libraries, add gdi32. [/quote] Thank you SO much! Working now! What is a general rule of thumb process when adding a new library to a project? It seems that no two libraries share exactly the same steps...
  5. The first step for graphics in C++?

    Well you can't expect C++ to have any functions to draw and create graphics beyond simple text based visuals (terminal output). C++ is a powerful language that was developed for very low level work. However, it is quite popular and people have written libraries that allow it to work with hardware to render graphics. As far as I know there is really no way around adding a library like SFML, SDL, or Allegro. You can probably play a bit with text adventures with primitive ASCII graphics if you want to just get something visual working. I'd use a 2D screen buffer of chars to make ASCII graphics and pictures. C++ is a very lean and fast language that was made for low level work. We can adapt it to other needs however like rendering graphics, sounds, and joystick polling. In this way, C++ works like glue, by binding components together so that we can use elements and functions from libraries.
  6. Code::Blocks, CImg

    Hello, Recently I've downloaded Code::Blocks because I'd like to make projects that are open and multi platform. I want to make a very simple program that uses the C image liberary CImg. The whole library is included in a single header called :CImg.h". I've included this in the same folder as my project I wish to work on. I have also included the header file in my source code for the project. The minimum code contained in my main.cpp file looks like this: [code] #include "CImg.h" using namespace cimg_library; int main() { const unsigned char purple[] = { 255,0,255 }; CImg<unsigned char>(640,400,1,3,0).draw_text(100,100,"Hello World",purple).display("My first CImg code"); return 0; } [/code] Upon compiling I get the following errors: [code] obj\Release\main.o:main.cpp|| undefined reference to `SetDIBitsToDevice@48'| obj\Release\main.o:main.cpp|| undefined reference to `SetDIBitsToDevice@48'| obj\Release\main.o:main.cpp|| undefined reference to `SetDIBitsToDevice@48'| obj\Release\main.o:main.cpp|| undefined reference to `SetDIBitsToDevice@48'| obj\Release\main.o:main.cpp|| undefined reference to `SetDIBitsToDevice@48'| obj\Release\main.o:main.cpp|| more undefined references to `SetDIBitsToDevice@48' follow| ||=== Build finished: 6 errors, 0 warnings ===| [/code] I'm not used to really working much with external dependencies with Code::Blocks and I've not ventured beyond playing with SFML (which I got working following a tutorial). I'm working on Windows 7 at the moment if that is of any help. I'm not advanced with C++ but I have an understanding of the core library. Adding dependent libraries is really a headache it seems...
  7. [C++] STL Vector element deletion with iteration

    Thanks for the prompt help. I will implement this now and get back to you if I cannot get it working. Thanks again!
  8. I've come to love the STL and come things still confuse me a bit. I'm storing instances of a Particle in a vector. Each particle eventually has a boolean dead value set to true and it needs to be removed. How can I remove all Particles with their dead value set to true? I tried to iterate through the list and call the remove() command on the iterator but it throws an exception. The Particle instances are stored in a vector called particle_vector. [code] vector<Particle>::iterator iter; for(iter = particle_vector.begin(); iter != particle_vector.end(); iter++) { iter->update(); if(iter->dead == true) { particle_vector.erase(iter); } } [/code]
  9. I have a basic rectangle to rectangle collision check working. That was trivial. Here is the difficult part for me. I have a player that collides with rectangular "rocks". The player needs to be reset when he enters a rock. The player has a direction and a speed as he hits the rocks. When a collision is detected I need the player to jump to snap to the proper position as if he never hit the rock. A very crude method to reset the player would reverse the direction and travel backwards a pixel per cycle until he was no longer inside the rock, that has plenty of wasted iterations however. This is making me frusterated because since the early days of video games programmers have been creating solid objects and dealing with collisions. I can tell that they have collided but how do I put the player back into the proper position outside the rock? [URL=http://img23.imageshack.us/i/pokemongold.png/][IMG]http://img23.imageshack.us/img23/3070/pokemongold.th.png[/IMG][/URL]
  10. [C++] Cross platform text console?

    Hello, I've currently been toying quite a bit with the idea of a console window text based game. My target platforms will be the Windows PC and also Linux PC. Currently I have a 2d array that works as a sort of screen buffer. [code] string the_buffer[x][y]; // string buffer lets us use either unicode or ascii single characters between OSs for(char y = 0; y < 20; y++) { for(char x = 0; x < 64; x++) { // add string value to current line cout << the_buffer[x][y]; } // move to next line cout << endl; } [/code] Now I have everything drawing to the screen but I would like a platform independent way to keep blitting the buffer's contents to the screen. Also there must be some form of verticle synchronization so the screen does not have flashing and missing lines as the buffer refreshes. Also, I ask the veterans of character based games, what do I need to look out for when making a cross platform solution with the console window?
  11. [C++] Where to load global images/sprites?

    Thanks for all the help guys. This has given quite a bit to put into practice. I'm going to implement these concepts the next time I get a break in my University schedule.
  12. [C++] Where to load global images/sprites?

    [quote name='sdaq' timestamp='1295384607' post='4760885'] hey Ryan! congrats on your first post and learning C++... I agree with Dan's solution (which is certainly the right way to go), but I would suggest that you stick to your intuition... why not just load the sprite globally (not as a constant in the class but in your whole application) and then have each Ship just store a pointer to it? it's quick and easy (and also very bad) but now you have the opportunity to learn why it's the wrong way. remember, a singleton is a kind of global variable, like a monkey dressed up in a suit... Good luck! [/quote] Thanks, I asked Dan to send me an example. Now just to get my code strait. Considering my options here, how do I define a global variable? Where does it get defined inside the class or externally? I'm unsure of the syntax as they have not covered them in my classes too extensively. I understand that globals are usually in bad form, but this is a small project which will probably not have reusable objects.
  13. Hello, first post on this community. I've started learning more and more about C++ in college and decided to finally sit down and try to put some of these concepts together from what I ahve learned in class. My question is this, when creating a basic ship Class (for the player of an arcade game) who owns the sprite? I don't really want each ship to own a copy of the same sprite as that seems redundatn. Instead I think I would like to make some of the resources global so only one sprite needs to be loaded into memory. How are shared resources loaded in C++ usually? I'm using SFML which allows me to create sprites. The big question, if many ships share the same sprite how do they access the loaded sprite? Do I make the sprite a constant global variable in the definition of the Ship class? I've included the SFML library inside my ship header file so I can use functions from that library. Now should all resources used by the Ship class also be loaded in the definition of the Ship? If so how is this best done. I'm used to using Blitzmax and C++ gives the programmer many many options on how to do things.