4 ms·
Ah, do you remember when this thing called Windows allowed you to simply create windows with 10 lines of code ? Where have we gone ?
by pjerem 3y ago
Ah, do you remember when this thing called Windows allowed you to simply create windows with 10 lines of code ?
Where have we gone ?
- convolvatron 3y agoon the symbolics it was literally (create-window)
- anyfoo 3y agoAnd have a 10000 lines message processing loop? Yeah. It wasn’t exactly Qt.
- enriquto 3y agoTen lines? Why so complicated? Back in my day we did it with just two lines: mov al, 13 int 10 And then you pushed your pixels to the video segment (a0000). So simple and elegant... But my dad still mocked me because it was too complicated! Back in his day, you didn't need to bother with stupid video modes, and could just POKE the pixels to your screen!
- fb03 3y agooh man, mode 13!!! I still have this line embedded in my head (Turbo Pascal 7) mem[$A000:x+(320*y)] := color
- NBJack 3y agoDon't forget trying to pick a palette, and those sweet, sweet palette cycling effects for things like water.
- kijiki 3y agoBug, you want: mov al, 13h
- stevefan1999 3y agoNot only this is architectural specific (needs BIOS to map a specific constant range of memory), but this will cause a lot of software interrupts. Interrupts, like exceptions, are _bad_. In UEFI you have VESA Video Mode to handle most of the annoying mode selection stuff and GOP to handle...memory mapped framebuffer in linear address, so that you can just write directly to the framebuffer to push your pixel...that's even simpler. You want double or triple buffering? Just make another memory buffer with the same dimension and strides, and recursively push each level of buffer up on render, easy.
- tom_ 3y agoStop being so dramatic. The exact same code will still compile today, and you'll get your window in 10 lines or whatever. And anyway, it's not a window - it's a message box. (You could probably put an honest-to-goodness window up in 10 lines, but you'd have to squeeze the code together a bit more than most reasonable people would consider permissible, and/or it'd be missing a few key aspects. But I bet 30 lines would be plenty for a full-on one though, with its own custom window proc that has a WM_PAINT handler that does something and a WM_CREATE handler that pops a context pointer in GWLP_USERDATA and a WM_DESTROY handler than frees the context. And a message loop. The code today would be basically exactly the same as it was in the Windows 95 days.)
- maccard 3y agoDepending on what kind of window you want, you can still get a modal in one line with the Windows SDK MessageBox(NULL, "Something Went Wrong", "Error", MB_ICONEXCLAMATION | MB_OK); A full windows window including a message handling loop is only about 50 lines of code [0] [0] https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-window https://learn.microsoft.com/en-us/windows/win32/learnwin32/c...