Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: programming resources help me plz  (Read 802 times)

Scood

  • Bay Watcher
  • The cake is both a lie and truth until observed
    • View Profile
programming resources help me plz
« on: March 25, 2011, 09:55:55 pm »

hi i'm pretty much a beginner in c++ but i think i have the language down enough to start programming actual windowed programs in windows. problem is i am having trouble finding any resources on both windows and graphics programming in C++ and directx the ones i do find are either outdated or don't compile even when i copy and paste it probably cause their outdated.
Logged
...............___@@@__                  
......_____//__?__I_?_\______
----o--THIS IS THE POLICE-@)
-----`--(@)=====+====(@)-----

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: programming resources help me plz
« Reply #1 on: March 25, 2011, 09:59:00 pm »

Depending on the errors you get, it is more likely to be a problem with missing libraries or compiler options, since the language itself is generally stable.

I don't know much about directx, but you might need to download a SDK before you have the files nessecary to use it.
Logged
Eh?
Eh!

Scood

  • Bay Watcher
  • The cake is both a lie and truth until observed
    • View Profile
Re: programming resources help me plz
« Reply #2 on: March 25, 2011, 10:23:17 pm »

well even if it is a problem with missing dependencies what i am asking for are some resources, i have tried several books and websites and the only book even remotely useful to me was "Beginning C++ Through Game Programming, Third Edition" by Michael Dawson the book doesn't go into windows programming or directx but it did an excellent job of teaching C++.
can anyone recommend some resources.
Logged
...............___@@@__                  
......_____//__?__I_?_\______
----o--THIS IS THE POLICE-@)
-----`--(@)=====+====(@)-----

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: programming resources help me plz
« Reply #3 on: March 25, 2011, 10:26:56 pm »

I don't know much about directx, but you might need to download a SDK before you have the files nessecary to use it.
This is indeed the case.

As for windows programming, there are several varieties of programming a window. If you have/have access to a paid-for version of Visual Studio, they can automatically generate the window you need for DirectX programming. If not, web and text resources will be your only option. I personally use Win32 for creating my windows; in general, you will find them enough of a pain to do as much as you possibly can using DirectX rather than Win32. As for aforementioned resources...
http://www.winprog.org/tutorial/ <--- TheForger's Win32 tutorials are good for getting a handle on things; visual studio express edition is a pain to create resources with (such as menus) and so you are probably better off leaving those out where ever possible.

As for DirectX tutorials, there are various ones of various quality scattered around the net. My first DirectX stuff ended up being copypasta from no less than 3 sources. Be prepared for a lot of tinkering to make things work. The book which served me well thus far was Frank D Luna's "Introduction to 3D Game Programming with DirectX 9.0c;" the book more or less assumed you know how to make your win32 work, although it does have a short tutorial in the appendices.

As for lots of complete source code which should be capable of running straight out of the box, I found this extremely useful: http://www.directxtutorial.com/tutorial9/tutorials.aspx
HOWEVER: BE CAREFUL WHEN USING THESE TUTORIALS!!! They make use of the old 'fixed vertex format' of rendering and so you will want to transition to the more standard programmable rendering pipeline (HLSL shader language) ASAP. Especially since the site's free areas only consist of the most basic examples. FVF is much easier to use than shaders programmed with HLSL, but much less powerful. There's a reason DX9 was the last version of DX it was included in.

You could start on another, more modern version of DirectX, but most if not all of the changes will be of no consequence until you get deep into it. You should start with at least 9, but it really all depends on what sort of tutorials and books you have at your disposal. Be prepared for a lot of failure, a lot of time sunk into it, and a hell of a lot of copy-pasta spaghetti code. Oh, and if you are getting linker errors or other various nonsense, it is probably due to not having the SDK installed correctly. I originally tried to program DirectX in a compiler incompatible with such libraries >_<

FakeEdit: Considering you are using Michael Dawson's book, I would assume the 3rd edition still uses Dev BloodShed C++? Because that is the aforementioned compiler incompatible with the DirectX libraries I used. I learned C++ from 2nd edition of that book. :) Pick up a free copy of Visual Studio C++ Express Edition if you don't already have it.

EDIT 1: VISUAL STUDIO '08 EE:
Now; you wanted specifics... I used '08 EE, although at this point you will either have '08 if you previously installed or '10 if it is relatively recent. For '08, in the main menu bar up top, click on the tools->options. In the menu which opens up, click on the arrow to open up submenus under 'Projects and Solutions,' then go to the 'VC++ Directories' one. On the pulldown menu in the top right, go to 'includes' and 'libraries' and add in the appropriate paths to your SDK's includes and libraries. Have them linked to the correct set of libraries (x86 is what you will want IIRC, as those are standard 32 bit, and you will likely be using them instead of their 64 bit counterparts).

EDIT 2: VISUAL STUDIO '10 EE:
I haven't used the EE of this version, although I would assume this part changed in a similar way to the paid-for version. In these new versions, the directories have to be set in a different place; although their old location from the above steps will tell you where that new place is. For these, you can go to the Project->Properties, Configuration Properties->VC++ Directories. Add in the paths for the include and library section to the includes and library sections of the SDK.
In the image above, you can add directories by clicking on the little down arrow which appears to the right after clicking the box once and clicking Edit.

When you do start getting into the directX stuff, you will find less and less pure source code, and many more snippets. Some of the stuff requires a thousand lines or so of code in order to run; these are pretty much impossible to put in a print book, although you will probably still find example code you can download online. There is also the matter that for some things there is no 'right way,' but rather a variety of different ways which are better or worse for different purposes. I learned by jerry-rigging code bits from tutorials on top of one another, adding more until I no longer could, and starting from the ground up doing it all better again.
« Last Edit: March 25, 2011, 11:08:20 pm by alway »
Logged

Scood

  • Bay Watcher
  • The cake is both a lie and truth until observed
    • View Profile
Re: programming resources help me plz
« Reply #4 on: March 26, 2011, 01:58:45 pm »

thank you for the effort you put in to help me.

edit: you have no idea how refreshing it was when i created my first windows program/fake virus after searching the internet for tutorials for several weeks i feel like I've made the most progress thanks to those tutorials.
« Last Edit: March 26, 2011, 05:50:37 pm by Scood »
Logged
...............___@@@__                  
......_____//__?__I_?_\______
----o--THIS IS THE POLICE-@)
-----`--(@)=====+====(@)-----

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: programming resources help me plz
« Reply #5 on: March 26, 2011, 08:04:04 pm »

Ya, I know what you mean. I was in pretty much the same place as you a bit over a year ago. I spent the entire first week of winter break digging around trying to figure out how to make it work.

Things should go relatively smoothly up until you get to programmable shaders (HLSL shader language), at which point there may be a few conceptual hurdles as far as understanding how that system works. With HLSL, you are writing code which is actually executed on the somewhat different architecture of the GPU.

If you have money for books, Frank Luna's book I mentioned above served me well, and can be had for about $30 on Amazon. For HLSL shader language, "Programming Vertex and Pixel Shaders" by Wolfgang Engel seems to be a good reference material with lots of example shaders ranging from simple to really complex. However, much of the book consists of complex effects, which I honestly haven't even read through yet. As such, you could probably find decent enough references online for any of the more basic effects (and Luna's contains a few simple shaders, although their examples can be a bit vague at times). The tricky part is grasping how the vertex and pixel shaders work at all; the syntax is easy and the actual shader code is typically rather short.
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: programming resources help me plz
« Reply #6 on: March 28, 2011, 10:35:14 am »

Posting to follow. As a C++ student myself, I offer my gratitude for the information, alway.
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting