Register
Email: Password:
Forum » Learning C++
  • « previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • » next
  • Learning C++

    Click 19 years ago
    What program would you need to make sounds?
    #
    Marevix 19 years ago
    Either a recording studio (or a garage and a sensitive microphone if you must) and several instruments or a midi composer for the music. A microphone and recording software for sounds. You usually don't have to make sound effects, you can find clips of cows mooing on the internet if you must put a cow in your game.
    #
    void 19 years ago
    Here are some things that have been annoying me for ages so if anyone can help please do.

    IDirect3DDevice9* device;

    What does it mean to have the * at the end of the word? Normally it's in front like *IDirect3DDevice9

    Also what does DWORD mean? I think I knew at one point but I'm not sure ops:

    That's all for now, HELP!
    #
    Amarth 19 years ago
    the * means this will be a pointer, thus :
    IDirect3DDevice9* device;
    means you'll create a variable named 'device' that will contain the adress of a 'IDirect3DDevice9' object. This * must always, i think, be between the type of the variable, and the variable's name.
    A DWORD is an amount of bytes, i think 4 or 8 bytes, don't know it exactly .

    -Amarth
    #
    void 19 years ago
    So are you saying you could write IDirect3DDevice9 *device and you'd get the same result?
    #
    Amarth 19 years ago
    Yes. I just checked it myself, it says 'skipping (no relevant changes)' at compile time, so i bet they are exactly the same.

    -Amarth
    #
    void 19 years ago
    Thanks, I'll make sure I never blow up your house.
    #
    Neoecs 19 years ago
    an DWORD is 4 bytes... <!-- m --><a class="postlink" href="http://www.google.com">http://www.google.com</a><!-- m --> the hackers/programmers best friend

    [EDIT] btw, does anyone want to test my 2d Tron game made in c++ using the Allegro lib?? i can also give out the source on request, if it helps anyone learning...
    #
    Amarth 19 years ago
    Sure we want to test . Give us a link/way to contact you... (or PM any of these to me ). Source is not needed for me, since I'm not using Allegro I'll most probably just confuse me .

    -Amarth
    #
    Neoecs 19 years ago
    "Amarth" said:
    Sure we want to test . Give us a link/way to contact you... (or PM any of these to me ). Source is not needed for me, since I'm not using Allegro I'll most probably just confuse me .

    -Amarth

    It's still very crappy as it was the first game i ever made and it was made after 2 hours of c++/allegro learning.. anyway, add me on MSN... <!-- e --><a href="mailto:s_manitski@hotmail.com">s_manitski@hotmail.com</a><!-- e --> feel free to add me everybody
    #
    Marevix 19 years ago
    If you want to, you could submit that as the first game in the amateur game making contest (providing that void allows it, considering how it was probably made before the start of the contest). I'm astonished you could make a game with 2 hours worth of knowledge, however.
    #
    void 19 years ago
    Yeah he can enter it but I'd suggest he make a few modifications if he plans too becuase he's got a few months before the comp ends.


    (providing that void allows it, considering how it was probably made before the start of the contest)

    bow-ya! People think I'm in charge, all entrants must make a human sacrifice to me...... I'd be a really "drunk-with-power" type moderator.
    #
    Neoecs 19 years ago
    I dont think it's worth to submit... mayby after alot of modifications... I gonna add a menu, options, and so you can run like best of 3 or something..
    #
    HarmlessHermit 19 years ago
    You still have plenty of time. Try something more ambitious, you'll learn more out of it and probably be more proud of the result as well.
    #
    void 19 years ago

    if ( wParam = VK_RIGHT) {
    g_rotationY = timeGetTime()/1000.0f;
    SetupMatrices(); };



    ok so I wrote this little bit of code to rotate the direction my mesh (tiger) is looking. The problem is that timeGetTime() is the systems time and it keeps going after I take my finger off the right arrow key.

    So I'm sort of asking if anybody knows of any time classes or something that I can pause so that when the person presses the right arrow key it will rotate from where it left off. Is there a simpler way to go about doing all this?
    #
    Amarth 19 years ago
    Keep a variable called 'rotation' or so, that keeps the current rotation of the tiger, and when the left arrow is pressed, add like 15 degrees to it, when the right arrow is pressed, substract 15 degrees from it. I would do something like:
    (this assumes a tiger struct/class, but you'll get the idea i think)


    #define ROTATION_OFFSET 15
    ...
    if ( wParam = VK_RIGHT)
    tiger->rot -= ROTATION_OFFSET


    Try it and tweak the rotation offset when you're turning too fast/slow.

    -Amarth
    #
    void 19 years ago


    if ( wParam = VK_RIGHT) {
    g_rotationY += 0.5;
    SetupMatrices(); };


    Thanks it works now

    I don't know why I didn't think of doing that myself...... I guess I just wasn't thinking. ops:
    #
    Marevix 19 years ago
    I'm experimenting with writing to and reading from .txt files in C++. I can make a program that writes to a .txt file successfully, but whenever I try to make it read from that text file, it only shows the first word. Here's the code.

    #include <iostream>
    #include <fstream>

    using namespace std;

    int main()
    {
    char txt[100];

    ofstream a_file ( "hat.txt" );
    a_file<<"I AM the Warhat.";
    a_file.close();
    ifstream b_file ( "hat.txt" );
    b_file>> txt;
    cout<< txt <<"\n";
    cin.get();
    }
    #
    ville 19 years ago
    I'm not so sure the >> operator really reads the whole file. Might want to read the docs.
    #
    NeoGangster 19 years ago
    "ville" said:
    I'm not so sure the >> operator really reads the whole file. Might want to read the docs.
    I think it just reads till the next space
    so if you have something like that in your file

    Hello there

    you would just get the Hello so you need to load every word
    I think there was a possibility to read till end of file but I don't remember...
    I never needed to read till end of line I just needed always to read something from a special position
    #
    Flikerator 19 years ago
    I was going to make a new thread but I saw this one...

    What is the difference between C and C++. Which one would you recomend?
    #
    Grim Reaper 19 years ago
    C is the older version of C++.

    I think you should use C++.
    #
    Casanova 19 years ago
    You can use C if you dont plan on making use of the object oriented programing syntax that comes with C++
    #
    Flikerator 19 years ago
    Alright thanks. Is there any compilers that compile both C and C++?
    #
    Grim Reaper 19 years ago
    Don't C++ compilers also compile C?
    #
    Flikerator 19 years ago
    "Grim Reaper" said:
    Don't C++ compilers also compile C?

    Im not sure because I havnt tried. Thats why I was asking.
    #
    NeoGangster 19 years ago
    "Flikerator" said:
    "Grim Reaper" said:
    Don't C++ compilers also compile C?

    Im not sure because I havnt tried. Thats why I was asking.
    afaik c++ compilers compile C because C is a part of C++
    #
    Amarth 19 years ago
    C++ is C with classes (amongst other things). All C code is valid C++ code. So all C++ compilers compile C code. You can use C as well as C++, and you can mix both, it doesn't matter. C++ offers some pretty useful things though.
    Bloodshed's Dev-C++ is a good, free, and ANSII-C++ standard, compiler. The other alternative is Microsofts Visual Studio .NET, which is not free but has a lot better debuggers and nice features. But, it's a MS, and it'll cost you... But the students version is supposed to be affordable.
    Don't think about older Visual Studio versions. I started my project with VS 6, but it didn't compile perfectly valid overloaded functions. I just got Dev-C++ and it ran perfectly... So now I use Dev-C++. Not a perfect tool, but it does the job .

    (btw, does anyone know what is wrong with indentations in Dev-C++? It seems to randomly choose between 8, 6, 5 or 4 spaces, not very helpful )

    -Amarth
    #
    ville 19 years ago
    It's automatic in it. You can change it somehow in the settings, but it's supposed to do a good job by itself.
    #
    Amarth 19 years ago
    Perhaps it's because it's a project I (sort of) converted from VS 6, perhaps they don't use the same indentation logic and it is a bit mixed up now.
    It's pretty annoying, but I don't care too much about it anymore... As long as the levels are visible, it doesn't matter as mch how much .

    -Amarth
    #
    Fish 19 years ago
    I cant run the program from bloodshed


    C:/WINDOWS/SYSTEM32/AUTOEXEC.NT.The system file is not suitable for running MS-DOS and Microsoft Windows applications.

    Please help me get past this

    >_>;; this might not be the best place to ask, but oh well
    #
    Grim Reaper 19 years ago
    [OT] You need to get a new one from somewhere.

    Try "C:\(windows directory here)\repair" -folder. If you find the file in question there, copy it to "C:\(windows directory here)\system32" -folder.

    If you can't find one there, then ask if someone you know has it.

    If not, then I can't help you ATM.

    PS. You should've posted your to the "Got a guestion?" -thread in General Talk. [/OT]
    #
    erendor 19 years ago
    You're my saviour, Grim! I've had that exact same problem (well, with the whole 'DOS hates me because of autoexec.nt' thing) for ages, and its hindered a whole ton of stuff. I'm really glad that I looked at this, because the repair directory for me DID have one, and now I can access DOS again! WOOHOOO!!!
    #
    Fish 19 years ago
    Thank you very much !
    Ill get learning now and maybe someday make something good


    PS. You should've posted your to the "Got a guestion?" -thread in General Talk

    Im very sorry

    So very early and I am allready having problems, I cant even run the hello world program


    //include this file for cout
    #include <iostream.h>

    int main() {

    //print out the text string, "Hello, World!"
    cout << "Hello, World!" << endl;

    return 0;

    }


    Save in a new textfile with the filename hello.ccp
    Run with the compiler

    I do as the website tells me and thip pops up:
    C:\DEV-C_~1\Bin\ld.exe:c:\docume~1\whitec~1\desktop\hello.ccp: file format not recognized; treating as linker script
    C:\DEV-C_~1\Bin\ld.exe:c:\docume~1\whitec~1\desktop\hello.ccp:1: parse error


    ...
    Maybe the note pad thing messed it up so I type the whole thing in ...

    I press compile and a small window with things like Size of output file and other things come up... I see no hello world
    ( A window pops up but it closes too fast, I cant take a good look at it)



    EDIT:
    I got it to work on the Command propmt thingy


    [/b]
    #
    HarmlessHermit 19 years ago
    Yay! The thing to keep it from disappearing is simply adding a
    system ("pause");
    before the return 0;[/code]
    #
    Forum » Learning C++
  • « previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • » next
  • Post Reply


    Your email:
    Your name: