SDL 1.2 Compile Test on COS2
Posted: Tue Dec 10, 2024 9:50 pm
I did a compile test of simple SDL code, which is listed at the end of this blog entry, to see what would happen. I had already discovered that gcc was installed by default.
For this SDL code compiling test, I was compiling with libsdl version 1.2, which is older, I know. The initial compile failed as it couldn't find the SDL.h header file. So SDL is not installed by default in Commodore OS Vision 2. It's not a big deal, but it is good to know.
I queried the apt-get cache and discovered sdl1.2-dev, sdlnet1.2-dev, and sdlimage1.2 were available. However, I could not find sdl_ttf1.2-dev, so that's still an outstanding issue.
Since sdl_ttf 1.2 is not available for some reason, I had to comment out the include file for it and remove the "-lsdlttf" option from the compile command.
After this, the program did compile and run successfully.
Nothing fancy about this program as all it is meant to do is test for include and runtime files, start a loop, then end when the ESC key is pressed.
Below is the C++ code for the simple SDL 1.2 program.
Happy Computing!
For this SDL code compiling test, I was compiling with libsdl version 1.2, which is older, I know. The initial compile failed as it couldn't find the SDL.h header file. So SDL is not installed by default in Commodore OS Vision 2. It's not a big deal, but it is good to know.
I queried the apt-get cache and discovered sdl1.2-dev, sdlnet1.2-dev, and sdlimage1.2 were available. However, I could not find sdl_ttf1.2-dev, so that's still an outstanding issue.
Since sdl_ttf 1.2 is not available for some reason, I had to comment out the include file for it and remove the "-lsdlttf" option from the compile command.
After this, the program did compile and run successfully.
Nothing fancy about this program as all it is meant to do is test for include and runtime files, start a loop, then end when the ESC key is pressed.
Below is the C++ code for the simple SDL 1.2 program.
Code: Select all
#include <iostream>
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_mixer.h"
#include "SDL/SDL_net.h"
#include "SDL/SDL_thread.h"
using namespace std;
int main(void){
SDL_Surface *screen;
if (SDL_Init(SDL_INIT_EVERYTHING) < 0){
cout << "SDL Init() failed! Ending now.\n";
exit(1);
}
SDLNet_Init();
screen = SDL_SetVideoMode(800,600,8,SDL_SWSURFACE|SDL_ANYFORMAT);
if(screen == NULL){
cout << "Couldn't set 640x480x8 video mode!" <<endl;
exit(1);
}
cout << "Hello, World.\nWelcome to Solar Defender! SDL Initialized.\n";
bool done = false;
while(!done){
SDL_Event event;
while(SDL_PollEvent(&event)){
switch (event.type){
case SDL_QUIT:
done = true;
break;
case SDL_KEYDOWN:
if(event.key.keysym.sym == SDLK_ESCAPE)
done = true;
break;
}
}
}
SDLNet_Quit();
IMG_Quit();
SDL_Quit();
cout << "SDL Quit. Ending now!\n";
return 0;
}