Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into augustus-master
Browse files Browse the repository at this point in the history
  • Loading branch information
crudelios committed May 8, 2024
2 parents b0c05df + c87d131 commit 5b7491c
Show file tree
Hide file tree
Showing 10 changed files with 94 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .ci_scripts/build_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ case "$DEPLOY" in
DEPLOY_FILE=augustus-$VERSION-linux-x86_64.zip
cp "${build_dir}/augustus.zip" "deploy/$DEPLOY_FILE"
;;
"flatpak")
PACKAGE=linux-flatpak
DEPLOY_FILE=augustus-$VERSION-linux.flatpak
flatpak build-export export repo
flatpak build-bundle export augustus.flatpak com.github.keriew.augustus --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
cp augustus.flatpak "deploy/$DEPLOY_FILE"
;;
"vita")
PACKAGE=vita
DEPLOY_FILE=augustus-$VERSION-vita.vpk
Expand Down
6 changes: 6 additions & 0 deletions .ci_scripts/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ mkdir -p deps
if [ "$BUILD_TARGET" == "appimage" ] || [ "$BUILD_TARGET" == "codeql-cpp" ]
then
sudo add-apt-repository universe && sudo add-apt-repository ppa:savoury1/multimedia && sudo apt-get update && sudo apt-get -y install libgl1-mesa-dev libsdl2-dev libsdl2-mixer-dev libfuse2
elif [ "$BUILD_TARGET" == "flatpak" ]
then
sudo apt-get update && sudo apt-get -y install flatpak-builder
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
sudo flatpak-builder repo com.github.keriew.augustus.json --install-deps-from=flathub --install-deps-only --delete-build-dirs
sudo rm -R .flatpak-builder
elif [ ! -z "$SDL_VERSION" ] && [ ! -z "$SDL_MIXER_VERSION" ]
then
if [ "$BUILD_TARGET" == "mac" ]
Expand Down
4 changes: 4 additions & 0 deletions .ci_scripts/run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ case "$BUILD_TARGET" in
zip -r augustus.zip augustus.dmg
fi
;;
"flatpak")
flatpak-builder repo com.github.bvschaik.julius.json --install-deps-from=flathub --keep-build-dirs
cp .flatpak-builder/build/julius/res/version.txt res/version.txt
;;
"appimage")
cp -r res/maps ./build
cp -r res/manual ./build
Expand Down
2 changes: 2 additions & 0 deletions .ci_scripts/run_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ case "$BUILD_TARGET" in
"mac")
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
;;
"flatpak")
;;
"appimage")
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
;;
Expand Down
2 changes: 1 addition & 1 deletion .ci_scripts/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ case "$BUILD_TARGET" in
# Note: Using a tagged version of the container to make sure that it's not updated unexpectedly
# You can update the tag by obtaining a recent one from here: https://hub.docker.com/r/gnuton/vitasdk-docker/tags
# Make sure that it compiles correctly and runs on a Vita prior to pushing the change
docker run -d --name vitasdk --workdir /build/git -v "${PWD}:/build/git" gnuton/vitasdk-docker:20230823 tail -f /dev/null
docker run -d --name vitasdk --workdir /build/git -v "${PWD}:/build/git" gnuton/vitasdk-docker:20240412 tail -f /dev/null
;;
"switch")
# You can obtain a recent devkitA64 image from https://hub.docker.com/repository/docker/devkitpro/devkita64/general
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
fail-fast: false
matrix:
include:
- name: Linux Flatpak
os: ubuntu-20.04
BUILD_TARGET: flatpak
DEPLOY: flatpak
- name: Linux AppImage
os: ubuntu-20.04
BUILD_TARGET: appimage
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ elseif (EXISTS "${CMAKE_SOURCE_DIR}/.git")
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND git diff-index --quiet HEAD --
COMMAND git diff --quiet HEAD --
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE VERSION_COMMIT_DIRTY
)
Expand Down
27 changes: 27 additions & 0 deletions com.github.bvschaik.julius.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"id" : "com.github.bvschaik.julius",
"runtime" : "org.freedesktop.Platform",
"runtime-version" : "23.08",
"sdk" : "org.freedesktop.Sdk",
"command" : "julius",
"finish-args" : [
"--filesystem=home",
"--share=ipc",
"--device=dri",
"--socket=wayland",
"--socket=fallback-x11",
"--socket=pulseaudio"
],
"modules" : [
{
"name" : "julius",
"buildsystem" : "cmake-ninja",
"sources" : [
{
"type" : "dir",
"path" : "."
}
]
}
]
}
41 changes: 41 additions & 0 deletions src/graphics/scrollbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ enum {
TOUCH_DRAG_IN_PROGRESS = 2
};

enum {
TOUCH_DRAG_NONE = 0,
TOUCH_DRAG_PENDING = 1,
TOUCH_DRAG_IN_PROGRESS = 2
};

#define SCROLL_BUTTON_HEIGHT 26
#define SCROLL_BUTTON_WIDTH 39
#define SCROLL_DOT_SIZE 25
Expand Down Expand Up @@ -129,6 +135,41 @@ static int handle_touch(scrollbar_type *scrollbar, const touch *t, int in_dialog
return active;
}

static int touch_inside_scrollable_area(const scrollbar_type *scrollbar, const touch *t)
{
return scrollbar->max_scroll_position > 0 &&
t->start_point.x >= scrollbar->x - scrollbar->scrollable_width && t->start_point.x <= scrollbar->x - 2 &&
t->start_point.y >= scrollbar->y && t->start_point.y < scrollbar->y + scrollbar->height;
}

static int handle_touch(scrollbar_type *scrollbar, const touch *t)
{
int old_position = scrollbar->scroll_position;
int active = scrollbar->touch_drag_state == TOUCH_DRAG_IN_PROGRESS;

if (t->has_started && touch_inside_scrollable_area(scrollbar, t)) {
scrollbar->touch_drag_state = TOUCH_DRAG_PENDING;
scrollbar->position_on_touch = scrollbar->scroll_position;
}
if (t->has_moved && scrollbar->touch_drag_state != TOUCH_DRAG_NONE) {
scrollbar->touch_drag_state = TOUCH_DRAG_IN_PROGRESS;
int element_height = (scrollbar->height - 8 * scrollbar->has_y_margin) / scrollbar->elements_in_view;
int current_y = t->current_point.y - ((t->current_point.y - (scrollbar->y + 8 * scrollbar->has_y_margin)) % element_height);
int start_y = t->start_point.y - ((t->start_point.y - (scrollbar->y + 8 * scrollbar->has_y_margin)) % element_height);
int touch_scrolled = (current_y - start_y) / element_height;
scrollbar->scroll_position = calc_bound(scrollbar->position_on_touch - touch_scrolled, 0, scrollbar->max_scroll_position);
active = 1;
}
if (t->has_ended) {
scrollbar->touch_drag_state = TOUCH_DRAG_NONE;
// decay scrollbar movement
}
if (scrollbar->on_scroll_callback && old_position != scrollbar->scroll_position) {
scrollbar->on_scroll_callback();
}
return active;
}

static int handle_scrollbar_dot(scrollbar_type *scrollbar, const mouse *m)
{
if (scrollbar->max_scroll_position <= 0 || !m->left.is_down) {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/augustus.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ static int pre_init(const char *custom_data_dir)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
"Error",
"Augustus requires the original files from Caesar 3.\n\n"
"Please insert the proper directory or copy the files to the selected directory.",
"Please enter the proper directory or copy the files to the selected directory.",
NULL);
return 0;
}
Expand Down

0 comments on commit 5b7491c

Please sign in to comment.