Advertisement

SDL Window not showing up

Started by January 01, 2017 09:54 PM
1 comment, last by Balajanovski 7 years, 11 months ago

Recently I have been attempting to recreate the arcade game Tron.

I initialise SDL and I create the window and renderer, yet, for some reason the window doesn't even show up.

The executable opens, yet there is no window.

If anyone could shed some insight onto the issue, that would be more than appreciated.

Github repository link:

https://github.com/Balajanovski/tron-clone

Github latest commit link:

https://github.com/Balajanovski/tron-clone/commit/76bde01fc8010fed119b9b895daf19dc36a2ff6f

If you trace through the code, you’ll find that `View::View` is attempting to use SDL before it is initialized:


// main.cpp

int main() {
	Model model;
	while (!model.isGame_over_flag()) {
		model.loop();
	}
	return 0;
}

// Model.cpp
Model::Model() : view(&field), …
{
	if ( SDL_Init(…) ) {

	if ( IMG_Init(…) ) {


// View.cpp
View::View(Field* field) … {
	win = SDL_CreateWindow(…);
Advertisement

@fastcall22

Thank you very much that fixed it

This topic is closed to new replies.

Advertisement