Comments (5)
I think this is a great idea. To let you know, I've previously done work on trying to refactor the menu system to make it easier to use in the "menu_refactor" branch. It's been a while since I've worked on it, so merging it to development might be painful, but I'd like to incorporate some of its functionality into the menus.
You can take a look at the refactored menu I've been working on here: https://github.com/Tuxemon/Tuxemon/blob/menu_refactor/tuxemon/core/components/menu/__init__.py#L50
from tuxemon.
I can merge that into my branch. Looks like there was a lot of effort put
into it. It would help me if you could make a small list of the overall
changes that need to be migrated. From just a quick look, it seems that the
complicated parts have been broken down functions. Thanks!
Overall, my goal for the menu refactor has been to break down some parts
to make them fit the State API. I don't want to re implement them, just
move enough code around that it works.
On Wed, Dec 30, 2015 at 12:14 AM William Edwards [email protected]
wrote:
I think this is a great idea. To let you know, I've previously done work
on trying to refactor the menu system to make it easier to use in the
"menu_refactor" branch. It's been a while since I've worked on it, so
merging it to development might be painful, but I'd like to incorporate
some of its functionality into the menus.You can take a look at the refactored menu I've been working on here:
https://github.com/Tuxemon/Tuxemon/blob/menu_refactor/tuxemon/core/components/menu/__init__.py#L50—
Reply to this email directly or view it on GitHub
#85 (comment).
from tuxemon.
Yeah, the refactor removed a lot of unnecessary legacy bits and added a lot of helper methods to remove a lot of the code duplication seen throughout the codebase.
Here's a quick summary of the things I had done:
- Removed unnecessary parameters like
screen
,resolution
, etc. - Added init params to construct menus with their size and position upon creation.
- Made the menu inherit from the
UserInterface
class to provide functionality like moving over time and playing background and menu border animations. - Added
next
,previous
, anddone
to make menus more state-like. These will probably be deprecated with your changes. - Broke up some methods into smaller functions for easier reuse and readability.
- Added helper methods like
menu_select_next
,menu_select_prev
,set_size
, andset_position
. - Made drawing dependent on the
self.visible
property. - Made input handling dependent on the
self.interactable
property. - Replaced methods like
draw
,draw_text
, anddraw_textItem
with a singledraw()
method. - Text drawing is done automatically in
draw
after you callset_text
once instead of needing to pass the text to draw every frame.
from tuxemon.
Thanks for the write up. Details like how text drawing will help make sure there are no regressions.
from tuxemon.
I'm going to close this. My current branch has changes the "pos_x", "size_x", etc variables into pygame Rects. Updates to the states/menu refactor will be in #72.
from tuxemon.
Related Issues (20)
- teleport_faint should be a transition, not instantaneous
- Enums for sprites broken with python 3.11+
- Rename character
- Game freezes after first battle HOT 4
- Text inconsistency when playing as a female character. HOT 5
- If a Tuxemon has too many techniques, the game will crash HOT 1
- When you lose a battle, the game doesn't wait until you've exited the battle to continue events HOT 1
- how do you advance past the part with the first med centre? HOT 10
- If a player faint their only Tuxemon in the early game, the game will glitch out
- The player encountered a game crash right after the first battle against Bille.
- Allow custom music to be set for battles HOT 1
- The game crashed when entering the building. HOT 5
- White squares instead of some tiles HOT 3
- Game crashes if you sell a tuxemon + 2 dialog bugs
- Screen goes black if you're defeated on Route 3
- If two tuxemon attack, the one with the lower speed attacks first
- Add a challenge mode where you only battle HOT 4
- After battling a trainer on Route 3, the game crashes.
- The protagonist can walk through the fence in the city park. HOT 3
- Upon reaching Route 3, the protagonist is sometimes teleported to the wrong location.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuxemon.