Skip to content

Commit

Permalink
smooth camera for android
Browse files Browse the repository at this point in the history
  • Loading branch information
julesgrc0 committed Mar 7, 2024
1 parent 886110a commit 6a5a58c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:supportsRtl="true"

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:targetApi="30">
tools:targetApi="21">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
Expand Down
3 changes: 2 additions & 1 deletion src/screens/game/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ w_bridge *create_bridge() {
return NULL;
}
memset(td, 0, sizeof(w_bridge));
td->force_update = true;

td->chunk_group = create_chunkgroup(CHUNK_GROUP_MID_LEN);
if (td->chunk_group == NULL) {
Expand Down Expand Up @@ -46,6 +45,8 @@ w_bridge *create_bridge() {
}

td->is_active = true;
td->force_update = true;

#if defined(WISPY_WINDOWS) || defined(WISPY_LINUX)

update_bridge(td);
Expand Down
7 changes: 4 additions & 3 deletions src/screens/game/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@ void game_screen(w_state *state) {
destroy_gui(ctx);
return;
}
#else
float dt = 0.f;
#endif

w_breakstate bstate = BS_NONE;
float dt = 0.f;

while (!WindowShouldClose() && td->is_active) {
#if defined(WISPY_ANDROID)
update_controls(td->ctrl);
td->camera->position = td->camera->target_position;
bstate = update_blockbreaker(bb, td->ctrl, td->player, PHYSICS_TICK);
update_bridge(td);
smooth_camera(td->camera, PHYSICS_TICK * PLAYER_SPEED * 4.f);
#else
update_controls(td->ctrl);
dt = GetFrameTime();
Expand Down

0 comments on commit 6a5a58c

Please sign in to comment.