Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install meson ninja-build libsdl2-dev
sudo apt-get install meson ninja-build libsdl3-dev

- name: Install ThorVG
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install meson ninja-build libsdl2-dev
sudo apt-get install meson ninja-build libsdl3-dev

- name: Install ThorVG
run: |
Expand Down
37 changes: 17 additions & 20 deletions src/Example.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
#include <iostream>
#include <cstring>
#include <chrono>
#include <thorvg-1/thorvg.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
#include <thorvg.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be changed.

#include <SDL3/SDL.h>
#ifdef _WIN32
#include <windows.h>
#ifndef PATH_MAX
Expand Down Expand Up @@ -251,35 +250,33 @@ struct Window
//SDL Event handling
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT: {
case SDL_EVENT_QUIT: {
running = false;
break;
}
case SDL_KEYUP: {
if (event.key.keysym.sym == SDLK_ESCAPE) {
case SDL_EVENT_KEY_UP: {
if (event.key.key == SDLK_ESCAPE) {
running = false;
}
break;
}
case SDL_MOUSEBUTTONDOWN: {
case SDL_EVENT_MOUSE_BUTTON_DOWN: {
needDraw |= example->clickdown(canvas, event.button.x, event.button.y);
break;
}
case SDL_MOUSEBUTTONUP: {
case SDL_EVENT_MOUSE_BUTTON_UP: {
needDraw |= example->clickup(canvas, event.button.x, event.button.y);
break;
}
case SDL_MOUSEMOTION: {
case SDL_EVENT_MOUSE_MOTION: {
needDraw |= example->motion(canvas, event.button.x, event.button.y);
break;
}
case SDL_WINDOWEVENT: {
if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
width = event.window.data1;
height = event.window.data2;
needResize = true;
needDraw = true;
}
case SDL_EVENT_WINDOW_RESIZED: {
width = event.window.data1;
height = event.window.data2;
needResize = true;
needDraw = true;
}
}
}
Expand Down Expand Up @@ -322,7 +319,7 @@ struct SwWindow : Window
{
if (!initialized) return;

window = SDL_CreateWindow("ThorVG Example (Software)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
window = SDL_CreateWindow("ThorVG Example (Software)", width, height, SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);

//Create a Canvas. Use Smart Rendering by default.
canvas = tvg::SwCanvas::gen();
Expand Down Expand Up @@ -371,7 +368,7 @@ struct GlWindow : Window
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
#endif
window = SDL_CreateWindow("ThorVG Example (OpenGL/ES)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
window = SDL_CreateWindow("ThorVG Example (OpenGL/ES)", width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
context = SDL_GL_CreateContext(window);

//Create a Canvas
Expand All @@ -390,7 +387,7 @@ struct GlWindow : Window
delete(canvas);
canvas = nullptr;

SDL_GL_DeleteContext(context);
SDL_GL_DestroyContext(context);
}

void resize() override
Expand Down Expand Up @@ -423,7 +420,7 @@ struct WgWindow : Window
{
if (!initialized) return;

window = SDL_CreateWindow("ThorVG Example (WebGPU)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, SDL_WINDOW_HIDDEN);
window = SDL_CreateWindow("ThorVG Example (WebGPU)", width, height, SDL_WINDOW_HIDDEN);

//Here we create our WebGPU surface from the window!
SDL_SysWMinfo windowWMInfo;
Expand Down
4 changes: 2 additions & 2 deletions src/LottieExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* SOFTWARE.
*/

#include <thorvg-1/thorvg_lottie.h>
#include <thorvg_lottie.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't be changed

#include "Example.h"

/************************************************************************/
Expand Down Expand Up @@ -318,4 +318,4 @@ struct UserExample : tvgexam::Example
int main(int argc, char **argv)
{
return tvgexam::main(new UserExample, argc, argv, false, 1024, 1024, 0 /* turn off for expressions */);
}
}
4 changes: 2 additions & 2 deletions src/LottieInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

#include <thorvg-1/thorvg_lottie.h>
#include <thorvg_lottie.h>
#include <math.h>
#include "Example.h"

Expand Down Expand Up @@ -174,4 +174,4 @@ struct UserExample : tvgexam::Example
int main(int argc, char **argv)
{
return tvgexam::main(new UserExample, argc, argv, true, 1024, 1024, 0);
}
}
4 changes: 2 additions & 2 deletions src/LottieTweening.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* SOFTWARE.
*/

#include <thorvg-1/thorvg_lottie.h>
#include <thorvg_lottie.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not change

#include "Example.h"

/************************************************************************/
Expand Down Expand Up @@ -197,4 +197,4 @@ struct UserExample : tvgexam::Example
int main(int argc, char **argv)
{
return tvgexam::main(new UserExample, argc, argv, false, 1024, 1024);
}
}
11 changes: 6 additions & 5 deletions src/MultiCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ void mainloop()
//SDL Event handling
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT: {
case SDL_EVENT_QUIT: {
running = false;
break;
}
case SDL_KEYUP: {
if (event.key.keysym.sym == SDLK_ESCAPE) {
case SDL_EVENT_KEY_UP: {

if (event.key.key == SDLK_ESCAPE) {
running = false;
}
break;
Expand All @@ -88,7 +89,7 @@ void mainloop()

void runSw()
{
auto window = SDL_CreateWindow("ThorVG Example (Software)", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_HIDDEN);
auto window = SDL_CreateWindow("ThorVG Example (Software)", WIDTH, HEIGHT, SDL_WINDOW_HIDDEN);
auto surface = SDL_GetWindowSurface(window);

for (int counter = 0; counter < NUM_PER_LINE * NUM_PER_LINE; ++counter) {
Expand Down Expand Up @@ -416,4 +417,4 @@ int main(int argc, char **argv)
}

return 0;
}
}
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cc = meson.get_compiler('cpp')
thorvg_dep = dependency('thorvg-1', required: true)
examples_dep = [thorvg_dep, dependency('sdl2', required: true)]
compiler_flags = ['-DSDL_MAIN_HANDLED']
examples_dep = [thorvg_dep, dependency('sdl3', required: true)]
compiler_flags = []

# GL or GLES
gl_dep = dependency('gl', required: false)
Expand Down
Loading