MattyRobot 22 Junior Poster in Training

edit: don't worry, forget I said anything :icon_redface:

MattyRobot 22 Junior Poster in Training

but I have looked at this tutorial and it uses glut to make the window and print to it, how come?

MattyRobot 22 Junior Poster in Training

I have downloaded the source but I don't know what to do now, if I make a new glut project and select the source folder and it says its invalid, what do I do now?

MattyRobot 22 Junior Poster in Training

oh. no i didnt. i just downloaded the glut-3.7.6-bin. so i download the source then...

MattyRobot 22 Junior Poster in Training

yay i solved something:):):):icon_cheesygrin:

MattyRobot 22 Junior Poster in Training

yes I followed that tutorial, but it doesn't work. when I try to compile anything I get errors like [glut function name] wasn't declared in this scope and unused variable [glut function name]. In that tutorial it talks about putting a .a file somewhere, but there wasnt a .a file in the download?

MattyRobot 22 Junior Poster in Training

i have spent some time trying to install glut in code blocks and so far I haven't succeeded. i have downloaded the glut-3.7.6-bin from here . I have looked at tutorials on where to put the files in the download (like here) but it doesn't work. :icon_question::icon_question::icon_question:

MattyRobot 22 Junior Poster in Training

have you tried this code?

#include <stdio.h>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

class M
{
	public:
		int value1;
		int value2;
};

class P
{
	public:
		int sum(M n){
			int t = 2;
			int s = n.value2 + t;
			return s;
		}
};

int main(){

    M m;

    P p;

    m.value1 = 1;
    m.value2 = 2;

    int res = p.sum(m);
    cout << "sum is: " << res;
    cin.get();
    return 0;
}
MattyRobot 22 Junior Poster in Training

I compiled it with minGW in code blocks and it worked fine (after I added return; and took main() out of a class) so maybe its something to do with the compiler/ ide your using

MattyRobot 22 Junior Poster in Training

so if I was making a game I would use both then, open GL to draw to the screen and glut to handle input. thanks

MattyRobot 22 Junior Poster in Training

what is the difference between openGL glut and openGL?

MattyRobot 22 Junior Poster in Training

ok then, openGL as a priority

MattyRobot 22 Junior Poster in Training

and um... why win32 api? what use will this be to me?

MattyRobot 22 Junior Poster in Training

ok, i will learn a bit of win32 from here:
http://winprog.org/tutorial/
then i will have a look at:
http://www.videotutorialsrock.com/index.php
thanks :icon_cheesygrin:

MattyRobot 22 Junior Poster in Training

as I said i am new to classes, with a few minutes of tinkering I moved the implamentation of pet.edit() to after the function declarations and the class to above the functions but below the global variables. that is a better way though, I will change it. thanks for teaching me something
:)

tux4life commented: Thanks for using code tags, and for being nice :) +22
MattyRobot 22 Junior Poster in Training

you know i just came to that conclusion when I reset the code to an earlier date when it worked, and remade the class, it didnt work so i put it where i put the pet struct! and it worked.

(I'm learning)
and the reason I didn't figure out the bug in the fist place is because I didn't know whether I could use functions inside a class

and thanks for everyones help ;)

MattyRobot 22 Junior Poster in Training

have fun (sarcastic)

MattyRobot 22 Junior Poster in Training

OK, ill give you the whole poject, this is my first big project in c++ (I know I'm stupid and shouldn't start big, but it worked until I added classes)
be warned its over 1600 lines of code (and I don't want to waste too much of your time)

MattyRobot 22 Junior Poster in Training

I understand what your saying but I have been programming for about a year and I think I am ready, as I can go at my own pace, and I am going to get a book to learn from. I'm asking because I don't know where to go from here.
I want to learn one of the api's but which one would be better to learn. would openGL do everything that direct3d can?

MattyRobot 22 Junior Poster in Training

Yes sorry, I wrote that in a hurry, but that isn’t the problem with the other code. I know that sort of defeats the object of the example but with the code I wrote I had included all the things you mentioned and still didn’t work. the function had a prototype and the class had a semicolon. but the compiler said that the function was not declared in the scope. however i will look through the code again and see if it was somthing else

MattyRobot 22 Junior Poster in Training

how can I use a function inside an object?
(the code is too long to put here but here's a replica)

class example {
    public:
    example();
    ~example();
    
    void doSomthing() {
        afunction();
    }

}

void afunction() {
    //do more things
}

in this example i wouldnt NEED to use a function but I do need to in my code.
when I try to compile the program I get errors like:
error: 'functionName' was not declared in this scope. and
error: unused variable 'functionName'

MattyRobot 22 Junior Poster in Training

how much more do i need to know then? i can:
print to a console (obviously)
take user input
use files
use loops (for, while, do)
use decisions (if, if else, switch ect)
and i grasp the concept of how memory is allocated
and i am begining to use classes (and i understand constructors/destructors)

and this isnt the first language i have programmed in.

MattyRobot 22 Junior Poster in Training

I have recently learnt the basics of c++ but I want to advance to making proper GUI's (and games) but I don't know what to use.
I think the two most popular libraries are OpenGL and Direct3d but I'm not sure which one to use.
could you guide me in the right direction:)