58 Commits

Author SHA1 Message Date
Eric Seidel
a09baca0dd Add C++ based support for drawAtlas
This is supposed to make Viktor's game faster, but it's not clear
to me that it actually does.  I've left the code
using the dart version of drawAtlas for now until Viktor can
verify that it looks correct.

I also added a wrapper for SkFilterQuality in the process of
debugging SkCanvas.drawAtlas since all drawAtlas examples
in Skia use FilterQuality.low.  The bug which blocked me for
so long turned out to be that SkCanvas.drawAtlas doesn't
draw anything if antialiasing is turned on.

Issue #138.

R=abarth@google.com
2015-07-23 09:25:10 -07:00
Adam Barth
c60b3ee954 Merge pull request #233 from abarth/fix_analyzer
Fix analyzer warnings
2015-07-23 08:56:10 -07:00
Adam Barth
499a13c5ee Fix analyzer warnings
- Remove unused imports
 - Remove unused, broken constructor for MineDiggerApp
2015-07-23 08:54:51 -07:00
Hixie
86fd1e4840 Rename defaultFocus to initialFocus. 2015-07-23 08:43:40 -07:00
Eric Seidel
db577577c7 Focus support.
This patch provides a class to manage focus, Focus, and a class to
manage ownership of the keyboard, KeyboardHandle.

Inherited (in widgets.dart) is adjusted to support subclasses that
need to copy state from instance to instance.

A GlobalKey key type is introduced that is basically the same as
UniqueKey. Component classes that need a globally-unique key can
specify that their 'key' constructor argument is a GlobalKey.

Focus
-----

You can use `Focus.at(this)` to determine if you, a Component, are
currently focused.

You can use `Focus.moveTo(this)` to take the focus or give it to a
particular component.

For this to work, there has to be a Focus class in the widget
hierarchy.

Currently, there can only be one Focus class, because nested scopes
aren't supported. We should add support for that in a future patch.
See issue #229.

KeyboardHandle
--------------

Instead of directly interacting with the keyboard service, you now ask
for a KeyboardHandle using `_keyboard.show(client)`. This returns a
KeyboardHandle class. On that class, you can call `handle.release()`
when you want to hide the keyboard. If `handle.attached` is still
true, and you need to reshow the keyboard after the user hid it, then
you can can `handle.showByRequest()`.

The point of this is that the `keyboard.show()` method maintains the
invariant that only one KeyboardHandle is live at a time.

There are some issues with the keyboard service that I filed as a
result of doing this patch: #226 #227
2015-07-23 08:43:40 -07:00
Adam Barth
c523468e2e Don't try to access the network in Stocks test
Accessing the network created a race condition that would sometimes cause other
tests to fail.
2015-07-23 08:39:42 -07:00
Hans Muller
221e1e0dee Dismissable provides intrinsic support for resize animation 2015-07-22 12:55:45 -07:00
Viktor Lidholt
84230d4997 Merge branch 'master' of github.com:domokit/sky_engine 2015-07-22 10:37:55 -07:00
Viktor Lidholt
5460afc357 Adds scoring and level up in game demo 2015-07-22 10:37:28 -07:00
Collin Jackson
4a4e303ad9 Fix build 2015-07-22 10:28:43 -07:00
Collin Jackson
470a8c77c8 Merge remote-tracking branch 'dk/master' into meal
Conflicts:
	sky/sdk/example/fitness/lib/feed.dart
2015-07-22 10:21:48 -07:00
mpcomplete
24d40f858f Merge pull request #211 from mpcomplete/rm.builder.3
Make SnackBar animate itself.

This introduces a bit of a regression - the FloatingActionButton no longer animates. I'm not sure yet how to animated the FAB along with the SnackBar. Maybe some notion of anchoring a node to another.

Also remove last use of AnimationBuilder.
2015-07-22 12:29:57 -04:00
Hixie
383e504f5a Introduce an explicit Key type.
This fixes some theoretical bugs whereby we were using hashCode to try
to get unique keys for objects, but really we wanted object identity.
It also lays the groundwork for a new GlobalKey concept.

I tried to keep the impact on the code minimal, which is why the "Key"
constructor is actually a factory that returns a StringKey. The code
has this class hierarchy:

```
   KeyBase
    |
   Key--------------+---------------+
    |               |               |
   StringKey    ObjectKey       UniqueKey
```

...where the constructors are Key and Key.stringify (StringKey),
Key.fromObjectIdentity (ObjectKey), and Key.unique (UniqueKey).

We could instead of factory methods use regular constructors with the
following hierarchy:

```
   KeyBase
    |
   LocalKey---------+---------------+
    |               |               |
   Key      ObjectIdentityKey   UniqueKey
```

...with constructors Key, Key.stringify, ObjectIdentityKey, and
UniqueKey, but I felt that that was maybe a more confusing hierarchy.
I don't have a strong opinion on this.
2015-07-22 09:14:06 -07:00
Viktor Lidholt
ff96724e9f Merge pull request #202 from vlidholt/master
Fixes issues with invalidating matrix for SpriteBox & adds HUD to demo game
2015-07-22 09:01:39 -07:00
Viktor Lidholt
ed4329e3af Fixes formatting and removes redundant code in sprites 2015-07-22 08:59:14 -07:00
Matt Perry
ebbaec976b Make SnackBar animate itself. 2015-07-22 11:53:57 -04:00
Matt Perry
396f7da77f rebase 2015-07-22 11:52:34 -04:00
Ian Hickson
80ed0105d0 Merge pull request #205 from Hixie/minedigger
Many code improvements to Mine Digger.
2015-07-22 08:23:55 -07:00
Adam Barth
404e244a08 Merge pull request #201 from eseidelGoogle/fuzz_crashes
Fix 2 crashes found by Hixie's fuzzer.
2015-07-21 19:59:24 -07:00
Hixie
f6bb39d37a Many code improvements to Mine Digger.
Text styles are now a global constant instead of being initialised dynamically.
There are now sufficient text styles for 8 mines around a square.
I coallesced Game and MineDiggerApp.
Used an enum instead of constants for the cell state.
Used setState() instead of scheduleBuild().
Used an O(N) algorithm for mine laying instead of the previous potentially-never-ending algorithm.
Moved the listener on the cells to the app, so that the logic survives a rebuild.
Various other minor changes.
2015-07-21 17:24:51 -07:00
Collin Jackson
ea28a63d9a First pass at adding meal tracking to fitness app 2015-07-21 17:13:00 -07:00
Viktor Lidholt
6216bc2ee0 Merge branch 'master' of github.com:domokit/sky_engine 2015-07-21 16:46:14 -07:00
Viktor Lidholt
61c039458d Fixes issues in demo game and adds heads up display 2015-07-21 16:45:53 -07:00
Viktor Lidholt
cf1896d594 Fixes issues with invalidating matrix for SpriteBox 2015-07-21 16:42:51 -07:00
Eric Seidel
68e5c9bebe Fix 2 crashers found by Hixie's fuzzer.
The first one is that we weren't setting up a
FontCachePurgePreventer during drawText.  It's not clear
that this is the correct fix, since Blink doesn't have
this FontCachePurgePreventer here either, but it's also
possible that they would hit this same ASSERT and just
not care (since ASSERTs are disabled on clusterfuzz).

The second fix is making ExceptionState actually track
whether it has thrown an exception or not. The c++ code
was depending on this working in order to return early
from dom functions and not crash!

R=abarth@google.com
2015-07-21 16:29:04 -07:00
Hixie
5e6d9d6bb5 Remove redundant operator== and hashCode functions in card example.
It turns out that we aren't really using these. The identity logic is sufficient.

Also, add some asserts for a crash I had once but couldn't reproduce, in case that helps catch it next time.
2015-07-21 15:26:54 -07:00
Hixie
761ab683d1 Rationalise usage of keys in navigator.dart.
Route (named routes) no longer have a key, and have their own storage for their names.
RouseState no longer has a key, and uses an owner field pointing to a StatefulComponent instead.
As such, RouteBase no longer has a key.

HistoryEntry no longer uses a global int to ensure uniqueness.

Propagated this to stocks app.
2015-07-21 14:58:48 -07:00
Adam Barth
24c88827e5 Roll version to 20 2015-07-21 14:56:54 -07:00
Adam Barth
a43a34e901 Fix more analyzer warnings 2015-07-21 13:59:18 -07:00
Adam Barth
6dc026bdac Merge pull request #191 from abarth/image_height_width
Separate width and height parameters for Image widgets
2015-07-21 13:54:56 -07:00
Adam Barth
b5d28fb524 Merge pull request #192 from abarth/fix_warnings
Fix analyzer warnings
2015-07-21 13:52:37 -07:00
Adam Barth
b8d45ce91e Fix analyzer warnings 2015-07-21 13:51:27 -07:00
Adam Barth
50eac9559a Separate width and height parameters for Image widgets
This change makes it easier to defined only the width or the height of an image
and let the other value be filled in from the image's intrinsic aspect ratio.

Fixes #175
2015-07-21 13:46:10 -07:00
mpcomplete
1c80d294c7 Merge pull request #188 from mpcomplete/animated_value
Renamed AnimatedType to AnimatedValue
2015-07-21 13:45:50 -07:00
Viktor Lidholt
0c59c4963b Merge pull request #184 from vlidholt/master
Updates sprite widget to handle changes to renderbox
2015-07-21 13:32:22 -07:00
Viktor Lidholt
7039e9b09f Minor formatting fixes 2015-07-21 13:30:30 -07:00
Matt Perry
a421da3c1b Renamed AnimatedType to AnimatedValue 2015-07-21 12:55:16 -07:00
Hixie
da2fa52eb4 Minor style changes around demo cards. 2015-07-21 12:18:10 -07:00
Viktor Lidholt
2715bc00e1 Merge branch 'master' of github.com:domokit/sky_engine into HEAD 2015-07-21 11:30:52 -07:00
Viktor Lidholt
db17b89c7f Adds main screen to game and graphics for game UI 2015-07-21 11:30:17 -07:00
Viktor Lidholt
dd16c1a55a Updates sprite widget to handle changes to renderbox 2015-07-21 11:26:57 -07:00
Hixie
c63fd4b121 This demo is a fuzzer of sorts, testing in particular our text layout system and painting. 2015-07-21 10:56:08 -07:00
Collin Jackson
c12d5d9dfb Merge pull request #166 from collinjackson/fitness
Measurement tracking for fitness app.

There is an issue with the input control that prevents actually creating a measurement. Working on this with eseidel.

R=eseidel
2015-07-20 16:25:19 -07:00
Collin Jackson
3f55a95d00 Add basic measurement functionality to fitness app 2015-07-20 16:20:59 -07:00
Hans Muller
344ee7ccf4 Make it possible to identify BlockViewport children whose size or type has changed 2015-07-20 15:41:21 -07:00
Collin Jackson
e90f865f21 Tweaks to launcher 2015-07-20 11:20:47 -07:00
Collin Jackson
04ecd8a888 Support for non-alphabetic baselines 2015-07-17 17:06:08 -07:00
Collin Jackson
49a878468c Fix layout of stocks row 2015-07-17 16:10:10 -07:00
Collin Jackson
d7d625b2bf Update example 2015-07-17 14:29:05 -07:00
Collin Jackson
7f9db79750 Fix #57 Flex needs to understand baselines 2015-07-17 12:46:51 -07:00