Skip to content

Commit

Permalink
Add some more sprites to S14X. Fiddle with the parallax
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazade committed Jun 17, 2012
1 parent b359041 commit 49c4345
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -8,6 +8,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/")
FIND_PACKAGE(KGLT REQUIRED)
FIND_PACKAGE(KAZMATH REQUIRED)
FIND_PACKAGE(Boost COMPONENTS system filesystem thread date_time regex REQUIRED)
FIND_PACKAGE(Freetype REQUIRED)

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(SIGC QUIET sigc++-2.0)
Expand All @@ -24,6 +25,7 @@ INCLUDE_DIRECTORIES(
${SDL_INCLUDE_DIRS}
${GL_INCLUDE_DIRS}
${GLU_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
)

LINK_LIBRARIES(
Expand All @@ -41,6 +43,7 @@ LINK_LIBRARIES(
${GLU_LIBRARIES}

${SIGC_LIBRARIES}
${FREETYPE_LIBRARY}
)

ADD_SUBDIRECTORY(k4x)
Expand Down
19 changes: 19 additions & 0 deletions k4x/chapters/splash_chapter.h
@@ -0,0 +1,19 @@
#ifndef SPLASH_CHAPTER_H
#define SPLASH_CHAPTER_H

#include "chapter.h"

namespace k4x {

class SplashChapter : Chapter {
public:
SplashChapter();

static SplashChapter::ptr create() {
return SplashChapter::ptr(new SplashChapter());
}
};

}

#endif // SPLASH_CHAPTER_H
26 changes: 16 additions & 10 deletions k4x/chapters/title_chapter.cpp
Expand Up @@ -2,6 +2,7 @@
#include "../engine.h"
#include "../chapter_manager.h"

#include "kglt/ui/shortcuts.h"
#include "kglt/kazbase/logging/logging.h"

namespace k4x {
Expand All @@ -28,12 +29,15 @@ void TitleChapter::add_sprite(const std::string& sprite_image, SpritePosition po
}
}

void TitleChapter::set_background_image(const std::string& background_image) {
background_image_path_ = background_image;
void TitleChapter::add_background_image(const std::string& background_image) {
L_DEBUG("Loading background image from: " + background_image);
kglt::Scene& scene = manager().engine().window().scene();
scene.background().add_layer(background_image);
L_DEBUG("Background loaded");
}

void TitleChapter::enable_background_scrolling(bool value) {
if(background_image_path_.empty()) return;
//if(background_image_path_.empty()) return;

background_scrolling_enabled_ = value;
if(!value && scroll_connection_) {
Expand All @@ -49,13 +53,13 @@ void TitleChapter::on_prepare_start() {
kglt::Window& window = manager().engine().window();
kglt::Scene& scene = window.scene();

if(!background_image_path_.empty()) {
L_DEBUG("Loading background image from: " + background_image_path_);
scene.background().add_layer(background_image_path_);
L_DEBUG("Background loaded");
}
kglt::ui::Label& label = kglt::ui::return_new_label(scene);
label.set_position(0.75, 0.025);
label.background().set_visible(false);
label.border().set_visible(false);
label.set_text(u8"\u00a9 SEGA 1991");

/*
/*
if(!title_music_path_.empty()) {
kalt::System& system = manager().engine().sound();
title_music_ = system.new_track();
Expand Down Expand Up @@ -96,7 +100,9 @@ bool TitleChapter::scroll_background() {
return false;
}

window.scene().background().layer(0).scroll_x(0.1 * window.delta_time());
window.scene().background().layer(0).scroll_x(0.05 * window.delta_time());
window.scene().background().layer(1).scroll_x(0.06 * window.delta_time());
window.scene().background().layer(2).scroll_x(0.07 * window.delta_time());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion k4x/chapters/title_chapter.h
Expand Up @@ -26,7 +26,7 @@ class TitleChapter : public Chapter {
}

void add_demo(const std::string& demo_video);
void set_background_image(const std::string& background_image);
void add_background_image(const std::string& background_image);
void add_sprite(const std::string& sprite, SpritePosition position);

void enable_background_scrolling(bool value=true);
Expand Down
1 change: 1 addition & 0 deletions s14x.files
Expand Up @@ -20,3 +20,4 @@ s14x/CMakeLists.txt
s14x/main.cpp
k4x/chapters/boot_chapter.h
k4x/chapters/boot_chapter.cpp
k4x/chapters/splash_chapter.h
9 changes: 8 additions & 1 deletion s14x/main.cpp
Expand Up @@ -15,8 +15,15 @@ int main(int argc, char* argv[]) {

k4x::Engine engine(argc, argv);

kglt::FontID fid = engine.window().scene().new_font();
kglt::Font& f = engine.window().scene().font(fid);
f.initialize("s14x/resources/centbold.ttf", 12);
engine.window().scene().ui().set_default_font_id(fid);

engine.window().set_title("Sonic 1 4X");
engine.title().set_background_image("s14x/resources/title/background.png"); //Give the title screen a background
engine.title().add_background_image("s14x/resources/title/background_0.png"); //Give the title screen a background
engine.title().add_background_image("s14x/resources/title/background_1.png");
engine.title().add_background_image("s14x/resources/title/background_2.png");
engine.title().add_sprite("s14x/resources/title/halo.png", k4x::SPRITE_POSITION_CENTRED);

/*
Expand Down
Binary file added s14x/resources/centbold.ttf
Binary file not shown.
Binary file added s14x/resources/splash/logo_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_13.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_15.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_17.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_18.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_19.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_20.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_21.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_22.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_23.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_24.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/splash/logo_9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added s14x/resources/title/background_0.png
Binary file added s14x/resources/title/background_1.png
Binary file added s14x/resources/title/background_2.png

0 comments on commit 49c4345

Please sign in to comment.