Keep complete game frames while new sprites load
This commit is contained in:
1 parent
f8eda9f016
commit
8a6d3e0040
4 files changed
+19
-1
No files matched your search
@@ -1,4 +1,6 @@
|
||||
#import, file "../apps/node_app_tree.zi";
|
||||
#import, file "../screens/node_app_screen.zi";
|
||||
#import, file "../core/types.zi";
|
||||
c :: #system_library "c";
|
||||
raylib_log :: #system_library "raylib";
|
||||
LOG_INFO :: 3
|
||||
@@ -595,7 +597,9 @@ app_frame :: (argument: *void) {
|
||||
#if !#defined(PLATFORM_WEB) {
|
||||
if retained {
|
||||
retained_ok := true
|
||||
if app.ui.retained_frame_unchanged {
|
||||
hold_pictures := app.breathing.screen == ScreenNodeApp && !app.launcher_open &&
|
||||
app.modal.active == 0 && node_screen_hold_pictures
|
||||
if app.ui.retained_frame_unchanged || hold_pictures {
|
||||
retained_ok = EndRetainedFrameReusePrevious()
|
||||
} else {
|
||||
retained_ok = EndRetainedFrame()
|
||||
|
||||
@@ -16,6 +16,12 @@ NodeScreenWasShown :: (state: *NodeScreenLoadingState, identity: u64) -> bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Once visible, a late animation image keeps the last complete game frame
|
||||
// on screen instead of returning to a cover or presenting a missing tile.
|
||||
NodeScreenHoldPictures :: (state: *NodeScreenLoadingState, identity: u64, pictures_ready: bool) -> bool {
|
||||
return NodeScreenWasShown(state, identity) && !pictures_ready
|
||||
}
|
||||
|
||||
NodeScreenNeedsCover :: (state: *NodeScreenLoadingState, identity: u64, pictures_ready: bool) -> bool {
|
||||
// Later sprites belong to gameplay, not to the app's opening stage.
|
||||
if NodeScreenWasShown(state, identity) {
|
||||
|
||||
@@ -95,6 +95,7 @@ node_screen_friend_name: [80]u8;
|
||||
node_screen_alias: [80]u8;
|
||||
// The account's public ID, copied: settings reads share one buffer.
|
||||
node_screen_account: [80]u8;
|
||||
node_screen_hold_pictures: bool;
|
||||
|
||||
NodeScreenFriends :: (app: *InnerBreeze) -> string {
|
||||
if app.profile_friends_loaded == 0 {
|
||||
@@ -371,6 +372,7 @@ AppScreenOpening :: (app: *InnerBreeze) -> bool {
|
||||
|
||||
#program_export
|
||||
node_app_screen_draw :: (app: *InnerBreeze) {
|
||||
node_screen_hold_pictures = false
|
||||
if app == null {
|
||||
return
|
||||
}
|
||||
@@ -437,6 +439,9 @@ node_app_screen_draw :: (app: *InnerBreeze) {
|
||||
NodeAppUiEnd()
|
||||
identity := NodeScreenIdentity(slot)
|
||||
pictures := NodeScreenPictureProgress(slot)
|
||||
runtime := NodeTreeRuntime(slot)
|
||||
node_screen_hold_pictures = runtime != null && runtime.node != null && !runtime.node.collection &&
|
||||
NodeScreenHoldPictures(*node_screen_loading, identity, pictures.ready >= pictures.total)
|
||||
if NodeScreenNeedsCover(*node_screen_loading, identity, pictures.ready >= pictures.total) {
|
||||
NodeScreenCover(app, area, pictures)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#program_export
|
||||
main :: () -> s32 {
|
||||
state: NodeScreenLoadingState
|
||||
if NodeScreenHoldPictures(*state, 1, false) { return 20 }
|
||||
// The first frame is covered even when it hasn't requested images yet.
|
||||
if !NodeScreenNeedsCover(*state, 1, true) { return 1 }
|
||||
// Opening may report ready before the first board requests its pictures.
|
||||
@@ -15,6 +16,8 @@ main :: () -> s32 {
|
||||
if !NodeScreenNeedsCover(*state, 1, false) { return 16 }
|
||||
if !NodeScreenNeedsCover(*state, 1, true) { return 17 }
|
||||
if NodeScreenNeedsCover(*state, 1, true) { return 4 }
|
||||
if !NodeScreenHoldPictures(*state, 1, false) || NodeScreenHoldPictures(*state, 1, true) { return 21 }
|
||||
if NodeScreenHoldPictures(*state, 2, false) { return 22 }
|
||||
// Turning the player requests a new sprite. The visible game stays up
|
||||
// while that picture decodes, including across consecutive moves.
|
||||
if NodeScreenNeedsCover(*state, 1, false) { return 5 }
|
||||
|
||||
Reference in new issue
Block a user