-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
151 additions
and
63 deletions.
There are no files selected for viewing
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
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
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
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
21 changes: 21 additions & 0 deletions
21
src/main/java/com/tttsaurus/ingameinfo/common/impl/appcommunication/spotify/SpotifyView.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.tttsaurus.ingameinfo.common.impl.appcommunication.spotify; | ||
|
||
import com.tttsaurus.ingameinfo.common.api.mvvm.view.View; | ||
|
||
public class SpotifyView extends View | ||
{ | ||
@Override | ||
public String getDefaultIxml() | ||
{ | ||
return | ||
""" | ||
<ImageUrl uid = "albumImage" width = 20 height = 20> | ||
"""; | ||
} | ||
|
||
@Override | ||
public String getIxmlFileName() | ||
{ | ||
return "spotify"; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../java/com/tttsaurus/ingameinfo/common/impl/appcommunication/spotify/SpotifyViewModel.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.tttsaurus.ingameinfo.common.impl.appcommunication.spotify; | ||
|
||
import com.tttsaurus.ingameinfo.common.api.mvvm.binding.Reactive; | ||
import com.tttsaurus.ingameinfo.common.api.mvvm.binding.ReactiveObject; | ||
import com.tttsaurus.ingameinfo.common.api.mvvm.viewmodel.ViewModel; | ||
|
||
public class SpotifyViewModel extends ViewModel<SpotifyView> | ||
{ | ||
@Reactive(targetUid = "albumImage", property = "url", initiativeSync = true) | ||
public ReactiveObject<String> albumImageUrl = new ReactiveObject<>(){}; | ||
|
||
@Override | ||
public void start() | ||
{ | ||
albumImageUrl.set("https://media.forgecdn.net/avatars/thumbnails/1071/348/256/256/638606872011907048.png"); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/tttsaurus/ingameinfo/common/impl/gui/control/UrlImage.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.tttsaurus.ingameinfo.common.impl.gui.control; | ||
|
||
import com.tttsaurus.ingameinfo.common.api.gui.layout.Rect; | ||
import com.tttsaurus.ingameinfo.common.api.gui.registry.RegisterElement; | ||
import com.tttsaurus.ingameinfo.common.api.gui.style.StyleProperty; | ||
import com.tttsaurus.ingameinfo.common.api.gui.style.StylePropertyCallback; | ||
import com.tttsaurus.ingameinfo.common.impl.render.renderer.UrlImageRenderer; | ||
|
||
@RegisterElement | ||
public class UrlImage extends Sized | ||
{ | ||
private final UrlImageRenderer urlImageRenderer = new UrlImageRenderer(); | ||
|
||
@StylePropertyCallback | ||
public void setUrlCallback() | ||
{ | ||
urlImageRenderer.updateURL(url); | ||
} | ||
@StyleProperty(setterCallbackPost = "setUrlCallback") | ||
public String url; | ||
|
||
@Override | ||
public void calcRenderPos(Rect contextRect) | ||
{ | ||
super.calcRenderPos(contextRect); | ||
urlImageRenderer.setX(rect.x); | ||
urlImageRenderer.setY(rect.y); | ||
} | ||
|
||
@Override | ||
public void calcWidthHeight() | ||
{ | ||
super.calcWidthHeight(); | ||
urlImageRenderer.setWidth(width); | ||
urlImageRenderer.setHeight(height); | ||
} | ||
|
||
@Override | ||
public void onFixedUpdate(double deltaTime) | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void onRenderUpdate(boolean focused) | ||
{ | ||
urlImageRenderer.render(); | ||
} | ||
} |
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
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
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
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
9 changes: 0 additions & 9 deletions
9
src/main/java/com/tttsaurus/ingameinfo/common/impl/test/TestView.java
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/main/java/com/tttsaurus/ingameinfo/common/impl/test/TestViewModel.java
This file was deleted.
Oops, something went wrong.
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