Skip to content

Commit

Permalink
win32 exe (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
helynranta authored Nov 7, 2022
1 parent 58ca91b commit 63f7a99
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
env:
GITHUB_AUTHORIZATION_TOKEN: '${{ secrets.PAT }}'
run: |
cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -D CMAKE_WIN32_EXECUTABLE=True
- name: cmake build
run: cmake --build build
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ engine_create_launcher(
PROJECT_FILE "${CMAKE_SOURCE_DIR}/flappykarp.project"
)

target_link_libraries(launcher PUBLIC SDL2::SDL2main)

target_precompile_headers(${PROJECT_NAME} PUBLIC src/engine.hxx)

# install
Expand Down
25 changes: 21 additions & 4 deletions src/scenes/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace lerppana::flappykarp::scenes
static auto is_active = false;

ImGui::GroupScope text_group;
if (m_draw_button("Flap!", 70.f, is_active))
if (m_draw_button("Splash!", 70.f, is_active))
{
audio_manager->play_clip("fs1://audio/Minimalist2.wav");
reset();
Expand Down Expand Up @@ -63,6 +63,22 @@ namespace lerppana::flappykarp::scenes
}
}

void game::draw_hint_text()
{
auto* font = font_manager->get_font("honeyblot");
ImGui::FontScope font_scope{font};
ImGui::SetWindowFontScale(0.4f);

static auto width = 100.0f;
ImGui::SetCursorPos(ImVec2(ImGui::GetWindowWidth() / 2 - width / 2,ImGui::GetWindowHeight() - 50.f));

ImGui::GroupScope text_group;

auto text_fadeout = 5.0f;
auto alpha = glm::clamp((text_fadeout - score) / text_fadeout, 0.0f, 1.0f);
ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, alpha), "tap SPACE to splash!");
width = ImGui::GetItemRectSize().x;
}
void game::fixed_update(core::dt_t dt)
{
m_detect_player_hits();
Expand Down Expand Up @@ -110,6 +126,7 @@ namespace lerppana::flappykarp::scenes
m_gui_draw_score();
draw_start_button();
draw_exit_button();
draw_hint_text();
}

void game::update(core::dt_t dt)
Expand Down Expand Up @@ -160,7 +177,7 @@ namespace lerppana::flappykarp::scenes
ImGui::FontScope font_scope{font};
ImGui::SetWindowFontScale(font_size);

static auto button_width = 100.0f;
static auto button_width = 280.0f;

const auto font_height = ImGui::GetFontSize();

Expand All @@ -173,7 +190,7 @@ namespace lerppana::flappykarp::scenes

ImGui::GetWindowDrawList()->AddRectFilled(
ImVec2(window_pos.x + x, window_pos.y + y + 10.f),
ImVec2(window_pos.x + x + 250.f, window_pos.y + y + 110.f),
ImVec2(window_pos.x + x + button_width, window_pos.y + y + 110.f),
ImGui::ColorConvertFloat4ToU32(ImVec4(.2f, .2f, .2f, 1.f)),
0.f);

Expand All @@ -189,7 +206,7 @@ namespace lerppana::flappykarp::scenes
ImGui::StyleColorScope button_hovered(ImGuiCol_ButtonHovered, ImVec4(0.5f, 0.7f, 0.9f, 1.0f));

ImGui::SetCursorPos(ImVec2(x,y));
auto is_clicked = ImGui::Button(button_text.data(), ImVec2(250.f, 100.f));
auto is_clicked = ImGui::Button(button_text.data(), ImVec2(button_width, 100.f));

button_width = ImGui::GetItemRectSize().x;

Expand Down
2 changes: 2 additions & 0 deletions src/scenes/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace lerppana::flappykarp::scenes

void draw_exit_button();

void draw_hint_text();

void draw_start_button();

void fixed_update(core::dt_t dt) final;
Expand Down
4 changes: 2 additions & 2 deletions vcpkg-registry/ports/reload-engine/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO lerppana/reload-engine
REF 95ace1a2f796a783a05ca4fc567d9794297fe451
SHA512 9fdb18f05d4aa8cdc50f5a54b9f427f725ffd22e6c65bcbb459bb89a6f3d3b408d546d2433e56b84dabdbd1bc95c227e49f4e9bb5ee16199f871dec323d45789
REF f78afb895b5a6d8f9541a185184b7aec8f05806e
SHA512 f78ba98265c5c623ba2017f7fa815c21636e9aea9bf80bef6ae049bbe62895a4f69a4658c9f698eca21cc4d679976f8809d10aed299ecaf448584dc9138e0c67
HEAD_REF master
AUTHORIZATION_TOKEN $ENV{GITHUB_AUTHORIZATION_TOKEN}
)
Expand Down

0 comments on commit 63f7a99

Please sign in to comment.