A 2D array of objects in a class SFML C++ -


(If something is wrong, this is my first question) I'm sorry

Grid of rooms for the game (similarly binding to Isaac).

I have a station called 'Commanding Class' in which I want 2D array rooms, which I defined in my class room'. In my main.cpp I am using a cell object called the current cell, that I want to pass the function loadRoom in my station class with reference. This function will generate all the rooms in the array and on the basis of reference, give one back in the main CPP. I'm wasting it to work with fully designed vectors, arrays, signs of arrays and even new classes for the purpose of storage of the room, but nothing has worked. Please help me, these are my 2 classes first: station.h:

  #pragma #include "station.h" class station {public: zero break (); Zero resume (); Int h, w; station(); SF :: render window app; Sf :: image guii; SF :: Text player, BGT, Guitit, Flint; Sf :: font Arial; Zero loaded institution (room and current room); };   

Room.h:

  #pragma #include "station .h" #define defines # 16 defined M6 class station; Class enemy; Class projectile; Class Room {Public: Tile Florem [N] [M]; SF :: Texture Float, Enemy, Dibat, Shut, Diet, Dopt, Bottom, Chest; Int chest_max = 15; Int Seatcount; Bull Doth, Drift, Dop, Dobtom, Impeti; Cell (); Zero loader room (int w, int h); Std :: vector & lt; Enemy & gt; Enem; Std :: vector & lt; Projectile & gt; Proj; Zero spawn_enemy (int x, int y); };   

I must first prefer the array of the latter. Thank you.

Edit: OK, here's what I found: When I try to create 2D array just like this:

  Room Sect [10] [10] ;   

And I put it in a class before the zero loaded operation, it crashes after each other running. When I do an object in the square called 'lvl' in one place, then when I try to use a member of the room, it crashes only:

  This-> lvl-> Line [5] .column [5] .loadroom (this-> W, this-> h);   

However, when I make a vector vector, then in this way:

  std :: vector & lt; Of vector & lt; Cell & gt; & Gt; station;   

When I try to shape it, it crashes, no matter if I do it with the initiator, push_back, or vector :: resize.

The error is always the same, Application.exe stopped working.

Any thoughts?

I decided trouble. I removed the loadRoom function and put its code in the default constructor. The other problem I had with it was that the SF :: texture operator = overload was causing an accident, so I loaded the texture from files instead of copying them. I know its useless and slow speed, but in a few months I am going to write it from scratch in unity, so I do not care whether it is optimized or not.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -