eff04b5ec2
There is still a large amount of views code that could be trimmed down, but which is used to implement samples (in viewer). Seemed simpler to remove some of this code in pieces. Bug: skia: Change-Id: Ia3415060d03c8de604a154e3dc38379b754daab6 Reviewed-on: https://skia-review.googlesource.com/72801 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
/*
|
|
* Copyright 2016 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "SkTypes.h"
|
|
#include "SkTHash.h"
|
|
#include "SDL.h"
|
|
#include "Timer.h"
|
|
#include "Window_mac.h"
|
|
#include "../Application.h"
|
|
|
|
using sk_app::Application;
|
|
|
|
int main(int argc, char* argv[]) {
|
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0) {
|
|
SkDebugf("Could not initialize SDL!\n");
|
|
return 1;
|
|
}
|
|
|
|
Application* app = Application::Create(argc, argv, nullptr);
|
|
|
|
SDL_Event event;
|
|
bool done = false;
|
|
while (!done) {
|
|
while (SDL_PollEvent(&event)) {
|
|
switch (event.type) {
|
|
// events handled by the windows
|
|
case SDL_WINDOWEVENT:
|
|
case SDL_MOUSEMOTION:
|
|
case SDL_MOUSEBUTTONDOWN:
|
|
case SDL_MOUSEBUTTONUP:
|
|
case SDL_MOUSEWHEEL:
|
|
case SDL_KEYDOWN:
|
|
case SDL_KEYUP:
|
|
case SDL_TEXTINPUT:
|
|
done = sk_app::Window_mac::HandleWindowEvent(event);
|
|
break;
|
|
|
|
case SDL_QUIT:
|
|
done = true;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
app->onIdle();
|
|
}
|
|
delete app;
|
|
|
|
SDL_Quit();
|
|
|
|
return 0;
|
|
}
|