Commit Graph

34 Commits

Author SHA1 Message Date
Simon Forman 5b6185209a A bunch of stuff. 2023-03-03 07:30:55 -08:00
Simon Forman f87ddbfa9e Minor cleanup. 2023-02-28 07:45:38 -08:00
Simon Forman 5423e0b239 Use defines to abstract font choice.
Clunky but now you only have to change the font name four time in one
place rather than N times in N places, eh?

Writing C again for the first time in ages (this and the Joy
interpreter) the using the preprocessor is like stone-age
meta-programming, from the lens of lisp it's like, "you do what to your
source code?".
2023-02-28 07:14:33 -08:00
Simon Forman 144e73ebc3 A different font.
It's easy enough to substitute a different font in the call to
Imagemagick's `convert` tool, but in the case of pixel fonts, it will
scale them, so you're not getting a proper bitmap of the pixels, you're
getting a kind of screenshot of the pixels.

I want to make a different machinery for bitmapped pixel fonts, and I
want to make a simple DEFINE-based way to pick them without having to
edit your source code,  e.g. #define font_data font_PublicPixel_22_data
yeah?

After that, simple affine transforms for fake 3D..
2023-02-28 06:53:31 -08:00
Simon Forman 300cf2f24d Mostly working Wu-ish algorithm. 2023-02-27 16:29:45 -08:00
Simon Forman 61527f3e64 Cicada bg, needs work.
Not as pretty as I'd hoped.

Putting a pin in Wu lines for tonight.  I'll lick it in the morning when
I'm fresh.
2023-02-26 21:02:57 -08:00
Simon Forman 2c6dc4fee5 I clearly don't know what I'm doing.
Go to sleep!  Think, then type!
2023-02-26 20:39:32 -08:00
Simon Forman 42068ebcb6 Is this fun? Kinda.
I should break out the graph papaer and Abrash's Black Book and figure
out WTF I'm doing rather than just noodling around, eh?
2023-02-26 20:02:14 -08:00
Simon Forman 66d687bba6 Horizontal proto-Wu. 2023-02-26 19:06:15 -08:00
Simon Forman d8e20c0ce9 Horz/vert lines and boxes. 2023-02-26 18:07:47 -08:00
Simon Forman c385ad096b Aw, exit() doesn't work?
In any event, I can live with esc-to-quit (is there a callback to hook
into?)
2023-02-26 16:55:53 -08:00
Simon Forman e18eb36c52 But KEY_BACKSPACE doesn't seem to fire?
Maybe worth a bug report?
2023-02-26 16:53:41 -08:00
Simon Forman 50e34c70cb Ha ha! The escape-to-quit behavior...
...seems to be baked into the UVM.
2023-02-26 16:52:02 -08:00
Simon Forman f8f27ed83e Add if..else ladder for keys.
I just noticed that I have KEY_BACKSPACE for the exit key rather than
KEY_ESCAPE as I had thought, yet escape key surely does exit the
program!
2023-02-26 16:49:11 -08:00
Simon Forman e1c81d2c1c Escape key exits program. 2023-02-26 16:27:23 -08:00
Simon Forman 14e15b08a1 minor edits
I don't think this is any better?
2023-02-26 16:04:54 -08:00
Simon Forman 2b07553aa1 Draw chars when you click.
Pick a letter at random.

I wasn't checking that the destination values were not less than zero,
which let you click at the top/left edges of the screen and therefore
the carefree_alpha_blend_blit() would try to write to areas outside the
framebuffer.  I started to see "zalgol" pixels in the letters, so I'm
guessing the pixel data is getting stored just above the framebuffer,
which makes sense (because that's the order they appear in the source
code and this is a simple system!)  When you click at the top of the
screen it was writing pixels in the font data, eh?  Then when you click
elsewhere on the screen you get extra pixels with your letterforms and
it looks like Unicode Lovecraft puns.
2023-02-26 15:24:40 -08:00
Simon Forman 9ca4f81325 A sort of blit. 2023-02-26 15:06:30 -08:00
Simon Forman dbc2fe5854 Move draw_background to own file graphics.h. 2023-02-26 13:20:38 -08:00
Simon Forman 27385e5319 Switch font size to 22.
My old eyes ain't what they used to be.
2023-02-26 13:09:02 -08:00
Simon Forman f7b644d210 Minor cleanup. 2023-02-26 13:04:04 -08:00
Simon Forman 057743c473 Try changing the font size. 2023-02-26 12:42:39 -08:00
Simon Forman f403b6caa2 Display font in anti-aliased glory! 2023-02-26 11:23:32 -08:00
Simon Forman 84f163b71c Alpha blend font FTW! 2023-02-26 11:21:18 -08:00
Simon Forman 2680d8ce1b Okay, alright, skipping blank pixels. 2023-02-26 11:12:07 -08:00
Simon Forman 051b9a46b8 We have a character on the screen!
It looks like potato because no alpha blending yet, but it's certainly
there!  I don't like the spelling of the C code, but who cares?  It
works.
2023-02-26 11:07:29 -08:00
Simon Forman 5d01480f3d A start on draw_char(). 2023-02-26 10:52:09 -08:00
Simon Forman c886a27ddd Rename anim_callback to draw_background
because that's what it is
2023-02-26 10:18:46 -08:00
Simon Forman 843654861b I think I got it. 2023-02-26 10:01:40 -08:00
Simon Forman f5f6233302 This compiles and runs, include font.h but don't call init_font_data() yet. 2023-02-26 09:37:59 -08:00
Simon Forman 8c5e9aa105 So far... 2023-02-26 09:37:20 -08:00
Simon Forman b013168679 Drawing pixel per mouse move is slow at 1280x800.
So let's just use a smaller screen for now, eh?
2023-02-26 08:52:53 -08:00
Simon Forman e047af09b3 Repair damage during mouse move.
This is a compromise between updating the screen every frame (which
takes ~60% CPU on my old no-GPU hardware) and repairing damage from e.g.
dragging offscreen and back on, or covering and uncovering the window
with another window.
2023-02-26 08:42:37 -08:00
Simon Forman eb67419327 Let's use uvm.
https://github.com/maximecb/uvm
2023-02-26 07:53:47 -08:00