Conway's game of life is a fun project. It's quite entertaining to watch too :)
It looks like, in your function calculate(), your "for" loops go from 0 to H or W. The problem is, you then test the state of each cell just around mata[n][m]. that means when n or m is 0, you're testing mata[-1][m] and mata[n][-1], respectively. And when n or m is equal to (H or W) -1, you're testing mata[H][m], and mata[n][W]. In these four cases, you're testing outside the actual boundaries of your array, which can cause crashes. You just need to test a smaller area:
1 2
|
for (int m = 1; m < H-1; m++){
for (int n = 1; n < W-1; n++){
| |
As a consequence of this, a buffer zone with a thickness of one cell will be permanently "dead" all around the edges of your game. However, you can just not display those cells, and the user will never know the difference.
As for graphics, my own method was to use win32. however, I don't think you want to open that whole can of worms until you're sure that everything works. But if you do eventually get to that point, to answer your question: it is entirely possible to know what to draw to the screen just using the array you've got.
Nice job so far, man.