| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #ifndef MOVIE_H_ |
| 20 | #define MOVIE_H_ |
| 21 | |
| 22 | #include <cstdint> |
| 23 | #include <filesystem> |
| 24 | |
| 25 | #include "application.h" |
| 26 | #include "renderer.h" |
| 27 | |
| 28 | #define MVELIB_NOERROR 0 |
| 29 | #define MVELIB_FILE_ERROR (-1) |
| 30 | #define MVELIB_NOTINIT_ERROR (-2) |
| 31 | #define MVELIB_DDGR_ERROR (-3) |
| 32 | #define MVELIB_INIT_ERROR (-4) |
| 33 | #define MVELIB_PLAYBACK_ERROR (-5) |
| 34 | #define MVELIB_PLAYBACK_ABORTED (-6) |
| 35 | |
| 36 | int mve_Init(const char *dir, const char *sndcard); |
| 37 | |
| 38 | // simply plays a movie. |
| 39 | int mve_PlayMovie(const std::filesystem::path &pMovieName, oeApplication *pApp); |
| 40 | |
| 41 | // used to copy movie data to a pointer, looping will loop, fhandle will be a pointer to a file handle to be returned |
| 42 | // handle to movie sequence is returned by function. |
| 43 | intptr_t mve_SequenceStart(const char *mvename, void *fhandle, oeApplication *app, bool looping = false); |
| 44 | |
| 45 | // frames movies started with SequenceStart. Optionally, pass a pointer to a variable which will receive |
| 46 | // bitmap handle containing data, nx and ny will contain adjusted x and y coordinates if needed. |
| 47 | // passing -1 to x and y centers the frame on that axis |
| 48 | // handle is the movie handle returned by mve_Sequence start |
| 49 | // returned value is the handle passed into mve_SequenceFrame or new one if movie looped. |
| 50 | intptr_t mve_SequenceFrame(intptr_t handle, void *fhandle, bool sequence, int *bm_handle); |
| 51 | |
| 52 | bool mve_SequenceClose(intptr_t handle, void *fhandle); |
| 53 | |
| 54 | // sets render frame boundaries. |
| 55 | void mve_SetRenderProperties(int16_t x, int16_t y, int16_t w, int16_t h, renderer_type type, bool hicolor); |
| 56 | |
| 57 | // called every frame. |
| 58 | typedef void (*MovieFrameCallback_fp)(int x, int y, int movieFrameNum); |
| 59 | void mve_SetCallback(MovieFrameCallback_fp callBack); |
| 60 | |
| 61 | // call to print out text. |
| 62 | void mve_Puts(int16_t x, int16_t y, ddgr_color col, const char *txt); |
| 63 | |
| 64 | void mve_ClearRect(int16_t x1, int16_t y1, int16_t x2, int16_t y2); |
| 65 | |
| 66 | #endif |