Commit graph

61 commits

Author SHA1 Message Date
Gered 09dbb913a5 convert RgbaBitmap to use ARGBu8x4 as its pixel type 2023-05-04 18:54:37 -04:00
Gered f64bba30d2 update screenshot 2023-04-15 02:19:38 -04:00
Gered e9ea08c882 add "push" button to imgui_integration 2023-04-15 02:17:02 -04:00
Gered 0cae9d0367 fix move entity button not working for all entities 2023-04-15 02:09:15 -04:00
Gered cb3a2673f9 add ability to move entities to imgui_integration example 2023-04-14 19:22:16 -04:00
Gered dc6b96d545 remove variable_screen_size example. imgui_integration does this too 2023-04-14 14:07:04 -04:00
Gered 49301a0be9 add readme for imgui_integration example 2023-04-14 14:00:02 -04:00
Gered 21259bfb10 show an imgui window with entity info, etc 2023-04-14 13:59:38 -04:00
Gered 424c63d414 imgui_integration example initial commit, work in progress
mostly working, but the imgui ui part is only a placeholder.

also this example project is kind of overly complicated, but i really
wanted this to be something that somewhat resembles a real tool that
i'd want to build.
2023-04-10 19:40:46 -04:00
Gered 1815a2236c update examples and doc comments code to reflect recent changes 2023-03-29 15:50:30 -04:00
Gered cfd7d479ec add variable_screen_size example project
not a super exciting project. might be removed later on when i
eventually get to adding more exciting examples
2023-03-29 15:43:58 -04:00
Gered 7f19f4e7d4 fix a bunch of clippy warnings
but not all of them. just the easy ones for now!
2023-03-28 16:29:44 -04:00
Gered ceaefad030 lets try using rustfmt again ...
i unfortunately feel like i should really force myself to use rustfmt
even though i very much dislike it. most rust developers seem to use it
so i should probably get used to it ...

however, case-in-point for me is the amount of times i used either
#[rustfmt::skip] or adding a blank `//` comment to force separate
lines, etc, really proves how terrible basing almost all of your
formatting rules on arbitrary length thresholds really is. code
formatting is far more subjective than that.
2023-03-27 18:43:41 -04:00
Gered e503cfb718 remove old display size constants as well as cargo feature flags
we'll be introducing variable display size features next, so these
screen dimension compile-time constants are not going to be useful.

the "low_res" and "wide" features were also tied to the idea of
compile-time constants for display sizing so these need to go too,
and will be brought back via runtime configuration
2023-03-27 16:58:37 -04:00
Gered 806725654a fix lingering compile errors in the example projects 2023-03-27 16:46:04 -04:00
Gered 07f2b13f68 large amount of bitmap graphics rework
this is an unfortunately large commit. probably should've been broken
up into multiple smaller ones.

i decided to revert some earlier preparatory work i had done to organize
graphics functionality into two main streams: "indexed" and "rgb". this
was going to result in two completely different Bitmap structs which
were going to be largely similar and as i thought about it more, i
realized my earlier thinking that i wouldn't be able to generify the
Bitmap struct based on pixel-depth was actually not correct.

so, this commit re-works things significantly in a way which i think
is better but probably still not perfect. basically, we have one
Bitmap struct which provides a lot of generic functionality, but also
specialized implementations based on pixel-depth and this is now what is
separated out into graphics::bitmap::indexed and graphics::bitmap::rgb.

but the rest of the graphics functionality is not separated out by
module like this any longer.

note that i've still kept the GeneralBitmap trait and implementations.
i was originally thinking i could get rid of this since i'd now made
Bitmap generic over pixel-depth, but doing so would require me to
rename the common/general blit methods to avoid a name collision with
the specialized implementations (since they would both exist on the
same types now). and i did not like that. i dunno, maybe i will change
my mind later.
2023-03-11 16:58:13 -05:00
Gered 2e57311fe0 try to clean up module 'use' stuff with new prelude modules
though i am not sure how good an idea my approach was with a bunch of
intermediate preludes. i was thinking it might be nice to be able to
only pick out the preludes that you wanted (if not all), but ... would
i ever really need to do that? somehow i am thinking, no, but i will
give it some more thought
2023-03-09 19:10:11 -05:00
Gered 986a2a9677 make fonts generic over GeneralBitmap types
this also includes a semi-important change where the existing
BitmaskCharacter draw implementation will now not draw anything if
FontRenderOpts::None is passed in, instead of just substituting color 0.

this probably makes more sense this way anyway
2023-03-09 16:20:44 -05:00
Gered 3e8ec9f73e make BitmapAtlas generic for its type of bitmap 2023-03-08 17:23:49 -05:00
Gered aab19ba6b3 moved indexed (256 colour) graphics stuff into new "indexed" module
in preparation for adding 32-bit graphics stuff, i want to keep things
separate using modules
2023-03-08 14:16:54 -05:00
Gered 9e06a13c6d move vsync and target_framerate options back into System
since i realized there is an SDL hint that can be used to toggle this

the reason why the rust-sdl "Canvas" struct (which abstracts an
"SDL_Renderer") is not being created in System directly (which would
allow vsync to be toggled on/off via System directly without the use of
a hint) is because not all future SystemResource implementations will
need it (e.g. a future OpenGL implementation definitely won't).
2023-03-07 17:33:42 -05:00
Gered f1c04d85e3 move video, audio and input to new SystemResources trait/structs
System now uses a generic SystemResources structure to provide video,
audio and input devices

the DosLike implementation of SystemResources provides the same
functionality that this library has had to date.

this change is to prepare for future addition of things like 32-bit
Bitmap support and other possible audio device implementations, etc.
the idea is a custom SystemResources implementation can be substituted
in to configure everything with the desired functionality.
2023-03-07 16:46:16 -05:00
Gered 58340c03fe rename from libretrogd to ggdt
i'll admit i never totally liked the name "libretrogd"
2023-03-02 16:11:59 -05:00
Gered eb6a363afd formatting
note that i'm intentionally not using rustfmt. i've tried to like that
tool, but in the end i just really don't like it. too many edge cases
and subjectivity and not enough customization. which is probably the
intent. which makes me hate it that much more. fuck you, rustfmt.
2023-03-02 15:10:27 -05:00
Gered f2f7ae5dee update examples with new input device and main loop event handling stuff 2023-02-27 14:51:55 -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 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 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 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 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 d9739b4e3e fix compile issues 2022-07-18 18:27:25 -04:00
Gered 44984c716c add "apply" method variant that handles device locking itself
rename the old "apply" to "apply_to_device". meh. naming is hard.
i expect that most of the time i'd want to use the "apply" method i'm
adding here that handles device locking internally, so that is why i've
chosen to let it be called "apply" and to rename the other one.
2022-07-10 14:21:52 -04:00
Gered 0ccc37420d add blit_atlas method
for some additional convenience when blitting BitmapAtlas tiles
2022-07-09 18:17:28 -04:00
Gered e276eb950d add AudioQueue
for queuing audio "commands" which is a much nicer way to interact
with the audio system in general in a more complex application, as this
lets you play audio in more of a "fire and forget" kind of way.

Rc<AudioBuffer> play methods provided as an alternative because
otherwise you end up with a somewhat gross double-copy of the audio
buffer being played. but i didn't want to necessarily force use of
Rc<AudioBuffer> just yet ... thus both versions of these methods are
provided.
2022-07-01 16:23:28 -04:00
Gered 20d0d8630d add global audio volume control 2022-06-05 18:42:09 -04:00
Gered 13b18e3d71 convenience methods for playing/stopping specific audio channels 2022-06-05 18:29:57 -04:00
Gered d3e034d211 give multi-parameter BlitMethod enum values named parameters 2022-06-05 11:11:39 -04:00
Gered 17e30fdec4 simplify 2022-05-29 17:47:24 -04:00
Gered 28c964e37e add initial support for playing custom audio waveform generators
with typical sine wave generator example added to the audio_playback
example project
2022-05-29 17:43:51 -04:00
Gered 94922caf71 minor updates to audio_playback example
using Audio's AudioSpec property to get the target format to convert to
2022-05-29 13:53:35 -04:00
Gered 23f2d4da02 update audio_playback example with varied wav file formats to convert 2022-05-29 13:18:51 -04:00
Gered e4a90e7f10 play_buffer now enforces matching AudioSpecs 2022-05-29 10:57:04 -04:00
Gered 3bf69d651d add audio_playback example 2022-05-28 20:29:40 -04:00
Gered bc03961a49 bitmap font/char rendering now requires a FontRenderOpts
this is more flexible for future font types, which may not require
only a simple u8 color value (e.g. bitmap fonts)
2022-05-27 17:52:23 -04:00
Gered 51cb8a5bf5 add template_complicated example 2022-05-26 21:18:45 -04:00
Gered 0afc7e822a add template_minimal example 2022-05-26 18:43:22 -04:00