Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
>> It's impossible to do graphics in pure C, so what are the alternatives > I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. [...] , but you can do it all in C If you trace the actual context of the conversation from ggp (doubtfuluser - "SDL is not 1000 lines anymore" ) to gp (shric - "pure C" ) ... it is clear that "pure C" was just an imprecise and shorthand alte…
Flappy Bird in 1000 lines of C
21–30 of 59 posts
Re: Flappy Bird in 1000 lines of C
#22Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
>> It's impossible to do graphics in pure C, so what are the alternatives > I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. [...] , but you can do it all in C If you trace the actual context of the conversation from ggp (doubtfuluser - "SDL is not 1000 lines anymore" ) to gp (shric - "pure C" ) ... it is clear that "pure C" was just an imprecise and shorthand alte…
I wouldn't even mention this, except that you've expressed a interest in avoiding misinterpretation.
Re: Flappy Bird in 1000 lines of C
#23Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
Yes indeed, if the project were targetting a simpler machine without an operating system and windowing system in the way, then doing the whole thing - graphics presentation and all - in a thousand lines of C would be perfectly feasible > I'm acutely aware how it's not turtles all the way down (as the logophiles believe) De Chelonian Mobile
Get out of here with that monotestudonist heresy!
Re: Flappy Bird in 1000 lines of C
#24Earlier quoted context omitted.
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
This is a Linux-only situation. A significant fraction of systems code in Windows and macOS are written in fairly modern C++, including core system libraries and the kernel. A project that emerged out of Windows' C++ effort is the Windows Implementation Library[1]. I'm also certain Windows and macOS graphics drivers are written in C++.
Re: Flappy Bird in 1000 lines of C
#25Re: Flappy Bird in 1000 lines of C
#26It uses SDL. Not saying that's good or bad, but it's the first thing I wondered about.
Yeah, it still seems like a reasonable choice if you're going to write a simple game in C.
Re: Flappy Bird in 1000 lines of C
#27Earlier quoted context omitted.
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…
On Linux, you may mmap /dev/fb0 to access the front buffer like you would have on old computers. Not all kernel configs and GPU devices allow that. You can test if fb0 is usable with cat /dev/random > /dev/fb0 to see if the screen is filled with garbage (you may also need root privilege).
Re: Flappy Bird in 1000 lines of C
#28Earlier quoted context omitted.
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
Love this.
Re: Flappy Bird in 1000 lines of C
#29It uses SDL. Not saying that's good or bad, but it's the first thing I wondered about.
Re: Flappy Bird in 1000 lines of C
#30Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives? Back in the days of DOS I used to do this all the time :)
Yes, that brings back the memory of working through books by Andre LaMothe and implementing little games in DOS with C and a little bit of Assembler. I believe there was a very primitive graphics library included in Borland C, but it was not that useful for this task.
Double buffering was an understandable neat trick and one that would have taken me a bit longer to discover on my own. He also had a custom controller wired through the printer port and some C+ASM for interfacing with it.
I had three of his books, I think the Black Art book was constantly on my desk in the 90s.