This PR adds an optional parameter to raycast API called maxDistance. Using this parameter users can control the limit within which raycast scans for hits.
This PR adds a new method called lookAt for PositionComponent. It is a convenience method which rotates the component to make it point towards/look at the given target position.
Additionally, this PR also adds a angleTo method which can be used to get the calculated angle for lookAt. It will be useful if someone want to smoothly rotate towards target using effects or manual lerping.
This PR adds two updates.
It updates the flame_forge2d to latest version i.e on pub.dev in examples and padracing projects.
Adds a bouncing ball example in the collision detection examples demonstrating a simple example of collision and bouncing of a ball from the walls around it.
This PR implements raytracing and raycasting for the built-in hitboxes.
If you pass in your own collision detection system to the HasCollisionDetection mixin you have to change the signature of that to: CollisionDetection<ShapeHitbox>instead of CollisionDetection<Hitbox>.
This PR introduces the notions of structured text, and text styles, to support rendering of rich text bodies.
Specifically, we recognize that sometimes in games one needs to render pieces of text that are larger than a single word or even a single paragraph. These pieces may include: books, quest descriptions, mission objectives, tutorials, in-game help system, dialogues, etc. Rendering such a piece of text is non-trivial, however. In order to tackle this problem, I break into the following parts:
Text structure, represented as a tree of Nodes. The nodes describe the logical structure of the text, for example the document may contain a header, and then several paragraphs, and a list, where the list contains some list items, some of which having possibly several paragraphs, etc. This structure is similar to how in HTML the text is marked up with HTML tags.
Text styles are struct-like classes that contain properties describing how the text is to be styled: font size, font renderer, borders, backgrounds, margins, padding, etc. This representation is also tree-like, so that for example text inside paragraphs can have different style than text within headers, and paragraphs within lists can have different margins. A text style is similar to a stylesheet in HTML.
Text elements are the result of applying the document style to a document node: they are the "prepared" and laid out pieces, ready to be rendered. Elements are a bit like mini-components, or perhaps text "particles" in a particle system.
This simple refactor allows us to write class MyGame extends Game, instead of a more awkward class MyGame with Game. However, using ... with Game still continues to work, so no changes necessary for the users.
This PR adds a new event system based on the componentsAtPoint delivery mechanism. These events allow for a proper support of components that implement renderTree() method. The CameraComponent is one such component, with more planned in the future.
Additionally, the following improvements compared to the current tap events added:
- the same component can be tapped with multiple fingers simultaneously;
- a component that received onTapDown is guaranteed to receive onTapUp or onTapCancel later;
- a component that moves away from the point of touch will receive onTapCancel instead of onTapUp (even though the game widget receives onTapUp from Flutter).
Due to the fact that the switch from the current event system to the new event system is potentially a significant breaking change, the new event system is introduced as parallel to the existing one. This way we have more time to test the new system before recommending the switch and deprecating the old one; and the switch itself should feel more gradual.
Created a mixin to handle the margin to the viewport, mostly to remove the code duplication in ButtonComponent and HudButtonComponent, but it can also be useful in other cases when you don't want to wrap your component in HudMarginComponent.
Once the new camera system is in place this will of course have to be replaced.
- Added option align in the TextBoxComponent which controls the alignment of text.
- Added option for the TextBoxComponent to have a fixed size (before the only mode was for the textbox to automatically expand/shrink to fit the text).
* wip o lifecycle
* Component.add() is no longer async
* fix a test
* game.ready
* fix analyze issues
* FcsRoot
* fix tests
* fix game-in-game example
* Merge _addImpl with add()
* Move some of the functionality from prepare() into add()
* Moved FcsRoot into component.dart and renamed
* more doc-comments
* dartdocs
* Remove addLater in ComponentSet
* format
* temporarily switch to path dependency in flame_test
* restore a test
* format
* get rid of prepare() in Collidable
* eliminate prepare() in Draggable
* eradicate prepare() in Hoverable
* remove prepare() from Tappable
* remove prepare() method and isPrepared flag
* remove prepareComponent() from HasCollidables
* remove prepareComponent
* make flame_bloc depend on latest flame
* try to solve flame_bloc dependency graph
* fix game resize issue
* fix gameresize for zoomed game
* do not allow zero size in onGameResize
* move onMount() call into add()
* use loadingBuilder when size is 0
* ComponentTreeRoot is now in its own file
* addToParent()
* switch to mount queue
* rename isReadyToMount -> isPrepared
* make isMounted and isPrepared readonly
* minor
* print error stacktrace
* Component.add() is now async
* fix tests
* unused import
;
* undo irrelevant changes in Component
* update tests
* tests cleanup
* format
* expand doc for ComponentTreeRoot
* fix analysis error
* added tests
* update docs
* resolve version conflict in pubspec
* Apply suggestions from code review
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
* late final
* remount() function
* remove mountQueue
* simplify ready()
* run mount during children queue processing
* simplify mounting
* rename childrenQueue->childreQueues
* merge tryMounting() with remount()
* avoid statics in components lifecycle
* remove ComponentTreeRoot
* remove dead code
* added a todo
* added docs for SingleGameInstance
* Added tests for SingleGameInstance
* added SingleGameInstance to the main doc site
* Added test for multi-widget games
* cleanup
* use state variable in Component
* remove test as dependency
* upgrade mocktail version
* upgrade dartdoc version
* fix analyzer warnings
* mark staticgameinstance as internal
* remove ComponentSet.addChild
* use log() from dart:developer
* undo changes in flame_bloc/pubspec.yaml
* redo changes in flame_bloc/pubspec.yaml
* fix dependency in flame_test
* remove test dependencies
* update pubspec files
* remove dart_code_metrics from pubspec
* fix a test
* Added GameTester.makeReady
* omit type on class variable when it can be inferred
Co-authored-by: Erick <erickzanardoo@gmail.com>
Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
Co-authored-by: Erick <erickzanardoo@gmail.com>