31
General Jo Engine Help / SOLVED: Run Storyboard demo externally inside my game?
« on: July 04, 2018, 02:26:21 am »
I am trying to run the Storyboard demo from the C file with an attached header file, by linking the header file inside my game's main file. The name on both files matches. I added the external C file to the makefile. In the end, I'm trying to get it to work so I can gut it and make my own storyboard code. For the most part, it seems to be set up correctly, but I'm getting some errors.
Here is my header file code:
I commented out the jo_main section here and in the C file, because I assumed I needed to initialize the functions inside of jo_main in the main C file. I included the header file at the top of the external C file. Here is what I added in my main C file:
When I try to compile the project, I get an error on the storyboard C file that "static jo_storyboard *drone_storyboard;" has a syntax error before the * token. I get warnings on that part that the "type defaults to 'int' in declaration of 'drone_storyboard'", and that "data definition has no type or storage class". I also get a warning in the storyboard C file of "implicit declaration of function 'jo_storyboard_toggle'". Additionally, I get errors from the same file saying, "'jo_storyboard', 'storyboard', 'animation', 'jo_animation' undeclared". There are other related warnings, but I don't think I need to list all of them here. I haven't changed the code in the demo, other than commenting out the jo_main section and bringing up the same items inside of the jo_main in my main game file. I know this isn't super complicated, but I haven't tried doing this before. My main C file is getting too cluttered.
Here is my header file code:
Code: [Select]
#ifndef __CLOUDS_H__
# define __CLOUDS_H__
void my_draw(void);
void my_gamepad(void);
void animate_circular_saws(void);
void animate_drone(void);
void animate_sentry(void);
void init_circular_saw_sprite_and_position(void);
void init_drone_sprite_and_position(void);
void init_sentry_sprite_and_position(void);
//void jo_main(void);
#endif /* !__CLOUDS_H__ */
/*
** END OF FILE
*/
I commented out the jo_main section here and in the C file, because I assumed I needed to initialize the functions inside of jo_main in the main C file. I included the header file at the top of the external C file. Here is what I added in my main C file:
Code: [Select]
#include "clouds.h"
void jo_main(void)
{
init_circular_saw_sprite_and_position();
init_drone_sprite_and_position();
init_sentry_sprite_and_position();
animate_circular_saws();
animate_drone();
animate_sentry();
}
When I try to compile the project, I get an error on the storyboard C file that "static jo_storyboard *drone_storyboard;" has a syntax error before the * token. I get warnings on that part that the "type defaults to 'int' in declaration of 'drone_storyboard'", and that "data definition has no type or storage class". I also get a warning in the storyboard C file of "implicit declaration of function 'jo_storyboard_toggle'". Additionally, I get errors from the same file saying, "'jo_storyboard', 'storyboard', 'animation', 'jo_animation' undeclared". There are other related warnings, but I don't think I need to list all of them here. I haven't changed the code in the demo, other than commenting out the jo_main section and bringing up the same items inside of the jo_main in my main game file. I know this isn't super complicated, but I haven't tried doing this before. My main C file is getting too cluttered.