generated from emilk/eframe_template
-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the circle, rectangle and fill brushes #41
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
melody-rs
approved these changes
Sep 20, 2023
melody-rs
added a commit
that referenced
this pull request
Sep 24, 2023
* Merge * Outline basic tilemap code? * feat(tilemap): 🚧 Hasty commit so I can work on my other computer * feat(tilemap): I hate OpenGL * feat: 🏗️ Move to wgpu * feat(tilemap): 🚧 Tilemap work * feat(tilemap): 🚧 Generate tileset vertices * feat(tilemap): 🚧 Sorta works * feat(tilemap): 🎨 Split tilemap up into multiple modules * feat(tilemap): 🚧 Try getting autotiles working * feat(tilemap): 🚧 Move to quad system * feat(tilemap): 🚧 Get tiles rendering under new system * feat(tilemap): 🚧 Scaling tilemap * feat(tilemap): 🏗️ Use projection matrix * feat(tilemap): 🚧 Wonky autotiles and map pan * feat(tilemap): 🎨 Split tilemap up into components * fix(tilemap): 🐛 Fix multiple maps * feat(tilemap): 🚧 Add tilemap panning * feat(tilemap): 🐛 Fix autotiles * feat(tilemap): 🚧 Sorta functional animated autotiles * feat(tilemap): ✨ Partially implement events * feat(tilemap): ⚡ Move to a shared viewport uniform * feat(tilemap): ✨ Get blend modes working * feat(tilemap): ✨ Hue shifting events * feat(tilemap): 🎨 Group events together * feat(tilemap): ✨ Event opacity * feat(tilemap): 🚧 Fail to make plane properly * feat(tilemap): ✨ Get plane working * feat(tilemap): ✨ Toggle layers * feat(tilemap): ⚡ Render to texture * feat(tilemap): ✨ Get tilemap scaling working properly * feat(tilemap): 🔥 Use egui instead of a basic renderer * feat(tilemap): 🐛 Fix events with tiles * fix(tilemap): 🐛 Fix z layering and tilemap cursor being wrong * fix(tilemap): 🐛 Fix saving tilemap as image * feat(tilemap): ✨ Display a messagebox when crashing with a wgpu error * feat(filesystem): 🚧 Convert data cache and filesystem into an enum * refactor(config): 🎨 Improve seperation of concerns by storing config seperate to the data cache * refactor(data cache): 🎨 Clean up data cache code * refactor(filesystem): 🚧 Try a new filesystem structure * feat(filesystem): 🚧 Completely rework filesystem * fix(audio): 🐛 Fix audio playback issues * feat(filesystem): 🚧 RGSSAD support * feat(filesystem): ✨ RGSSAD archive reading * chore: 🔥 whoops * fix(tilemap): 🐛 Fix tile 0 drawing bug * fix(filesystem): 🐛 Fix overlay bug * perf(tilemap): 🚧 Rework tilemap to use instancing * perf(tilemap): ⚡ Use instancing for tiles * feat(tilemap): ✨ Basic tilepicker support * refactor: 🎨 Shift code around * refactor(RPG Maker Structs): 🎨 Begin to refactor RMXP types to make it mroe ergonomic to use * refactor: 🎨 Change Ids to usize, refactor them to subtract and add 1 at load/save time * refactor: 🎨 appease the compiler * chore: ⬆️ Update alox-48 and remove it as a git submodule * refactor: 🎨 More RMXP refactors * refactor: 🎨 Improve rmxp struct exports * feat(filesystem): ✨ Load from RTPs * feat(filesystem): ✨ Load rtps on Linux * fix(filesystem): 🐛 Fix duplication issues and general code smell * fix(filesystem): 🐛 Apparently rgssad and rgss2a are the same * feat(audio): ✨ Midi support (uses a public domain soundfont recommended in the mkxp readme) * fix(audio): 🐛 FIx audio crash when unloading a project * refactor(tilemap): 🎨 Move tilepicker to seperate struct * refactor(tilemap): 🎨 Move blendmode to be a shared enum * fix(audio): 🐛 Windows filepaths cause me agony * refactor: 🎨 Use a slab instead of hashmap for tilemap resources * feat(tilemap): ✨ Add event tooltip and refactor code Very jank. Need to fix * fix: 🚨 Fix dependencies * feat(filesystem): ✨ Add rgss3a support * feat(tilemap): ✨ Re-add tilemap layer toggling, with extra performance!! * chore: Update pinned nightly to 08/28/2023 * ci: Bump nightly in workflows * ci: 👷 Limit cargo jobs * ci: 👷 Limit jobs even more * ci: 👷 grahhh github * feat(tilemap): ✨ Add tile snapping * fix: 🐛 Fix event tooltip scaling * feat: ✨ Global config window * Slightly reduce quad size for map tiles (#35) * Fix rendering of event graphics and the tilepicker (#36) * Implement `calc_quad` in atlas.rs properly This is just a stopgap to get the events with tileset graphics rendering properly. It's probably better to get rendering of these events to go through the tilemap shader somehow... * Move the "+ 1" from atlas.rs to event.rs in case it is an isolated issue * Implement `Tiles::draw` for the tilepicker and other non-layered surfaces * Run rustfmt on src/graphics/primitives/tiles/mod.rs * Tilepicker no longer needs to clone or copy the atlas * Atlas wraparound is now handled when rendering tiles * fix(tilemap): 🐛 Fix tileset rendering with no autotiles * Atlas wrapping handler fixes (#37) * Replace leftover hardcoded values in `calc_quad` * Fix rendering of tiles to the right of the autotiles * chore: ⬇️ Change dependency optimization level This helps with compile times on debug builds massively * ci: 👷 Use mold and lld as linkers, bump nightly There is apparently a regression in the pervious version of nightly, bumping it should fix it? * ci: 💚 Install clang and mold in checks * Tile drawing implementation and bug fixes (#38) * Fix off-by-one when the layer number is displayed * Basic tile drawing for non-autotiles * Fix tilepicker default width being too small * Fix `Table3` indexing implementation Co-authored-by: Speak2Erase <lily@nowaffles.com> * Fix tilepicker showing incorrect autotile graphics RPG Maker XP displays autotile index 47 for autotiles in the tilepicker, not 0. * Tile drawing now works with autotiles as well * Fix bottom-right corner of map not rendering * Blank tiles should always have ID 0 --------- Co-authored-by: Speak2Erase <lily@nowaffles.com> * perf(tilemap): ⚡ Use push constants instead of uniforms * feat(tilemap): ✨ Add layer darkening * Fix out-of-bounds vector access in `recompute_autotile` (#39) * Implement basic event manipulation operations in the map editor (#40) * `MapView.events` is now a `Slab` instead of a `HashMap` * Add mechanism for selecting events in the map If you hover over an event graphic in the map, it'll now show a magenta outline to show that it is selected (for things like moving it around, editing the event or deleting it). If there are multiple overlapping graphics, the one with the highest ID will be selected because event graphics are rendered in order of ID. Alternatively you can also hover over the actual tile on which the event is located, which allows you to select an event that is completely covered by another event's graphic without having to move the covering graphic aside. A green border is rendered around the selected event's tile to make this user-friendly. * This arm is unreachable assuming `map.events` is sorted * Remove redundant type annotation * Selected event is now highlighted in the hover tooltip * Apply texture bleeding fix to events as well * Don't interact with events if event layer isn't selected * Event editor now opens when double-clicking events * I was wrong; this line is not safe * Fix name editing in the event editor * Events can now also be selected by the yellow square cursor * Implement event deletion when pressing delete on the map * Event editor windows now have (mostly) unique IDs * Use a vector to store the events instead of a slab A slab does not support inserting elements at arbitrary positions, which we'll need to do if we want to change the ID of an event. Also, we already know where all of the unused IDs are since we have to iterate through all the events every time we draw the map, so a regular vector will not lose any performance compared to a slab. * Double-click on map tiles without events to create one * Enter key can now also be used for event creation/editing * Fix incorrect serialization length for `OptionVec` * Drag-and-drop events to move them on the map * Remove unused variables from map_view.rs * Event drag-and-drop now preserves the event offset from the cursor * Apply clippy recommendations * Apply another clippy recommendation * Fix misleading comment in src/tabs/map.rs * Don't move events when the mouse is not hovering over them * Simplify deserialization implementation for OptionVec * Remove `pub` from `event_drag_offset` * Fix crash when adding event on a map with no events * Prevent event from sticking to cursor after double-clicking * Selected event border is now yellow instead of magenta * Show magenta border around events that are being edited * feat(tilemap): ✨ Handle keyboard for moving the cursor * Implement the circle, rectangle and fill brushes (#41) * Fix corner case in `OptionVec` `FromIterator` implementation * Implement the flood fill brush * Implement the rectangle brush * Implement the circle/ellipse brush * Buffer all map tile changes to reduce brush lag * Fix arrow keys allowing map cursor to move out of bounds * Implement drawing rectangular regions of tiles from the tilepicker (#42) * Allow multiple tiles to be selected in the tilepicker * Refactor the tile calculation function in tilepicker.rs * Implement rectangle drawing for all four brushes * Fix redundant position calculation in src/tabs/map.rs * Fix tilepicker selection being able to extend out of bounds * Fix pattern rectangle being shown when event layer is selected * Fix pattern rectangle extending out of map bounds * Pen brush needs to do bounds checking * Floor tileset height to nearest multiple of 32 Rounding down to the nearest multiple of 32 is the correct behavior when the tileset height in pixels is not divisible by 32. * Fix tilepicker not showing last row of tiles * chore: 📝 Update readme to include finished features * refactor: 🎨 Move primitives into mod.rs * chore: 🎨 Rustfmt --------- Co-authored-by: white-axe <whiteaxe@tuta.io>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My implementation of the rectangle and circle brushes is a lot less laggy than RPG Maker XP's because it only writes to the UI the tiles that the brushes actually changed in the current frame instead of all of the tiles in the entire rectangle/circle.
This pull request also fixes two unrelated bugs.