Skip to content

Commit

Permalink
Merge pull request #134 from konopka90/celview
Browse files Browse the repository at this point in the history
Celview
  • Loading branch information
wheybags committed Jul 11, 2015
2 parents cf3c5fe + 4b087d4 commit cb76993
Show file tree
Hide file tree
Showing 16 changed files with 956 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ before_install:
- echo yes | sudo apt-add-repository ppa:ubuntu-sdk-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq libboost1.54-all-dev libsdl2-dev libsdl2-image-dev libsdl-ttf2.0-dev zlib1g-dev
libbz2-dev doxygen libfreetype6-dev libpython2.7 libsdl2-mixer-dev cmake qtdeclarative5-dev
libbz2-dev doxygen libfreetype6-dev libpython2.7 libsdl2-mixer-dev cmake qtdeclarative5-dev libpng12-dev zlib1g-dev
- wget http://wheybags.netsoc.ie/pkg/librocket_1.3-1_amd64.deb
- sudo dpkg -i librocket_1.3-1_amd64.deb
- wget http://wheybags.netsoc.ie/pkg/librocket-dev_1.3-1_amd64.deb
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ endif()
Find_Package(SDL2 REQUIRED)
Find_Package(SDL2_image REQUIRED)
Find_Package(SDL2_mixer REQUIRED)
Find_Package(ZLIB REQUIRED)
find_package(PNG REQUIRED)
Find_Package(OpenGL REQUIRED)

Find_Package(PythonLibs 2 REQUIRED)
Expand Down Expand Up @@ -56,6 +58,7 @@ include_directories (
${SDL2IMAGE_INCLUDE_DIR}
${SDL2MIXER_INCLUDE_DIR}
${OPENGL_INCLUDE_DIRS}
${PNG_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
${PYTHON_INCLUDE_DIR}
${ROCKET_INCLUDE_DIR}
Expand All @@ -80,6 +83,7 @@ link_libraries (
${SDL2_LIBRARY}
${SDL2IMAGE_LIBRARY}
${SDL2MIXER_LIBRARY}
${PNG_LIBRARY}
${OPENGL_LIBRARIES}
${ROCKET_LIBRARIES}
${PYTHON_LIBRARIES}
Expand Down
26 changes: 25 additions & 1 deletion apps/celview/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,26 @@
add_executable(celview main.cpp)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

qt5_wrap_ui(UI_HEADERS ../../resources/ui/celview.ui)

include_directories (
${SDL2_INCLUDE_DIR})

link_libraries (
StormLib
${SDL2_LIBRARY})

add_executable(celview

../../resources/ui/celview.ui
main.cpp
mainwindow.h
mainwindow.cpp
)

set_target_properties(celview PROPERTIES COMPILE_FLAGS "${FA_COMPILER_FLAGS}")

if(UNIX) # qt headers generate a bunch of warnings, just ignore em
set_target_properties(StormLib PROPERTIES COMPILE_FLAGS "-w")
endif()

60 changes: 7 additions & 53 deletions apps/celview/main.cpp
Original file line number Diff line number Diff line change
@@ -1,57 +1,11 @@
#include <iostream>
#include "mainwindow.h"
#include <QApplication>

#include <faio/faio.h>
#include <render/render.h>
#include <input/inputmanager.h>

bool done = false;
size_t celIndex = 0;
size_t max;
void keyPress(Input::Key key)
{
switch(key)
{
case Input::KEY_UP:
if(celIndex < max-1)
celIndex++;
break;
case Input::KEY_DOWN:
if(celIndex > 0)
celIndex--;
break;
case Input::KEY_q:
done = true;
break;
default:
break;
}

std::cout << "frame " << celIndex+1 << "/" << max << std::endl;
}

int main(int, char** argv)
int main(int argc, char *argv[])
{
FAIO::init();
Render::RenderSettings settings;
settings.windowWidth = 1280;
settings.windowHeight = 960;
Render::init(settings);

Input::InputManager input(&keyPress, NULL, NULL, NULL, NULL, NULL);

Render::SpriteGroup cel(argv[1]);
max = cel.size();

while(!done)
{
input.poll();
input.processInput(false);

Render::clear();
Render::drawAt(cel[celIndex], 0, 0);
Render::draw();
}
QApplication a(argc, argv);
MainWindow w;
w.show();

FAIO::quit();
return 0;
return a.exec();
}
Loading

0 comments on commit cb76993

Please sign in to comment.