/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <cstdlib>
using namespace std;
typedef struct
{
unsigned int width;
unsigned int height;
unsigned int bitdepth;
} sBM_Bitmap;
sBM_Bitmap* GP_level_textures;
void RC_Init(sBM_Bitmap* _textures);
void LV_read_map_textures(sBM_Bitmap** _textures) {
sBM_Bitmap* textures = new sBM_Bitmap[10];
for(int i=0; i<10; i++) {
textures[i].width = rand() % 255;
textures[i].height = rand() % 255;
textures[i].bitdepth = 24;
}
*_textures = textures;
}
void GP_init()
{
// ładuje listę textur np 10 - to jest OK
LV_read_map_textures(&GP_level_textures);
// // TERAZ JEST OK - w tym momencie mogę mieć taki dostęp:
GP_level_textures[5].width = 1337;
// // chcę żeby moduł RC mógł odczytywać te dane w podobny sposób, patrz niżej
RC_Init(GP_level_textures);
}
// --- plik raycast.c
sBM_Bitmap* RC_level_textures;
void RC_Init(sBM_Bitmap* _textures)
{
RC_level_textures = _textures;
cout << "RC_level_textures[5].width = " << RC_level_textures[5].width;
}
int main()
{
GP_init();
return 0;
}