-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from konopka90/celview
Celview
- Loading branch information
Showing
16 changed files
with
956 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
Oops, something went wrong.