SDL 1.2 Compile Test on COS2

The Commodore OS Vision Linux distribution and Linux software discussion and help.
Post Reply
davidf215
Posts: 6
pinterest Kuchnie na Wymiar Warszawa
Joined: Wed Dec 04, 2024 3:47 pm
Contact:

SDL 1.2 Compile Test on COS2

Post by davidf215 »

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.

Image


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.

Image


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.

Image


After this, the program did compile and run successfully.

Image


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;
}
Happy Computing!
Please visit my Computer blog: https://davidf215.blogspot.com/

User avatar
LeoNigro
Site Admin
Posts: 253
Joined: Mon Aug 14, 2023 1:29 pm
Contact:

Re: SDL 1.2 Compile Test on COS2

Post by LeoNigro »

Hmmm... This is something that I hope we can have covered in COS3 which is being worked on at the moment.
Everything is still on the table for inclusion in COS3 (if it's easy enough).

As part of the allure of the C64 was programming, and the primary reason for Commodore OS is as the base install of the C64x, I would like to include more avenues to pursue software development, particularly in the retro/bedroom indie coder sphere.

The plan is that COS3 will include everything from Scratch, through various versions of BASIC and potentially even something to facilitate development utilising SDL/openGL etc. I might even include game makers like Godot. COS1 included Eclipse, but I thought that was a bit of an overkill for COS2. I'm not even sure if that is still popular. Maybe the current dev stuff should be up to the individual, however I would like to have retro dev stuff all set up and ready to go. Pick your battles. Fit your niche. :D

I unfortunately, come from a more Microsofty software dev background, thus the inclusion of mono and .NET, and I realise I probably have a bit of a blind spot. You seem to have more expertise in the Linux software development arena than I do, so I would love to pick your brain.
Are there particular packages that you want to ensure are included in COS3?
Is there any particular dev environment or tech you are utilising that you would like to see included?

Also, I would be particularly interested in things that facilitate retro programming on 8-bit and 16-bit systems and maybe even facilitate cross compilation. Even the Pico-8 fantasy console stuff looks like fun. I will see if I can get a Commander X16 environment going. A C64 PRG BASIC coding environment might be included (although to be honest, it's soooo windows based I'm kinda balking at having to set up all the Windows 8-bit emulators with that, so that may be in the too hard basket).

I know it kinda sucks for the people downloading images larger than what they may feel they need, but as I said, Commodore OS's whole reason for being and focus going forward is on being the base install for the C64x and any other Commodore branded computer that may ever come into being, with the hope of being both inspirational and aspirational for retro enthusiasts and retro developers respectively, both new and old.
Image Commodore OS creator. Site Admin. Owns: C64, C128D(Sidekick64), A500, A1000(piStorm), C64x(i7)

davidf215
Posts: 6
Joined: Wed Dec 04, 2024 3:47 pm
Contact:

Re: SDL 1.2 Compile Test on COS2

Post by davidf215 »

LeoNigro wrote: Wed Dec 11, 2024 4:57 am I unfortunately, come from a more Microsofty software dev background, thus the inclusion of mono and .NET, and I realise I probably have a bit of a blind spot. You seem to have more expertise in the Linux software development arena than I do, so I would love to pick your brain.
Are there particular packages that you want to ensure are included in COS3?
Is there any particular dev environment or tech you are utilising that you would like to see included?

Also, I would be particularly interested in things that facilitate retro programming on 8-bit and 16-bit systems and maybe even facilitate cross compilation.
Glad to hear that COS3 is in development. I learned programming on my C64 back in the 80s. There was no Internet back then, so learning programming came through checking out C64 programming books from my local library. I learned and used BASIC for most of my casual programming projects. On the C64 I acquired a program called “Garry Kitchen’s Game Maker,” which allowed the creation of graphics, sound effects, and coding.

There are so many different development tools avalable today that it can be challenging to determine which tools to include in a system. I think you have done a good job regarding such decisions for COS2. On a Linux based system GCC and open source libraries are common: the SDL 1.2/2.0 library suite, openGL, and Vulkan. Eclipse and Code::Blocks are common IDE’s on Linux. Visual Studio is a new comer to Linux, and I think it’s good addition; having tools from the Windows side helps, I think.. Godot is good. Irrlicht is a 3D library that would be good to include also.

A development project that I was working on in AGK (App Game Kit) on Linux Mint runs successfully in COS2. I also found some of my old Windows projects run also in COS2, so I presume WINE is setup by default on COS2, which is very cool. The App Game Kit is developed by The Game Creators, who had also developed the DarkBasic programming language, which I’ve also used. I’ve read online comments that DarkBasic was inspired by the AmigaOS programming language AMOS. AMOS was, and still is, a popular BASIC language on the Amiga. I knew about it during my years as a Commodore Amiga 1200 user, but I used BlitzBasic instead. I used BlitzBasic on my A1200 to create an Intellivision clone of Astrosmash that I entitled Astrocrunch. The most recent development of this game is now called Space Pilot and it can be found here: http://www.brigadiercomputers.com/index ... pilot-game.

I chose BlitzBasic as it had several similarities to C. I eventually switched from BlitzBasic/BlitzMax to DarkBasic/AGK as The Game Creators created the DarkGDK, which was the entire Darkbasic library of functions available as a C/C++ library. There was a BlitzSDK that made the BlitzBasic functions available for C developers, but support for it didn’t last long. I was developing a 3D version of a 2D project I had created trying to use the BlitzSDK when support was pulled from BlitzSDK, so I got a little upset about it, and this is why I ended up using DarkBasic and AGK instead.

I think the idea for both is good, though: providing a development option that includes BASIC to help teach programming while also allowing the same functions to made available as a C library for those who want to move on to C/C++. This provides an easier step-up to higher levels of development. While developing in BlitzBasic or in DarkBasic, one learns the function names, so transitioning from BASIC to C is easier as the function names remain the same, thus reducing the learning curve from BASIC to C. Many, like myself, learned BASIC coding in Secondary School, so this development option is useful for such young coders. The one function that would make such a transition better would be a program that would convert the code from BASIC into C; this way time spent in writing BASIC code isn’t a loss when decicing to move over to C. Python is common for young programmers these days, so including Python would be good also.

I haven’t investigated it yet, but BlitzMax, which had a Linux version, is open source now over at https://www.blitzbasic.org/forum/downloads.php. To maintain the Retro theme, including the open source version of BlitzMax could provide some nostalgia to those who wrote BlitzBasic programs on their Commodore Amigas back in the day.

A Commander X16 development option could be a good option as well; I’m sure The 8-Bit Guy may help you with that. He did recently open an arcade near where I live, and I’m not sure if the X16 is in the arcade, but I would think he’d be interested in widening the development base for it. And for cross-development to old Commodore 8-bit and 16-bit systems, Hans de Ruiter has some related ideas on his new YouTube channel (https://www.youtube.com/@KSD-AmigaCorner).

There is an online repository of old 8-bit programming books over at http://www.atariarchives.org. Indeed most books are Atari focused but many can also be used for C64 programming. Perhaps adding some bookmarks in the web browser for some of these online resources can be helpful for enhancing a retro environment. It’s sister site, http://www.atarimagazines.com includes Atari and Commodore 64 based magazines, such as Compute! and Compute’s Gazette, that retro seekers may also find useful.

Sorry for the lengthy reply, but I hope this helps. Please let me know if you need clarification or more information.
Please visit my Computer blog: https://davidf215.blogspot.com/

User avatar
LeoNigro
Site Admin
Posts: 253
Joined: Mon Aug 14, 2023 1:29 pm
Contact:

Re: SDL 1.2 Compile Test on COS2

Post by LeoNigro »

The AppGameKit isn't free so I can't include it.
I can't download anything Blitz related, and TBH the site does a poor job introducing what each app is and how they differ.
The one function that would make such a transition better would be a program that would convert the code from BASIC into C; this way time spent in writing BASIC code isn’t a loss when decicing to move over to C. Python is common for young programmers these days, so including Python would be good also.
It's funny. A code converter is the sorta thing I would write if I went back in time to the 80s(along with a html browser and ASP). In the era of JIT compilation and things like LLVM this probably isn't all that desirable.
I bought a BASIC compiler called PETSPEED for my C64. But I never got around to using it. Nowadays you can even program a C64 in C.
I think I would opt towards technologies that might be useful in creating games for classic Commodore systems. I started a thread on this here.
viewtopic.php?t=704

I'm pretty sure Python is already installed in COS2, but there is no specific IDE.

What about SDLBasic?

A Books and Magazine database is something I might consider for COS4. You aren't the first person to bring this up. Even better it's possible to link to full scans of retro mags online.

Your game looks cool. Does it run on COS? Can we include it?
Image Commodore OS creator. Site Admin. Owns: C64, C128D(Sidekick64), A500, A1000(piStorm), C64x(i7)

davidf215
Posts: 6
Joined: Wed Dec 04, 2024 3:47 pm
Contact:

Re: SDL 1.2 Compile Test on COS2

Post by davidf215 »

LeoNigro wrote: Fri Dec 13, 2024 1:14 pm The AppGameKit isn't free so I can't include it.
I can't download anything Blitz related, and TBH the site does a poor job introducing what each app is and how they differ.
Yeah, I also checked on the Blitz website and I had troubles, too. I'll research more. Indeed the AppGameKit isn't free; it's a nice development tool, though, for those who want a cross-platform development environment that allows coding in BASIC and C/C++.
LeoNigro wrote: Fri Dec 13, 2024 1:14 pm
The one function that would make such a transition better would be a program that would convert the code from BASIC into C; this way time spent in writing BASIC code isn’t a loss when decicing to move over to C. Python is common for young programmers these days, so including Python would be good also.
It's funny. A code converter is the sorta thing I would write if I went back in time to the 80s(along with a html browser and ASP). In the era of JIT compilation and things like LLVM this probably isn't all that desirable.
I bought a BASIC compiler called PETSPEED for my C64. But I never got around to using it. Nowadays you can even program a C64 in C.
I think I would opt towards technologies that might be useful in creating games for classic Commodore systems. I started a thread on this here.
viewtopic.php?t=704
Being able to use modern tools and code for a specific target platform is great; however, for a retro-feel I would think a converter would still be beneficial. I was also thinking of the converter more of a tool for the developer so that the developer could reuse the BASIC code without having to manually convert from BASIC to C/C++. I've developed casual games in BASIC and then later in the future wish I had used C/C++ instead, and having a converter from BASIC to C would save lots of time from having to manually convert the code.
LeoNigro wrote: Fri Dec 13, 2024 1:14 pm I'm pretty sure Python is already installed in COS2, but there is no specific IDE.

What about SDLBasic?

A Books and Magazine database is something I might consider for COS4. You aren't the first person to bring this up. Even better it's possible to link to full scans of retro mags online.
Python3 is installed in COS2. I've not actually used SDLBasic other than testing basic functions. It would be a good option to include, i think.
LeoNigro wrote: Fri Dec 13, 2024 1:14 pm Your game looks cool. Does it run on COS? Can we include it?
Yes, it does run on COS. Yes you can include it. Thanks for considering to do so! Let me know if you have questions about it.
Please visit my Computer blog: https://davidf215.blogspot.com/

coolDude
Posts: 3
Joined: Thu Dec 05, 2024 10:44 pm
Contact:

Re: SDL 1.2 Compile Test on COS2

Post by coolDude »

For COS3, there was a mention of the Commander X16, which has an emulator that I run on Virtual Box. I also run a Mega 65 emulator on Virtual Box. Both would be really fun on COS3. https://mega65.org/

For programming, I would like to see Processing language and Ardunio IDE installed in COS3. These really are not related to Commodore machines, but programming learning environments that are pretty popular and both run on Linux.
https://processing.org/
https://www.arduino.cc/

As for manuals, the original C64 & C128 User Guide and Programmers Reference Manual in PDF format would be nice in COS3.

If any of these are already in COS2, I'm fairly new to COS2, so I might not have found them yet.
I own a C64 and C128. I run a number of VirtualBox emulators VICE, X16, Mega 65, Commodore OS, Apple II, MacPlus, HP48SX, TRS80 Model 100, Amiga WinUAE.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests