Problem including file

Hello. Not shure how to describe problem.
Here is my program
'dont worry about cleaning code i just got problem using SDL_Surface* SurfScreen"from Main.h" in Loadup class/heder in function Transparent what is good way to use it there and how'

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//////FILE Main.h
#ifndef MAIN_H_INCLUDED
    #define MAIN_H_INCLUDED
#include <SDL.h>

#include "Loadup.h"

class Main
{
    public:
        static Main MainControl;
        Main();
        int Startup();
        SDL_Surface* ReturnScreen();
        SDL_Surface* SurfScreen;
    private:


};

#endif

//// FILE Main.cpp
#include "Main.h"

Main Main::MainControl;

Main::Main()
{

}

int Main::Startup()
{

    return 0;
}

SDL_Surface* Main::ReturnScreen()
{
    return SurfScreen;
}

int main(int argc,char* argv[])
{
    Main ObjMain;
    return ObjMain.Startup();
}

///// FILE Loadup.h
#ifndef LOADUP_H_INCLUDED
    #define LOADUP_H_INCLUDED
#include <SDl.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_mixer.h>


class Loadup
{
    public:
        static Loadup LoadupControl;
        Loadup();
        bool LoadStart();
        SDL_Surface* LoadImage(char* File);
        void Transparent(SDL_Surface* Surf, int R, int G, int B);

    private:

};

#endif

//// FILE Loadup.cpp
#include "Loadup.h"

Loadup Loadup::LoadupControl;

Loadup::Loadup()
{

}

bool Loadup::LoadStart()
{
    if((SDL_Init(SDL_INIT_EVERYTHING) < 0)
       )
    {
        return false;
    }
    return true;
}

SDL_Surface* Loadup::LoadImage(char* File)
{
    SDL_Surface* Made;
    SDL_Surface* Returning;

    if((Made = IMG_Load(File)) == NULL)
    {
        return NULL;
    }
    Returning = SDL_DisplayFormat(Made);
    SDL_FreeSurface(Made);

    return Returning;
}

void Loadup::Transparent(SDL_Surface* Surf, int R, int G ,int B)
{
    SDL_SetColorKey(Surf, SDL_SRCCOLORKEY, SDL_MapRGB(SurfScreen, R, G, B));
}

Last edited on
You just have to include Main.h and use it.
Thx for help...
i had error doing that before. i gues i had tipo error
Topic archived. No new replies allowed.