Omnimaga

General Discussion => Technology and Development => Computer Programming => Topic started by: Happybobjr on October 22, 2011, 01:35:51 pm

Title: Help with C++
Post by: Happybobjr on October 22, 2011, 01:35:51 pm
Can someone plz help me set up a design environment (including a method of compilation) for C++ on Windows 7 computer?

Everything hates me.



Also: anyone know how to draw to the screen.  Like in axe you can use Pt-On() and Pxl-On()
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 01:43:49 pm
Can someone plz help me set up a design environment (including a method of compilation) for C++ on Windows 7 computer?

Everything hates me.



Also: anyone know how to draw to the screen.  Like in axe you can use Pt-On() and Pxl-On()

I recommend installing MingW. However, if you're a beginner Code::Blocks installs it together with the Code::Blocks IDE.

Drawing to the screen? You need a graphics library such as OpenGL or SDL. I recommend SDL or SFML. You can also use a GUI Toolkit, such as GTK, Qt or wxWidgets.

On Windows, you'll be tempted to use win32 or DirectX. If you want to keep your program cross-platform, never use those.
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 01:44:55 pm
However, if you're a beginner Code::Blocks installs it together with the Code::Blocks IDE.


???  rephrase that please
Title: Re: Help with C++
Post by: Scipi on October 22, 2011, 01:45:35 pm
Ok, a good compiler that's easy to set up is called MinGW. Download the installer here (http://sourceforge.net/projects/mingw/files/)

Then run the installer and install MinGW to a directory without spaces. The best place is the default C:/MinGW/

After that, go ahead and add it to your path by right clicking on "My Computer" then "Properties" then "Advanced System Settings" and finally, "Environment Variables". In the System variables field scroll down till you find "PATH". Click on it and then hit edit. Copy/Paste the directory to MinGW/bin/ onto the end of the path and add a semicolon.

And you have your compilation. :) A good IDE to use is code::blocks. Just download the windows installer and run it and you can compile with F9.

For drawing on the screen, use a library such as SFML or SDL. Just add the files in the "include" folder inside the libraries to "MinGW/include" and the same for "lib".

Hope that helps! :D

EDIT: Ninja'd :P
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 01:47:49 pm
you guys are awesome.  All I get is a bunch of junk about eclipse.  It looks like it was made for linux :/  And Linux programs on Windows just doesn't do well with me :P
Title: Re: Help with C++
Post by: thepenguin77 on October 22, 2011, 01:48:12 pm
Visual Studio (http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-cpp-express)'s been working great for me for over 2 years now. Granted I've never tried anything else, but setting up your environment is as simple as installing the program.

One of the things I love about it is that it red underlines stuff that it knows is going to cause a compiler error, that definitely improves your C++ skills ;D
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 01:48:54 pm
you guys are awesome.  All I get is a bunch of junk about eclipse.  It looks like it was made for linux :/  And Linux programs on Windows just doesn't do well with me :P

What? Eclipse wasn't made for Windows. It wasn't made for anything particular. It was made for everything.

And Eclipse has a C/C++ Plugin that allows you to use it as a C/C++ IDE, I never tried it, but a lot of people like it.
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 01:58:47 pm
I hate Visual studios in general.  They lock everything down to be just windows.... just like TI does to their products :\
It reminds me of the Zune :/
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 01:59:52 pm
I hate Visual studios in general.  They lock everything down to be just windows.... just like TI does to their products :\
It reminds me of the Zune :/

Yes, Visual Studio tempts you to develop Windows-only. I think Code::Blocks is the best thing you can use. Later, you might prefer to use a text editor and the command line, it's faster for some people.
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 02:20:44 pm
Ok  next question.

OpenGL or SDL?
I want something easy to quickly use/ learn.  And, I will probably be able to stay with in the future.
Title: Re: Help with C++
Post by: Scipi on October 22, 2011, 02:30:25 pm
SFML or SDL. OpenGL is very complex and takes a lot to learn.
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 02:34:47 pm
Ok  next question.

OpenGL or SDL?
I want something easy to quickly use/ learn.  And, I will probably be able to stay with in the future.

Do you already know the C++ syntax? It's a bit risky to jump right in to image libraries.

Either way, I recommend SDL or SFML too. SFML is younger and doesn't have much documentation. SDL is older (which can be bad) but it has more documentation and more programmers using it.
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 02:39:35 pm
ok thanks.  I am a lisle fluent in C++ due to Axe and a month of C.
So SDL then?

I think I wouldn't need to know much to port Sniper101 to computer :P
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 02:40:09 pm
ok thanks.  I am a lisle fluent in C++ due to Axe and a month of C.
So SDL then?

I think I wouldn't need to know much to port Sniper101 to computer :P

Sniper 101, hein?. I want to help :D
Title: Re: Help with C++
Post by: Scipi on October 22, 2011, 02:50:33 pm
Oh. I want to help as well. I need a project to do, lol ^^
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 02:52:24 pm
have you not seen it?  It was my first axe game <3


Note: I have changed it since, and mass optimized for speed.  (lol should probably take out of Full speed now :P )
         
Title: Re: Help with C++
Post by: Munchor on October 22, 2011, 03:04:22 pm
have you not seen it?  It was my first axe game <3


Note: I have changed it since, and mass optimized for speed.  (lol should probably take out of Full speed now :P )
         

Of course I know it, go check the topic, I was super excited about the game at the time :D
Title: Re: Help with C++
Post by: Happybobjr on October 22, 2011, 03:06:33 pm
Wow i was such a noob back then.
The biggest day of my life... when I realized how slow displaying the graph is :P
Title: Re: Help with C++
Post by: Happybobjr on October 29, 2011, 02:31:55 pm
In axe we can use Pt-On(x,y,Pic1)
How can I do that in C++.
I am using SDL
Title: Re: Help with C++
Post by: Munchor on October 29, 2011, 02:38:29 pm
In axe we can use Pt-On(x,y,Pic1)
How can I do that in C++.
I am using SDL

Try this (http://content.gpwiki.org/index.php/SDL:Tutorials:Displaying_a_Bitmap). I found it through Google (http://www.google.com), a very useful website!
Title: Re: Help with C++
Post by: Happybobjr on October 29, 2011, 02:40:03 pm
lol.  I asked here because I am very fluent in axe, so i thought you guys may be able to explain it better to me than other people :/
Title: Re: Help with C++
Post by: Scipi on October 29, 2011, 04:14:27 pm
It seems like in SDL, as in SFML, you need a pointer to the image. You take that pointer and use SDL_BlitSurface() like so:

param1: pointer to image

param 2: Rect image is stored in

param3: pointer to screen

param4: Rect with x,y coords of where to draw to the screen.

SFML, I think, has an easier drawing method of:

Code: [Select]
sf::RenderWindow App(sf::VideoMode(WindowWidth, WindowHeight, 32), "title");

sf::Image img;//Image data
img.LoadFromFile("img.png");
sf::Sprite imgSprite(img);//Pointer to data
imgSprite.SetPosition(x, y)

App.Draw(imgSprite)