Commit graph

240 commits

Author SHA1 Message Date
Gered 4e43e9fbdd remove possibly error returns from sdl2 Event -> SystemEvent conversion
we just use a catch-all "Unimplemented" enum for the sdl2 event types we
have not mapped / don't care about yet.

this change is mainly just so that we don't need to use TryFrom anymore
as this simplifies making our own SystemEvent iterator

as well, it felt wrong to return an error (even if silently ignored)
whenever an unmapped sdl2 event was raised (since that could happen
fairly often)
2023-02-19 16:17:11 -05:00
Gered adbc0029f4 implement base core/support traits for slimed project
for it's main app context structs
2023-02-19 15:30:35 -05:00
Gered aa3ede096f start moving slimed project to app+core+support context/state model 2023-02-19 15:19:02 -05:00
Gered 03bb4b4adc update template_complicated to use new loop/context boilerplate stuff 2023-02-19 13:16:10 -05:00
Gered 1e5930d401 long, semi-rambling, rationale/description of this boilerplate stuff 2023-02-19 13:15:32 -05:00
Gered b26eab6fb0 some cleanup and naming changes to main loop, game context boilerplate
maybe sort of better?
2023-02-19 13:15:00 -05:00
Gered 24916ae4c7 rename types. still probably confusing. naming is very hard.
especially hard when some of your types are just split up to appease
the borrow checker. ugh.
2023-02-03 18:15:46 -05:00
Gered da66e10bbd initial main loop and game state/context boilerplate helper things
work in progress stuff that will be tweaked as i convert things over to
use this and, i assume, inevitably encounter problems and/or discover
some better ways to do it
2023-02-03 17:55:11 -05:00
Gered 3d7c4f63ea match more environments
forgot about the BSDs, which i guess all have KDE available for them
too? never used BSD myself!
2023-01-30 18:51:24 -05:00
Gered 46dea2b607 add special config and defaults for SDL X11 compositor skip hint 2023-01-30 18:45:03 -05:00
Gered 2a2d8533bc specify sdl2 dep with non-windows and windows for build differences
may need to be fine-tuned still, as i've not done very thorough testing
on all platforms as of yet, but this will get things started at least
2023-01-18 17:38:46 -05:00
Gered b010c044ef remove explicit sdl2 dependency from example apps
they all still depend on sdl2 through the libretrogd dependency, but
the benefit is that future sdl2 version updates are much easier to
accomplish for most apps, since only libretrogd needs to be updated
(in theory).
2023-01-18 17:04:25 -05:00
Gered 592be161c3 update example apps to not use sdl2 event types 2023-01-18 17:03:21 -05:00
Gered a7c91adaf0 convert sdl2 events to our own equivalents
this is to not force _some_ sdl2 type usage onto applications, thus
forcing them to also include sdl2 as a dependency themselves.

that being said, this is still pretty gross feeling to me and i wish
there was a better solution.

i've not added all possible sdl2 event equivalents. only the ones that
i am currently interested in and use. i'll add more as is needed. likely
the joystick / controller events will be added in the very near future.
2023-01-18 17:02:45 -05:00
Gered 7c568fd09d update to a more recent version of sdl2. only tested on linux for now
0.35.2 is the latest version available via cargo right now, and that
version has some issues building for me that have been resolved in
subsequent commit(s). for some reason the maintainers have not pushed
a new version of sdl2 to cargo for quite some time despite numerous
fixes and updates being available ...? bah!

also the current sdl2 `features` set will probably only work for linux
builds. i will try to work out windows + mac build issues shortly
2023-01-18 13:30:25 -05:00
Gered 66bf1e40cc pin anyhow and thiserror versions
due to encountering some compile errors on a fresh system which pulled
down the newest minor versions of both. these two libraries do not seem
to follow "good" semantic versioning ... ? ugh. will try to work out
the compiler issues with the latest versions of these later ...
2023-01-18 13:26:53 -05:00
Gered f902b16d3c during lzw decoding, use a vector instead of a hashmap for the table
since the keys for the previously used hashmap all corresponded with
an index, this can obviously just be a vector where the element index
corresponds to the lzw code. simple.
2023-01-01 13:01:10 -05:00
Gered a9610a5762 add initial benchmark tests for asset loading
only for gif bitmaps right now, since i want to (eventually) clean that
up somewhat
2023-01-01 12:43:15 -05:00
Gered ed754cb9ac update example project entity system component store usage
i think i prefer this style. it's not _technically_ as safe as it was
before, but i prefer the explicitness of it (and it results in a little
bit less nesting in system functions which is nice).

i don't much like the need for an explicit `unwrap()` call however
but that's the tradeoff!
2023-01-01 12:22:03 -05:00
Gered 2b33a64120 naming changes for additional clarity, and very minor cleanups 2022-12-30 20:17:03 -05:00
Gered 88ecfb13e9 clarification comment for my future self 2022-12-30 20:12:06 -05:00
Gered 6f821e7885 remove LzwDataBuffer, just use Vec<u8>'s instead
i originally added LzwDataBuffer under a misunderstanding that i was
going to need to track values in these buffers that were not just
limited to 8-bits in size. this is not actually the case, so we can
do this change to simplify things.
2022-12-30 20:05:51 -05:00
Gered a97782d476 update incorrect comment that was clearly copy+pasted and then missed 2022-12-30 17:46:47 -05:00
Gered 319bea7305 add todo comment reminder for myself 2022-12-30 17:27:22 -05:00
Gered 1f31eaa17d add more pcx bitmap load/save tests 2022-12-30 17:25:10 -05:00
Gered fc88380ba3 add more iff bitmap load/save tests 2022-12-30 17:22:04 -05:00
Gered 39b0cd622c update module doc comment 2022-12-30 17:10:52 -05:00
Gered 6ffa742d84 rename lzw module to lzwgif to better reflect what it does
that it's not an implementation for LZW but the GIF-variant/specific
version of LZW
2022-12-30 11:53:22 -05:00
Gered cd9c44dab0 add second large gif image load/save in unit test
just to make me feel a bit better about the lzw encoding/decoding
2022-12-30 11:50:23 -05:00
Gered 60a22456c0 add module doc comment 2022-12-30 11:47:28 -05:00
Gered 88f8cbe1ad lzw encoding/decoding now reads/writes the min_code_size byte
as such, lzw_decode now no longer needs min_code_size as a function
parameter since it just reads it from the source bytes
2022-12-30 11:47:13 -05:00
Gered 803b31d8c8 fix lzw encoding code bit increment and max code value checks
this fixes it so that the full 12 bits for codes will be used instead
of only 11. whoops
2022-12-30 10:51:30 -05:00
Gered 0c1f50e63e initial stab at gif load/save bitmap support
the lzw encode / decode algorithm seems to work well enough, but could
be optimized and i'm worried there are still some lingering issues ...
2022-12-29 22:19:35 -05:00
Gered 8cb1d82b49 add support for loading/saving palettes with fewer than 256 colors 2022-12-29 22:17:44 -05:00
Gered 5e65d63540 use a rect for the destination area
this isn't strictly needed now, but will be useful in a future change
that changes how clipping works in rotozoom blits
2022-11-08 14:15:41 -05:00
Gered acbf36ee28 adjust rotozoom internal transformed destination rect coord calculation
maybe marginally better/simpler, but also some minor cleanups and a
semi-hackfix for minor destination blit corners being cutoff slightly
for some rotation angles
2022-11-07 13:21:45 -05:00
Gered a59bfc5511 update rotozoom blit algorithm to something a little bit better
but there are still performance improvements we can make. but at least
now we're not doing some silly double-pixel draw as a band-aid over
missing/gap pixels. and we no longer sometimes have missing scanlines
due to floating-point rounding issues.
2022-11-06 22:20:17 -05:00
Gered 018aeef6ed use position argument 2022-08-10 00:23:43 -04:00
Gered eb801d996a commit a whole bunch of test assets that were missed previously. oops! 2022-07-23 15:09:41 -04:00
Gered 2203035401 add a bunch of debug impls. switch some debug derives over too
mainly switching #[derive(Debug)] to manual std::fmt::Debug impls to
remove debug strings that would otherwise contain long strings of
byte arrays which most of the time isn't so useful to see in any kind
of debug logging
2022-07-23 15:08:36 -04:00
Gered cf02471aa8 fix compiler warning 2022-07-20 18:27:54 -04:00
Gered 9316f09e09 added blended drawing operation visual comparison tests 2022-07-20 18:27:27 -04:00
Gered 0dd90e48b4 fix clipping issues with some more blended blit method variants
jeez!
2022-07-20 18:25:22 -04:00
Gered 63ac007207 fix clipping issues with some blended blit method variants 2022-07-20 18:11:55 -04:00
Gered 0c9418aaa5 fix blendmap loading issue where the map had a full 256 source color set 2022-07-20 17:36:08 -04:00
Gered c4e0a11259 add loading and saving support to BlendMap 2022-07-20 16:32:19 -04:00
Gered d6e05c7e3a add new_colored_luminance_map method 2022-07-18 21:36:28 -04:00
Gered 9cac8d2500 add better (and significantly slower) new_translucency_map method 2022-07-18 21:22:50 -04:00
Gered 3265388d9d rename to new_colorized_map. maybe a better name? 2022-07-18 21:22:18 -04:00
Gered fb101db0ac stop searching for color matches if this color is an exact match
probably very rarely ever an optimization in real-world use, but it
still seems like the logical thing to do
2022-07-18 21:21:40 -04:00