3cd9e77889
* Initial linux support using SDL * fixed link error and gitignore * fix in working directory initialization (windows side) * Added README_Linux and fixed a few compilation issues in ubuntu * Rename main to main_Windows in Tests * Better default renderering backend selector * Added backlog terminal output on linux * added asserts on all missing vulkan function call results * added portable file dialogs also small tests update and cleanup * Added Editor compile target * linux ci * linux ci * cmake update * cmake update? * cmake * Editor_Windows fix * build test * make * build tools? * update * ubuntu 20.04 * fix? * cmake * build * build? * package linux build * updates, bump version * backslash to forward slash, eof newlines, add portable-file-dialogs license * xcopy needs backslash duh; update readme; * copy fix * updated readme * readme update * updated readme * updated readme * fix incorrect file encoding linux * paint tool fix * linux: add missing shaders * packaging update Co-authored-by: Turánszki János <turanszkij@users.noreply.github.com> Co-authored-by: Turanszki Janos <turanszkij@gmail.com>
74 lines
1.6 KiB
C++
74 lines
1.6 KiB
C++
#include "stdafx.h"
|
|
#include "Editor.h"
|
|
|
|
#include <fstream>
|
|
|
|
#include "stdafx.h"
|
|
#include <SDL2/SDL.h>
|
|
#include "sdl2.h"
|
|
|
|
int sdl_loop(Editor &editor)
|
|
{
|
|
SDL_Event event;
|
|
|
|
bool quit = false;
|
|
while (!quit)
|
|
{
|
|
SDL_PumpEvents();
|
|
editor.Run();
|
|
|
|
int ret = SDL_PollEvent(&event);
|
|
|
|
if (ret < 0) {
|
|
std::cerr << "Error Peeping event: " << SDL_GetError() << std::endl;
|
|
std::cerr << "Exiting now" << std::endl;
|
|
return -1;
|
|
}
|
|
|
|
if (ret > 0) {
|
|
if (event.type == SDL_WINDOWEVENT) {
|
|
switch (event.window.event) {
|
|
case SDL_WINDOWEVENT_CLOSE: // exit game
|
|
//editor.Quit();
|
|
quit = true;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
Editor editor;
|
|
|
|
wiStartupArguments::Parse(argc, argv);
|
|
|
|
sdl2::sdlsystem_ptr_t system = sdl2::make_sdlsystem(SDL_INIT_EVERYTHING | SDL_INIT_EVENTS);
|
|
if (!system) {
|
|
throw sdl2::SDLError("Error creating SDL2 system");
|
|
}
|
|
|
|
//TODO read config.ini
|
|
sdl2::window_ptr_t window = sdl2::make_window(
|
|
"Wicked Engine Editor",
|
|
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
|
1920, 1080,
|
|
SDL_WINDOW_SHOWN | SDL_WINDOW_VULKAN);
|
|
if (!window) {
|
|
throw sdl2::SDLError("Error creating window");
|
|
}
|
|
|
|
editor.SetWindow(window.get());
|
|
|
|
int ret = sdl_loop(editor);
|
|
|
|
SDL_Quit();
|
|
return ret;
|
|
}
|