Jump to content
  • Advertisement

styrbjorn

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

102 Neutral

About styrbjorn

  • Rank
    Newbie
  1. Hi!   I have been lurking these forums for quite some time, and recently I decided to devote more time to programming, game development and design. Therefore I created a simple website for this purpose. I work mainly in a tool called Multimedia Fusion 2 (recently upgraded to Clickteam Fusion 2.5), so when I post examples it is mostly MMF project files, but I also have a section where I will add general algorithms that should work (with some adjustment) no matter what environment you develop in. Also, I will add game concept art, pixel art and other stuff that I create when working on games.    Please feel free to visit the site, located at http://www.declared.se   If anyone has questions or ideas about algorithms and game solutions to add, I am all ears. I have to add that I am quite the beginner, though, so I might not be able to come up with more advanced stuff :)
  2. styrbjorn

    Good practice concerning header guards (C++)

    Thanks again for the constructive input. I think I am on the right path now. While pragma seems like a interesting directive, but I want to keep as close to the turotial I am following as possible, even if it's a bit boring. Taking shortcuts has been my downfall so many times before (e.g. downloading a game programming API before learning about classes and such - I lose interest when I don't know what stuff does what ). I'll keep working towards a first simple game now, but I need to cover a few more concepts first.
  3. styrbjorn

    Good practice concerning header guards (C++)

    Thanks a lot for the quick reply. The things you write make sense to me, but I am wondering where I am supposed to include iostream. If I include iostream in my main.cpp, my other cpp files does not seem to find it, but if I include it in every .cpp-file (that uses cout or cin) in the project it seems logical to me that I would end up with having multiple "copies" of iostream. Is this the case, or am I missing something? Here is the program again, after the alterations, and it still works: main.cpp: #include "double.h" int main() { int nUserNumber=GetNumber(); int nDoubleNumber=DoubleNumber(nUserNumber); PrintResult(nDoubleNumber); return 0; } double.h: #ifndef DOUBLE_H #define DOUBLE_H int GetNumber(); int DoubleNumber(int nUserNumber); void PrintResult(int nResult); #endif getnumber.cpp: #include <iostream> int GetNumber() { int nNumber=0; std::cout<<"Please enter a number: "; std::cin>>nNumber; return nNumber; } void PrintResult(int nDoubleNumber) { std::cout<<nDoubleNumber; } doublenumber.cpp int DoubleNumber(int nValue1) { return nValue1*2; } In this case, iostream is only included once, but in the previous version it was needed in two different files (getnumber.cpp and printresult.cpp). Should I just put #include <iostream> in each file in that case?
  4. I am learning C++, and I just ran into a section about header guards and how to split programs into multiple files. Let's say that I have a simple program that doubles a number entered by the user, and outputs the result on the screen. Here is my main.cpp #include "double.h" int main() { int nUserNumber=GetNumber(); int nDoubleNumber=DoubleNumber(nUserNumber); PrintResult(nDoubleNumber); return 0; } Here is double.h #ifndef _IOSTREAM_ #define _IOSTREAM_ #include <iostream> #endif #ifndef GETNUMBER #define GETNUMBER int GetNumber(); #endif #ifndef DOUBLENUMBER #define DOUBLENUMBER int DoubleNumber(int nUserNumber); #endif #ifndef PRINTRESULT #define PRINTRESULT int PrintResult(int nDoubleNumber); #endif Here is getnumber.cpp #include "double.h" int GetNumber() { int nUserNumber=0; std::cout<<"Please enter a number: "; std::cin>>nUserNumber; return nUserNumber; } Here is doublenumber.cpp: #include "double.h" int DoubleNumber(int nUserNumber) { return nUserNumber*2; } And lastly, printresult.cpp: #include "double.h" void PrintResult(int nDoubleNumber) { std::cout<<nDoubleNumber; } The reason I add iostream to my header file instead of main.cpp is that GetNumber and PrintResult needs it for cin and cout. My question is whether this is good practice or not, or something that I should solve in a different way? The program runs without any errors, but I am concerned about not picking up any bad habits along the way
  5. styrbjorn

    The first step for graphics in C++?

    Thank you - this is what I am looking for. Those are, quite conveniently, the next concepts in the tutorial I am following, and I'll make sure to have them covered before moving on to SDL (and OpenGL later on).
  6. styrbjorn

    The first step for graphics in C++?

    Thank you for the replies. I will take a look at OpenGL for now. After a bit of reading it seems like a good alternative considering I want to create applications for multiple platforms. I know that C++ is (pretty) low level, and that there are no simple ways to draw graphics "by hand" (that is, without external libraries), but I really like the concept of doing things one building block at a time (first I learn A, and by learning A I am ready to learn B etc.). I guess I should submit to the fact that using ready libraries is the way to go (after all, iostream, cstdlib and such are also libraries that I use without caring so much about how they work). Thanks again - I look forward to spending a lot of time on these forums
  7. styrbjorn

    How to make 8 bit music?

    One free alternative that I've grown quite fond of is FamiTracker (http://famitracker.shoodot.net/). Wwhile it might take some time getting used to if you have not worked with trackers before, it's a very nice tool for creating 8-bit music. Sadly I am sitting with my laptop at work right now, so I can't provide any examples of my own, but here's a cover of Dr. Wily Stage 1 from Mega man 9 (not created by me). Search some more on youtube to get an idea of what can be done with the program. http://www.youtube.c...h?v=2DVLZPDmY5I
  8. This is my first post here, and I hope that the question I am asking has not been asked and answered before. I did some searching, but didn't find specifically what I am looking for. I started with C++ about a week ago, using visual c++ express, and my goal is to start using C++ for future solo game projects. Previously I have used Multimedia fusion 2 developer to develop games, and I have so far finished and released one game with it (Cave of no return, for those that are interested). The reason I want to move over to C++ is that it seemingly provides a lot (and I really mean a lot) more freedom. Not only can C++ be used to create applications for many different platforms, but it also gives the developer great freedom to structure a project in a nice and logical way. Larger projects in MMF2 can get hard to monitor properly, and the frame based structure means that if you want to change something engine wise, you have to change it in every single frame you have created manually (at least this is my experience - I might have missed something). In C++ you can call functions from pretty much anywhere, and if something needs changing you can generally do so by altering only that specific function. So far I am still stuck to console programming in C++, and while I feel that I am starting to get a grasp of how things work (I am following the tutorials on http://www.learncpp.com/), I am pretty unsure how to start creating graphics. That is, I know a lots of ways to create graphics using tools like Allegro or SFML, but I'd rather take things one step at a time, and learn how to code stuff from the beginning (from a C++ perspective - otherwise I'd have to move to assembly/machine code level I guess, but I am not that masochistic). So, let's pretend I know all the stuff from the tutorials at learncpp.com (I don't, but I am about halfway there so far). What would be the next logical step towards gettings some graphics on the screen? If someone could point me in the right direction here I would be very thankful. Thank you.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!