www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Anybody know about SDL and particularly SDL_TTF initialization?

reply WhatMeWorry` <kheaser gmail.com> writes:
This should be trivial, right?
I've been looking at existing D repo code for hours. Can't figure 
why TTF_Init doesn't work?
It would help if I could figure out how to use SDL_GetError()

INFO: SDL loaded v2.30.2
INFO: SDL initialized: 0
INFO: TTF loaded: v2.0.14
Error Program exited with code -1073741819


   loadSDL();
   SDL_version v;
   SDL_GetVersion(&v);
   toStdout("SDL loaded v%d.%d.%d", v.major, v.minor, v.patch);
   auto initSDL = SDL_Init(SDL_INIT_EVERYTHING);  // returns 0 on 
success
   toStdout("SDL initialized: %d", initSDL);

   auto loadTTF = loadSDLTTF();
   SDL_TTF_VERSION(&v);
   toStdout("TTF loaded: v%d.%d.%d", v.major, v.minor, v.patch);
   auto initTTF = TTF_Init();  // SDL must be initialized before 
calls to this library
May 12
next sibling parent Danny Arends <Danny.Arends gmail.com> writes:
On Sunday, 12 May 2024 at 20:13:04 UTC, WhatMeWorry` wrote:
 This should be trivial, right?
 I've been looking at existing D repo code for hours. Can't 
 figure why TTF_Init doesn't work?
 It would help if I could figure out how to use SDL_GetError()

 INFO: SDL loaded v2.30.2
 INFO: SDL initialized: 0
 INFO: TTF loaded: v2.0.14
 Error Program exited with code -1073741819


   loadSDL();
   SDL_version v;
   SDL_GetVersion(&v);
   toStdout("SDL loaded v%d.%d.%d", v.major, v.minor, v.patch);
   auto initSDL = SDL_Init(SDL_INIT_EVERYTHING);  // returns 0 
 on success
   toStdout("SDL initialized: %d", initSDL);

   auto loadTTF = loadSDLTTF();
   SDL_TTF_VERSION(&v);
   toStdout("TTF loaded: v%d.%d.%d", v.major, v.minor, v.patch);
   auto initTTF = TTF_Init();  // SDL must be initialized before 
 calls to this library
No idea why this fails, seems alright to me. You can use: TTF_GetError() for a human-readable error message,when the call to TTF_Init() fails (return -1). Good luck Danny
May 22
prev sibling next sibling parent Jerry <labuurii gmail.com> writes:
On Sunday, 12 May 2024 at 20:13:04 UTC, WhatMeWorry` wrote:

 INFO: SDL loaded v2.30.2
 INFO: SDL initialized: 0
 INFO: TTF loaded: v2.0.14
 Error Program exited with code -1073741819
Something hit a null pointer, time to fire up the debugger :)
May 22
prev sibling parent solidstate1991 <laszloszeremi outlook.com> writes:
On Sunday, 12 May 2024 at 20:13:04 UTC, WhatMeWorry` wrote:
 This should be trivial, right?
 I've been looking at existing D repo code for hours. Can't 
 figure why TTF_Init doesn't work?
 It would help if I could figure out how to use SDL_GetError()

 INFO: SDL loaded v2.30.2
 INFO: SDL initialized: 0
 INFO: TTF loaded: v2.0.14
 Error Program exited with code -1073741819


   loadSDL();
   SDL_version v;
   SDL_GetVersion(&v);
   toStdout("SDL loaded v%d.%d.%d", v.major, v.minor, v.patch);
   auto initSDL = SDL_Init(SDL_INIT_EVERYTHING);  // returns 0 
 on success
   toStdout("SDL initialized: %d", initSDL);

   auto loadTTF = loadSDLTTF();
   SDL_TTF_VERSION(&v);
   toStdout("TTF loaded: v%d.%d.%d", v.major, v.minor, v.patch);
   auto initTTF = TTF_Init();  // SDL must be initialized before 
 calls to this library
I personally recommend using an alternative TTF library.
Jun 07