Inside the structural programming methos refered there is stack librarys. A set of of includes files that deploys complex funcionality.
width less resurce demand? In s cases it may decreases resurces consumption wihch increases performance.
Name come from that they can stack or inherit so they are a file that works width the structure.
When you include the "file" you gain a new set of funcionality. This saves resurces because is not functions but basic code and gain a bit of reusability.
For what i tested both files .h can communicate with which other. The ".c" extension can't access which other files.
The .h files need to be in main, to work with variables, because of the single treat thing. People for what i read advice not to use variables inside .h but only declare them. This way we can use files like in PHP.
If we whant to implement several things is better to have a file then a function :
- Verifications
- Unit tests
- Errors
- Variables
- Open things
- Memory handle
- Interface load
In here we have a good and a bad example of stack lybraris. A bad example will be image since is to general is more content for a pseudo object. A good example is image_jpg which we need to load a specific set of verifications for the jpg which are only needed for the jpg but are very complex for a function.
include "button_effect_fade.c" // the fade effect "should be added".
image_jpg.h is inheriting successfully from image.h
We can see now a structure in the main. Looks is like a configuration page. (is Tweakble in the code or lather outside with a interface.)
The point of this is , if some one code a camera_RPG for their game if using a inheriting structure, can be use in your game also. A waste of time we all have to program that rpg camera again and again.
- time.h"
- error.h"
- file.h"
- string.h"
- paths.h"
- database.h"
- image.h"
- image_jpg.h"
- image_png.h"
- image_gif.h"
- sound
- keys
- resolution
- interface
- model
- model_textures
- model_animation
- model_particles
- model_bounds //colision, triggers
- model_blend
- model_DAE
- model_FBX
- model_OBJ
- camera
- camera_RTS
- camera_FPS
- camera_2D
- camera_3Person
- print_screen
- movement_RPG
- movement_Vehicles
- AI
/* GAME STRUCTURE LIBRARY */
- game
- money //timers
- loots
- spells.c"
- abilitys.c"
- items.c"
- items_sci_fi.c"
- items_rpg.c"
- items_fantasy.c"
/* TEST LIBRARY */
- //#include "variables_interface.c"
- //#include "interfaces/interface2.c"
TOOLS LIBRARY
-Interfaces can be in .c since they do not delegate any to other files.
-The previous .h files cam delegate to .c files.
*/
if(interface == 0){ // Main Menu
//printf("Main Menu loading");
#include "interfacces/main_menu_GTK.c"
//#include "interfacces/main_menu_SDL.c"
//#include "interfacces/main_menu_Free_GLUT.c"
}
else if(interface == 1){ // Character Creator
//printf("Character Creator loading");
#include "interfaces/character_generator_GTK.c"
}
else if(interface == 2){ // Shadder Tool
//printf("Interface2");
//#include "interfaces/interface2.c"
}
else if(interface == 3){ // Map Editor
//printf("Interface3");
//#include "interfaces/interface3.c"
}
else if(interface == 4){ // Variable Manager
//printf("Interface3");
//#include "interfaces/interface3.c"
}
else if(interface == 5){ // Generic Animation
//printf("Interface3");
//#include "interfaces/interface3.c"
}
else if(interface == 6){ // Particle Tool
//printf("Interface3");
//#include "interfaces/interface3.c"
}
else if(interface == 7){ // Particle Tool
//printf("Interface3");
//#include "interfaces/interface3.c"
}
else if(interface == 8){ // Level Models Position
//printf("Interface3");
//#include "applications/the_box/levels_models_position.c"
}
else if(interface == 9){ // Level Editor
//printf("Interface9");
//#include "applications/the_box/levels_models_position.c"
}
else if(interface == 10){ // Database tool
//printf("Interface9");
//#include "applications/the_box/levels_models_position.c"
}
else if(interface == 11){ // Options
//printf("Interface9");
//#include "applications/the_box/levels_models_position.c"
}
system("cls");
system("pause");
return 0; // Zero indicates success any other failed
}