Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all articles
Browse latest Browse all 2748

Forward declaration in Cocos?

$
0
0

@digimikeh wrote:

Hi !, i have created a simple struct that manages some functions for all scenes, some parameters are owned by cocos, so i need to forward declare those types.

#ifndef __HELPER_H__
#define __HELPER_H__

#pragma once

struct Color3B;
class Label;

struct helper {

private:
	const float C_LOAD_SCENE_FADE_TIME = 0.5f;

public:
	template <typename T>
	void load_scene(T scn, Color3B col);	
	void write_text_on_label(Label*& et, const char* txt, Color3B col);
	void play_SFX(const char* sfx_file);
	void play_BGM(const char* bgm_file, bool loop = false);

};

#endif //__HELPER_H__

Then i get the error some incompatible declaration errors, suspect i have not forward declared correctly…

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 2748

Trending Articles