diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 5458714e..00000000 --- a/INSTALL +++ /dev/null @@ -1,234 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/NEWS b/NEWS new file mode 100644 index 00000000..91b70494 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +See http://www.milkytracker.org/ for latest news and updates. diff --git a/README b/README deleted file mode 100644 index fa8ab9d5..00000000 --- a/README +++ /dev/null @@ -1,25 +0,0 @@ -Notes on building MilkyTracker for Amiga68k -============================== - -./build_gmake to make the makefiles - -Configuration -============= -To compile with ixemul.library in mind run: -make config=ixemul_m68k-amigaos - -To compile with libnix just run: -make - -Dependencies -============ - -To build MilkyTracker you will need the following development libraries: - -SDL - http://aminet.net/package/dev/misc/SDL-Amiga -libz - http://aminet.net/package/dev/lib/zlib_68k -libjpeg - http://aminet.net/package/dev/lib/libjpeg9_a68k - -Note to package maintainers: MilkyTracker contains an internal copy of -libzzip that has been modified for use with MilkyTracker; An externally -linked libzzip will not work correctly (ZIP support will be broken). diff --git a/build_gmake b/build_gmake deleted file mode 100755 index 0be7ee36..00000000 --- a/build_gmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -premake4 gmake - diff --git a/clean b/clean deleted file mode 100755 index 7656dd38..00000000 --- a/clean +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -premake4 clean diff --git a/config.h b/config.h deleted file mode 100644 index 30bdc663..00000000 --- a/config.h +++ /dev/null @@ -1,284 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if the `closedir' function returns void instead of `int'. */ -#define CLOSEDIR_VOID 1 - -/* Define to 1 if you have the `atexit' function. */ -#define HAVE_ATEXIT 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `floor' function. */ -/* #undef HAVE_FLOOR */ - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -/* #undef HAVE_FSEEKO */ - -/* Define to 1 if you have the `getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define to 1 if you have the `getpagesize' function. */ -/* #undef HAVE_GETPAGESIZE */ - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_INTTYPES_H */ - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_JACK_JACK_H */ - -/* Define to 1 if you have the `asound' library (-lasound). */ -/* #undef HAVE_LIBASOUND */ - -/* Define to 1 if you have the 'libz' library. */ -#define HAVE_LIBZ 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_LIMITS_H 1 - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ - -/* Define to 1 if you have the header file. */ -#define HAVE_MALLOC_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if you have a working `mmap' system call. */ -/* #undef HAVE_MMAP */ - -/* Define to 1 if you have the `munmap' function. */ -/* #undef HAVE_MUNMAP */ - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -/* #undef HAVE_NDIR_H */ - -/* Define to 1 if you have the `pow' function. */ -/* #undef HAVE_POW */ - -/* Define to 1 if the system has the type `ptrdiff_t'. */ -#define HAVE_PTRDIFF_T 1 - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ - -/* Define to 1 if you have the `select' function. */ -/* #undef HAVE_SELECT */ - -/* Define to 1 if you have the `sqrt' function. */ -/* #undef HAVE_SQRT */ - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#define HAVE_STAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strcasecmp' function. */ -#define HAVE_STRCASECMP 1 - -/* Define to 1 if you have the `strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#define HAVE_STRERROR 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strrchr' function. */ -#define HAVE_STRRCHR 1 - -/* Define to 1 if `st_blocks' is member of `struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLOCKS 1 - -/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use - `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#define HAVE_ST_BLOCKS 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SELECT_H */ - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* SDL supports X11 features */ -/* #undef HAVE_X11 */ - -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ - -/* Name of package */ -#define PACKAGE "milkytracker" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "www.milkytracker.net" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "MilkyTracker" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "MilkyTracker 0.90.86" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "milkytracker" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "0.90.86" - -/* Define to the type of arg 1 for `select'. */ -#define SELECT_TYPE_ARG1 int - -/* Define to the type of args 2, 3 and 4 for `select'. */ -#define SELECT_TYPE_ARG234 (fd_set *) - -/* Define to the type of arg 5 for `select'. */ -#define SELECT_TYPE_ARG5 (struct timeval *) - -/* Define to 1 if the `S_IS*' macros in do not work properly. */ -/* #undef STAT_MACROS_BROKEN */ - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define to 1 if your declares `struct tm'. */ -/* #undef TM_IN_SYS_TIME */ - -/* Version number of package */ -#define VERSION "0.90.86" - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -/* #undef _LARGEFILE_SOURCE */ - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef was allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT32_T */ - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef was allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT64_T */ - -/* Define for Solaris 2.5.1 so the uint8_t typedef from , - , or is not used. If the typedef was allowed, the - #define below would cause a syntax error. */ -/* #undef _UINT8_T */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to the type of a signed integer type of width exactly 16 bits if - such a type exists and the standard includes do not define it. */ -/* #undef int16_t */ - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef int32_t */ - -/* Define to the type of a signed integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef int64_t */ - -/* Define to the type of a signed integer type of width exactly 8 bits if such - a type exists and the standard includes do not define it. */ -/* #undef int8_t */ - -/* Define to rpl_malloc if the replacement function should be used. */ -//#undef malloc - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to rpl_realloc if the replacement function should be used. */ -//#undef realloc - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ - -/* Define to the type of an unsigned integer type of width exactly 16 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint16_t */ - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint32_t */ - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint64_t */ - -/* Define to the type of an unsigned integer type of width exactly 8 bits if - such a type exists and the standard includes do not define it. */ -/* #undef uint8_t */ - -/* Define to empty if the keyword `volatile' does not work. Warning: valid - code using `volatile' can become incorrect without. Disable with care. */ -/* #undef volatile */ diff --git a/confup b/confup deleted file mode 100755 index 7057654a..00000000 --- a/confup +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -SDL_CONFIG=/opt/m68k-amigaos/bin/sdl-config CPPFLAGS="-g -D__AMIGA__ -fpermissive -noixemul -m68020 -I/opt/m68k-amigaos/include/SDL -I/opt/m68k-amigaos/include -L/opt/m68k-amigaos/lib -L/opt/m68k-amigaos/m68k-amigaos/lib -fomit-frame-pointer -lSDL -ldebug -ljpeg -lSDLstub -lSDL_image -Xlinker --allow-multiple-definition" CXXFLAGS="-g -D__AMIGA__ -fpermissive -noixemul -m68020 -I/opt/m68k-amigaos/include/SDL -I/opt/m68k-amigaos/include -L/opt/m68k-amigaos/lib -L/opt/m68k-amigaos/m68k-amigaos/lib -fomit-frame-pointer -lSDL -ldebug -ljpeg -lSDLstub -lSDL_image -Xlinker --allow-multiple-definition" CFLAGS="-g -D__AMIGA__ -fpermissive -noixemul -m68020 -I/opt/m68k-amigaos/include/SDL -I/opt/m68k-amigaos/include -L/opt/m68k-amigaos/lib -L/opt/m68k-amigaos/m68k-amigaos/lib -fomit-frame-pointer -lSDL -ldebug -ljpeg -lSDLstub -lSDL_image -Xlinker --allow-multiple-definition" ./configure --build x86_64 --host m68k-amigaos diff --git a/premake4 b/premake4 deleted file mode 100755 index b37b27f4..00000000 Binary files a/premake4 and /dev/null differ diff --git a/premake4.exe b/premake4.exe deleted file mode 100644 index b4230f19..00000000 Binary files a/premake4.exe and /dev/null differ diff --git a/premake4.lua b/premake4.lua deleted file mode 100644 index 2bc952fb..00000000 --- a/premake4.lua +++ /dev/null @@ -1,368 +0,0 @@ -function os.capture(cmd, raw) - local f = assert(io.popen(cmd, 'r')) - local s = assert(f:read('*a')) - f:close() - if raw then return s end - s = string.gsub(s, '^%s+', '') - s = string.gsub(s, '%s+$', '') - s = string.gsub(s, '[\n\r]+', ' ') - return s -end - -function newplatform(plf) - local name = plf.name - local description = plf.description - - -- Register new platform - premake.platforms[name] = { - cfgsuffix = "_"..name, - iscrosscompiler = true - } - - -- Allow use of new platform in --platfroms - table.insert(premake.option.list["platform"].allowed, { name, description }) - table.insert(premake.fields.platforms.allowed, name) - - -- Add compiler support - premake.gcc.platforms[name] = plf.gcc -end - -function newgcctoolchain(toolchain) - newplatform { - name = toolchain.name, - description = toolchain.description, - gcc = { - cc = toolchain.prefix .. "gcc", - cxx = toolchain.prefix .. "g++", - ar = toolchain.prefix .. "ar", - ld = toolchain.prefix .. "ld", - cppflags = " " .. toolchain.cppflags - } - } -end - -newgcctoolchain { - name = "m68k-amigaos", - description = "m68k-amigaos to cross-compile amiga.68k binaries from linux", - prefix = "m68k-amigaos-", - cppflags = "-m68040 -mhard-float -O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -s -noixemul -I/opt/m68k-amigaos/m68k-amigaos/sys-include -I/opt/m68k-amigaos/include -I/opt/m68k-amigaos/include/SDL ", - ldflags = "-L/opt/m68k-amigaos/lib -L/opt/m68k-amigaos/m68k-amigaos/lib -L/opt/m68k-amigaos/m68k-amigaos/libnix/lib/libnix -noixemul -ldebug -Xlinker --allow-multiple-definition" -} - -newgcctoolchain { - name = "ppc-amigaos", - description = "ppc-amigaos to cross-compile amiga.ppc binaries from linux", - prefix = "ppc-amigaos-", - cppflags = "-O3 -mcrt=newlib -fomit-frame-pointer -fno-exceptions -I/opt/ppc-amigaos/ppc-amigaos/sys-include -I/opt/ppc-amigaos/include -I/opt/ppc-amigaos/include/SDL ", - ldflags = "-mcrt=newlib -L/opt/ppc-amigaos/lib -L/opt/ppc-amigaos/ppc-amigaos/lib -lauto -lunix" -} - -newgcctoolchain { - name = "x86_64-aros", - description = "x86_64-aros to cross-compile aros.x86_64 binaries from linux", - prefix = "x86_64-aros-", - cppflags = "", - ldflags = "" -} - -newgcctoolchain { - name = "ppc-macos", - description = "", - prefix = "powerpc-apple-macos-", - cppflags = "-fomit-frame-pointer -fno-exceptions -I/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/include -I/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/RIncludes -I/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/include/SDL -I../include/mac", - ldflags = "-L/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/lib" -} - -if _OPTIONS.platform then - -- overwrite the native platform with the options::platform - premake.gcc.platforms['Native'] = premake.gcc.platforms[_OPTIONS.platform] -end - - -local m68kprefix = "/opt/m68k-amigaos" -local curpfx = os.capture("m68k-amigaos-gcc -v 2>&1 | grep prefix", false) -if curpfx ~= "" then - local e = string.sub(curpfx, string.find(curpfx, "--prefix") + 9) - local p = string.sub(e, 0, string.find(e, " ") - 1) - if p ~= "" then - print("using:" .. p .. "/") - m68kprefix = p - end -end - - -solution "milkytracker" - configurations { "Release", "Release-noFPU", "Debug" } - platforms { "m68k-amigaos", "ppc-amigaos", "ppc-morphos", "i386-aros", "ppc-macos" } - includedirs { "./", "./src/fx", "./src/tracker", "./src/compression/", "./src/milkyplay", "./src/ppui", "./src/ppui/sdl", "./src/ppui/osinterface", "./src/milkyplay/drivers/jack", "../../src/milkyplay/drivers/sdl", "./src/submodules/zlib", "./include/lhasa" } - defines { "HAVE_CONFIG_H", "MILKYTRACKER", "__THREADTIMER__", "DRIVER_UNIX", "__FORCE_SDL_AUDIO__" } - - configuration "m68k-amigaos" - buildoptions "-m68040 -mhard-float -O3 -fomit-frame-pointer -fno-exceptions -s -noixemul" - linkoptions { "-noixemul", "-ldebug", "-Xlinker --allow-multiple-definition" } - includedirs { m68kprefix .. "/m68k-amigaos/sys-include", m68kprefix .. "/include", m68kprefix .. "/include/SDL", "./src/ppui/osinterface/amiga", "./src/ppui/osinterface/sdl-1.2", "./src/ppui/osinterface/posix" } - libdirs { m68kprefix .. "/lib", m68kprefix .. "/m68k-amigaos/lib", m68kprefix .. "/m68k-amigaos/libnix/lib/libnix" } - defines { "AMIGA", "__AMIGA__" } - - configuration "ppc-amigaos" - buildoptions "-O3 -mcrt=newlib -fomit-frame-pointer -fno-exceptions" - linkoptions { "-mcrt=newlib", "-lauto", "-lunix" } - includedirs { "/opt/ppc-amigaos/ppc-amigaos/sys-include", "/opt/ppc-amigaos/include", "/opt/ppc-amigaos/include/SDL", "./src/ppui/osinterface/amiga", "./src/ppui/osinterface/sdl-1.2", "./src/ppui/osinterface/posix" } - libdirs { "/opt/ppc-amigaos/lib", "/opt/ppc-amigaos/ppc-amigaos/lib" } - defines { "AMIGA", "__AMIGA__", "__amigaos4__" } - - configuration "x86_64-aros" - buildoptions "-O3 -fomit-frame-pointer -fno-exceptions" - linkoptions { "-noixemul" } - includedirs { "/opt/aros/sdk/x86_64-aros/sys-include", "/opt/aros/sdk/include", "/opt/aros/sdk/include/SDL", "./src/ppui/osinterface/amiga", "./src/ppui/osinterface/sdl-1.2", "./src/ppui/osinterface/posix" } - libdirs { "/opt/aros/sdk/lib", "/opt/aros/sdk/x86_64-aros/lib" } - defines { "AMIGA", "__AMIGA__", "AROS", "aros", "__AROS__", "__aros__" } - - configuration "ppc-macos" - buildoptions "-fomit-frame-pointer -fno-exceptions" - linkoptions { "" } - includedirs { "/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/include", "/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/RIncludes", "/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/include/SDL", "./include/mac", "./src/ppui/osinterface/sdl-1.2", "./src/ppui/osinterface/posix" } - libdirs { "/opt/m68k-ppc-macos/toolchain/powerpc-apple-macos/lib" } - defines { "__macos__" } - - project "lhasa" - kind "StaticLib" - language "C" - location "projects" - targetdir("lib/") - files { "./src/submodules/lhasa/src/**.c", "./src/submodules/lhasa/lib/**.c" } - excludes { "./src/submodules/lhasa/lib/bit_stream_reader.c", "./src/submodules/lhasa/lib/lh_new_decoder.c", "./src/submodules/lhasa/lib/pma_common.c", "./src/submodules/lhasa/lib/tree_decode.c" } - includedirs { "./src/submodules/lhasa", "./src/submodules/lhasa/lib", "./src/submodules/lhasa/lib/public", "./src/submodules/lhasa/src", "./src/submodules/lhasa" } - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetname "lhasa_d" - buildoptions "" - configuration "release" - defines { "NDEBUG" } - targetname "lhasa" - buildoptions "-DHAVE_CONFIG_H -Wimplicit-function-declaration " - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions " -msoft-float" - targetname "lhasa" - configuration "ixemul" - defines { "NDEBUG" } - flags { "OptimizeSize" } - targetname "lhasa" - buildoptions "--std=c++98" - - project "bzlib2" - kind "StaticLib" - language "C" - location "projects" - targetdir("lib/") - files { "./src/submodules/bzlib2/pkg_src/*.c" } - includedirs { "./src/submodules/bzlib2/pkg_src" } - targetname "bz2" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetsuffix "_d" - configuration "release" - defines { "NDEBUG" } - buildoptions "" - - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions "-msoft-float" - - project "zlib" - kind "StaticLib" - language "C" - location "projects" - targetdir("lib/") - files { "./src/submodules/zlib/*.c" } - includedirs { "./src/submodules/zlib" } - targetname "z" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetsuffix "_d" - - configuration "release" - defines { "NDEBUG" } - buildoptions"" - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions "-msoft-float" - - project "zziplib" - kind "StaticLib" - language "C" - location "projects" - targetdir("lib/") - files { "./src/submodules/zziplib/**.c" } - excludes { "./src/submodules/zziplib/SDL/*" } - includedirs { "./include/zziplib", "./src/submodules/zlib", "./src/submodules/zziplib", "./src/submodules/zziplib/SDL" } - targetname "zziplib" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetsuffix "_d" - configuration "release" - defines { "NDEBUG" } - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions "-msoft-float" - - project "milkyplay" - kind "StaticLib" - language "C++" - location "projects" - targetdir("lib/") - files { "./src/milkyplay/*", "./src/milkyplay/generic/*", "./src/milkyplay/sdl-1.2/*", "./src/milkyplay/drivers/*", "./src/milkyplay/drivers/sdl/*", "./src/milkyplay/drivers/generic/sdl/*" } - includedirs { "./src/milkyplay", "./src/milkyplay/drivers/sdl" } - buildoptions "-fno-rtti" - targetname "milkyplay" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetsuffix "_d" - configuration "release" - defines { "NDEBUG" } - buildoptions"-fpermissive" - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions " -msoft-float" - - project "fx" - kind "StaticLib" - language "C++" - location "projects" - targetdir("lib/") - files { "./src/fx/**" } - buildoptions "-fno-rtti" - targetname "fx" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetname "fx_d" - configuration "release" - defines { "NDEBUG" } - targetname "fx" - buildoptions"-fpermissive" - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions " -msoft-float" - targetname "fx" - configuration "ixemul" - defines { "NDEBUG" } - flags { "OptimizeSize" } - targetname "milkyplay" - buildoptions "--std=c++98" - - project "compression" - kind "StaticLib" - language "C++" - location "projects" - targetdir("lib/") - files { "./src/compression/**.cpp", } - includedirs { "./include/zziplib", "./src/compression", "./src/compression/lha", "./src/compression/zlib", "./src/compression/zlib/generic", "./src/compression/zziplib", "./src/compression/zziplib/generic", "./src/submodules/zziplib", "src/submodules/lhasa/lib/public" } - buildoptions "-fno-rtti" - targetname "compression" - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetname "compression_d" - - configuration "release" - defines { "NDEBUG" } - targetname "compression" - buildoptions"-fpermissive" - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions " -msoft-float" - targetname "compression" - configuration "ixemul" - defines { "NDEBUG" } - flags { "OptimizeSize" } - targetname "milkyplay" - buildoptions "--std=c++98" - - project "ppui" - kind "StaticLib" - language "C++" - location "projects" - targetdir("lib/") - files { "./src/ppui/*", "./src/ppui/osinterface/*", "./src/ppui/sdl/*", "./src/ppui/osinterface/amiga/*", "./src/ppui/osinterface/sdl/*", "./src/ppui/osinterface/posix/*" } - excludes { "./src/ppui/osinterface/posix/PPMutex.cpp" } - includedirs { "./src/ppui/osinterface/posix", "./src/ppui/", "./src/ppui/osinterface", "./src/ppui/sdl", "./src/ppui/osinterface/amiga", "./src/ppui/osinterface/sdl", "./src/ppui/osinterface/posix" } - buildoptions "-fno-rtti" - targetname "ppui" - - configuration "m68k-amigaos" - excludes { "./src/ppui/osinterface/posix/PPMutex.cpp" } - configuration "ppc-amigaos" - excludes { "./src/ppui/osinterface/posix/PPMutex.cpp" } - --filter { "configurations:ppc-macos" } - -- excludes { "./src/ppui/osinterface/posix/PPMutex.cpp", "**/amiga/**" } - --filter {} - - configuration "debug" - defines { "DEBUG" } - flags { "Symbols" } - targetname "ppui_d" - - configuration "release" - defines { "NDEBUG" } - targetname "ppui" - buildoptions "-fpermissive" - configuration "release-nofpu" - defines { "NDEBUG" } - buildoptions " -msoft-float" - targetname "ppui" - configuration "ixemul" - defines { "NDEBUG" } - flags { "OptimizeSize" } - targetname "milkyplay" - buildoptions "--std=c++98" - - project "milkytracker" - kind "WindowedApp" - language "C++" - location "projects" - targetdir "./bin" - targetname "milkytracker" - files { "./src/tracker/*", "./src/tracker/sdl-1.2/*" } - links { "z", "bz2", "lhasa", "zziplib", "ppui", "milkyplay", "compression", "fx", "SDL" } - flags { "Symbols" } - buildoptions "-fno-rtti" - - configuration "m68k-amigaos" - targetextension ".68k" - configuration "ppc-amigaos" - targetextension ".os4" - configuration "ppc-macos" - targetextension ".app" - -- links { "SDLmain" } - - -- Debug options. - configuration "Debug" - defines { "DEBUG" } - targetsuffix "_d" - flags { "NoEditAndContinue" } - - -- Release options. - configuration "Release" - buildoptions "-fpermissive" - configuration "Release-noFPU" - defines { "NDEBUG" } - buildoptions "-msoft-float" - targetsuffix "-nofpu" - configuration "ixemul" - flags { "OptimizeSize" } - buildoptions "--std=c++98" - targetsuffix "-ixemul" diff --git a/src/milkyplay/drivers/sdl/.dirstamp b/src/milkyplay/drivers/sdl/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/ppui/osinterface/sdl-1.2/.dirstamp b/src/ppui/osinterface/sdl-1.2/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/ppui/osinterface/sdl-1.2/PPMessageBox_SDL.cpp b/src/ppui/osinterface/sdl-1.2/PPMessageBox_SDL.cpp deleted file mode 100644 index fc3b5193..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPMessageBox_SDL.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ppui/osinterface/sdl/PPMessageBox_SDL.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPMessageBox_SDL.cpp - * MilkyTracker - * - * Created by Peter Barth on 27.09.05. - * - */ - -#include "PPMessageBox.h" -#include -#include "SDL_ModalLoop.h" -#include "DialogFileSelector.h" - -PPMessageBox::ReturnCodes PPMessageBox::runModal() -{ - // Convert texts - char* captionASCIIZ = this->caption.toASCIIZ(); - char* contentASCIIZ = this->content.toASCIIZ(); - PPString caption(captionASCIIZ); - PPString content(contentASCIIZ); - delete[] captionASCIIZ; - delete[] contentASCIIZ; - - // Create a message box (the message box will invoke the responder) - PPDialogBase* dialog = new PPDialogBase(screen, NULL, PP_DEFAULT_ID, caption, content); - - ReturnCodes result = SDL_runModalLoop(screen, dialog); - - delete dialog; - - return result; -} diff --git a/src/ppui/osinterface/sdl-1.2/PPMutex.cpp b/src/ppui/osinterface/sdl-1.2/PPMutex.cpp deleted file mode 100644 index 3fbfaf1d..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPMutex.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ppui/osinterface/sdl/PPMutex.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPMutex.cpp - * MilkyTracker - * - * Created by Peter Barth on 18.11.05. - * - */ - -#include "PPMutex.h" - -PPMutex::PPMutex() -{ - mutex = SDL_CreateMutex(); -} - -PPMutex::~PPMutex() -{ - SDL_DestroyMutex(mutex); -} - -void PPMutex::lock() -{ - SDL_LockMutex(mutex); -} - -void PPMutex::unlock() -{ - SDL_UnlockMutex(mutex); -} diff --git a/src/ppui/osinterface/sdl-1.2/PPMutex.h b/src/ppui/osinterface/sdl-1.2/PPMutex.h deleted file mode 100644 index b6b79c16..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPMutex.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ppui/osinterface/sdl/PPMutex.h - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPMutex.h - * MilkyTracker - * - * Created by Peter Barth on 18.11.05. - * - */ - -#ifndef PPMUTEX__H -#define PPMUTEX__H - -#include - -class PPMutex -{ -private: - SDL_mutex* mutex; - -public: - PPMutex(); - ~PPMutex(); - - void lock(); - void unlock(); -}; - -#endif - diff --git a/src/ppui/osinterface/sdl-1.2/PPOpenPanel_SDL.cpp b/src/ppui/osinterface/sdl-1.2/PPOpenPanel_SDL.cpp deleted file mode 100644 index 71e05217..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPOpenPanel_SDL.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ppui/osinterface/sdl/PPOpenPanel_SDL.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPOpenPanel_SDL.cpp - * MilkyTracker - * - * Created by Peter Barth on Sun Feb 27 2005. - * - */ - -#include "PPOpenPanel.h" -#include -#include "SDL_ModalLoop.h" -#include "DialogFileSelector.h" - -PPOpenPanel::PPOpenPanel(PPScreen* screen, const char* caption) : - PPModalDialog(screen) -{ - this->caption = new char[strlen(caption)+1]; - strcpy(this->caption, caption); -} - -PPOpenPanel::~PPOpenPanel() -{ - if (caption) - delete[] caption; -} - -void PPOpenPanel::addExtension(const PPString& ext, const PPString& desc) -{ - Descriptor* d = new Descriptor(ext, desc); - - items.add(d); -} - -PPOpenPanel::ReturnCodes PPOpenPanel::runModal() -{ - // Create a message box (the message box will invoke the responder) - DialogFileSelector* dialog = new DialogFileSelector(screen, NULL, PP_DEFAULT_ID, this->caption); - - for (pp_int32 i = 0; i < items.size(); i++) - { - PPSystemString ext(items.get(i)->extension); - PPSystemString desc(items.get(i)->description); - dialog->addExtension(ext, desc); - } - - ReturnCodes result = SDL_runModalLoop(screen, dialog); - - PPSystemString pathEntry(dialog->getSelectedPathFull()); - - // this is no longer needed - delete dialog; - - fileName = ((result == ReturnCodeOK) ? pathEntry : (PPString)""); - - return result; -} diff --git a/src/ppui/osinterface/sdl-1.2/PPQuitSaveAlert_SDL.cpp b/src/ppui/osinterface/sdl-1.2/PPQuitSaveAlert_SDL.cpp deleted file mode 100644 index 181850fa..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPQuitSaveAlert_SDL.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ppui/osinterface/sdl/PPQuitSaveAlert_SDL.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPQuitSaveAlert_SDL.cpp - * MilkyTracker - * - * Created by Peter Barth on 28.03.05. - * - */ - -#include "PPQuitSaveAlert.h" -#include -#include "SDL_ModalLoop.h" -#include "DialogFileSelector.h" - -PPQuitSaveAlert::ReturnCodes PPQuitSaveAlert::runModal() -{ - // Create a message box (the message box will invoke the responder) - PPDialogBase* dialog = new PPDialogBase(screen, NULL, PP_DEFAULT_ID, "Save current changes?", PPDialogBase::MessageBox_YESNOCANCEL); - - ReturnCodes result = SDL_runModalLoop(screen, dialog); - - delete dialog; - - return result; -} diff --git a/src/ppui/osinterface/sdl-1.2/PPSavePanel_SDL.cpp b/src/ppui/osinterface/sdl-1.2/PPSavePanel_SDL.cpp deleted file mode 100644 index a8260758..00000000 --- a/src/ppui/osinterface/sdl-1.2/PPSavePanel_SDL.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * ppui/osinterface/sdl/PPSavePanel_SDL.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * PPSavePanel.cpp - * MilkyTracker - * - * Created by Peter Barth on Sat Mar 05 2005. - * - */ - -#include "PPSavePanel.h" -#include -#include "SDL_ModalLoop.h" -#include "DialogFileSelector.h" - -PPSavePanel::ReturnCodes PPSavePanel::runModal() -{ - // Create a message box (the message box will invoke the responder) - DialogFileSelector* dialog = new DialogFileSelector(screen, NULL, PP_DEFAULT_ID, this->caption, true, true); - dialog->setCurrentEditFileName(defaultFileName); - - for (pp_int32 i = 0; i < items.size(); i++) - { - PPSystemString ext(items.get(i)->extension); - PPSystemString desc(items.get(i)->description); - dialog->addExtension(ext, desc); - } - - ReturnCodes result = SDL_runModalLoop(screen, dialog); - - PPSystemString pathEntry(dialog->getSelectedPathFull()); - - // this is no longer needed - delete dialog; - - fileName = ((result == ReturnCodeOK) ? pathEntry : ""); - - return result; -} diff --git a/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.cpp b/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.cpp deleted file mode 100644 index 10f2f8a0..00000000 --- a/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * ppui/osinterface/sdl/SDL_ModalLoop.cpp - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * SDL_ModalLoop.cpp - * MilkyTracker - * - * Created by Peter Barth on 29.03.06. - * - */ - -#include -#include "SDL_ModalLoop.h" -#include "Event.h" -#include "Screen.h" -#include "DialogBase.h" -#include "PPMutex.h" - -void processSDLEvents(const SDL_Event& event); -void processSDLUserEvents(const SDL_UserEvent& event); - -extern PPMutex* globalMutex; - -///////////////////////////////////////////////////////////////// -// -// Okay here goes a quick description of how a modal dialog -// using the SDL is realized: -// So when this modal dialog is invoked, we ARE actually between -// two globalLoop mutex calls, because we were invoked -// by some mouse click or other event -// So now we first attach a new event listener to our screen -// object (so that all events sent end up in our own listener) -// and install our own event handler loop... But this can only -// be done when the globalMutex is unlocked first and locked -// after... -// -///////////////////////////////////////////////////////////////// -PPModalDialog::ReturnCodes SDL_runModalLoop(PPScreen* screen, PPDialogBase* dialog) -{ - bool exitModalLoop = false; - SDL_Event event; - - // screen might be disabled in a stackable fashion - pp_uint32 screenEnableStackCount = 0; - while (!screen->isDisplayEnabled()) - { - screen->enableDisplay(true); - screenEnableStackCount++; - } - - // This is the responder for buttons invoked by the modal dialog - ModalLoopResponder modalLoopResponder(exitModalLoop); - - dialog->setResponder(&modalLoopResponder); - - // Detach the event listener from the screen, this will actually detach the entire tracker from the screen - EventListenerInterface* eventListener = screen->detachEventListener(); - - // Instantinate our own event listener - CustomEventListener customEventListener(eventListener); - - // Attach it - screen->attachEventListener(&customEventListener); - - // Show it - dialog->show(); - - // Now to the tricky part, since a modal dialog has been invoked through a OS event, globalMutex is in locked state - // so to allow further event processing we must unlock the mutex first - // -- really messy and critical -- - if (globalMutex) - globalMutex->unlock(); - - // Create our own event loop - while (!exitModalLoop && SDL_WaitEvent(&event)) - { - switch (event.type) - { - case SDL_MOUSEMOTION: - { - // ignore old mouse motion events in the event queue - SDL_Event new_event; - - if (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) - { - while (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0); - processSDLEvents(new_event); - } - else - { - processSDLEvents(event); - } - break; - } - - case SDL_USEREVENT: - processSDLUserEvents((const SDL_UserEvent&)event); - break; - - default: - processSDLEvents(event); - break; - } - } - - // pretend nothing happened at all, continue with main event loop after we're finished here - if (globalMutex) - globalMutex->lock(); - - // re-attach tracker - screen->attachEventListener(eventListener); - - // if screen was disabled we enable it again - while (screenEnableStackCount > 0) - { - screen->enableDisplay(false); - screenEnableStackCount--; - } - - return modalLoopResponder.getReturnCode(); -} diff --git a/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.h b/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.h deleted file mode 100644 index f244b9e5..00000000 --- a/src/ppui/osinterface/sdl-1.2/SDL_ModalLoop.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * ppui/osinterface/sdl/SDL_ModalLoop.h - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* - * SDL_ModalLoop.h - * MilkyTracker - * - * Created by Peter Barth on 12.03.06. - * - */ - -#ifndef __CUSTOMEVENTLISTENER_H__ -#define __CUSTOMEVENTLISTENER_H__ - -#include "BasicTypes.h" -#include "Event.h" -#include "PPModalDialog.h" - -class CustomEventListener : public EventListenerInterface -{ -private: - EventListenerInterface* oldEventListener; - -public: - CustomEventListener(EventListenerInterface* oldListener) : - oldEventListener(oldListener) - { - } - - virtual pp_int32 handleEvent(PPObject* sender, PPEvent* event) - { - if (event->getID() == eTimer) - { - return oldEventListener->handleEvent(sender, event); - } - return 0; - } - -}; - -class ModalLoopResponder : public DialogResponder -{ -private: - bool& exitModalLoop; - PPModalDialog::ReturnCodes returnCode; - -public: - ModalLoopResponder(bool& exitModalLoopFlag) : - exitModalLoop(exitModalLoopFlag), - returnCode(PPModalDialog::ReturnCodeCANCEL) - { - } - - PPModalDialog::ReturnCodes getReturnCode() { return returnCode; } - - virtual pp_int32 ActionOkay(PPObject* sender) - { - exitModalLoop = true; - returnCode = PPModalDialog::ReturnCodeOK; - return 0; - } - - virtual pp_int32 ActionCancel(PPObject* sender) - { - exitModalLoop = true; - returnCode = PPModalDialog::ReturnCodeCANCEL; - return 0; - } - - virtual pp_int32 ActionNo(PPObject* sender) - { - exitModalLoop = true; - returnCode = PPModalDialog::ReturnCodeNO; - return 0; - } -}; - -class PPScreen; -class PPDialogBase; - -PPModalDialog::ReturnCodes SDL_runModalLoop(PPScreen* screen, PPDialogBase* dialog); - -#endif diff --git a/src/ppui/osinterface/sdl/SDL_ModalLoop.cpp b/src/ppui/osinterface/sdl/SDL_ModalLoop.cpp index e148620f..481edf3d 100644 --- a/src/ppui/osinterface/sdl/SDL_ModalLoop.cpp +++ b/src/ppui/osinterface/sdl/SDL_ModalLoop.cpp @@ -102,16 +102,9 @@ PPModalDialog::ReturnCodes SDL_runModalLoop(PPScreen* screen, PPDialogBase* dial // ignore old mouse motion events in the event queue SDL_Event new_event; -#if SDL_VERSION_ATLEAST(2, 0, 0) if (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) > 0) { while (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_MOUSEMOTION, SDL_MOUSEMOTION) > 0); -#else - if (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0) - { - while (SDL_PeepEvents(&new_event, 1, SDL_GETEVENT, SDL_EVENTMASK(SDL_MOUSEMOTION)) > 0); - -#endif processSDLEvents(new_event); } else diff --git a/src/ppui/sdl-1.2/.dirstamp b/src/ppui/sdl-1.2/.dirstamp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.cpp b/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.cpp deleted file mode 100755 index 263d0739..00000000 --- a/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.cpp +++ /dev/null @@ -1,649 +0,0 @@ -/* - * ppui/sdl/DisplayDeviceFB_SDL.cpp - * - * Copyright 2009 Peter Barth, Christopher O'Neill - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -#include "DisplayDeviceFB_SDL.h" -#include "Graphics.h" - -PPDisplayDeviceFB::PPDisplayDeviceFB(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation/* = ORIENTATION_NORMAL*/, - bool swapRedBlue/* = false*/) : - PPDisplayDevice(screen, width, height, scaleFactor, bpp, fullScreen, theOrientation), - needsTemporaryBuffer((orientation != ORIENTATION_NORMAL) || (scaleFactor != 1)), - temporaryBuffer(NULL) -{ - const SDL_VideoInfo* videoinfo; - - /* Some SDL to get display format */ - videoinfo = SDL_GetVideoInfo(); - if (bpp == -1) - { - bpp = videoinfo->vfmt->BitsPerPixel > 16 ? videoinfo->vfmt->BitsPerPixel : 16; - } - - /* Set a video mode */ - theSurface = screen = CreateScreen(realWidth, realHeight, - bpp, SDL_SWSURFACE | (bFullScreen==true ? SDL_FULLSCREEN : 0)); - if ( screen == NULL ) - { - fprintf(stderr, "Could not set video mode: %s\n", SDL_GetError()); - exit(2); - } - - switch (bpp) - { - case 16: - currentGraphics = new PPGraphics_16BIT(width, height, 0, NULL); - break; - - case 24: - { - PPGraphics_24bpp_generic* g = new PPGraphics_24bpp_generic(width, height, 0, NULL); - if (swapRedBlue) - { - g->setComponentBitpositions(videoinfo->vfmt->Bshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Rshift); - } - else - { - g->setComponentBitpositions(videoinfo->vfmt->Rshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Bshift); - } - currentGraphics = static_cast(g); - break; - } - - case 32: - { - PPGraphics_32bpp_generic* g = new PPGraphics_32bpp_generic(width, height, 0, NULL); - if (swapRedBlue) - { - g->setComponentBitpositions(videoinfo->vfmt->Bshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Rshift); - } - else - { - g->setComponentBitpositions(videoinfo->vfmt->Rshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Bshift); - } - currentGraphics = static_cast(g); - break; - } - - default: - fprintf(stderr, "Unsupported color depth (%i), try either 16, 24 or 32", bpp); - exit(2); - } - - if (needsTemporaryBuffer) - { - temporaryBufferPitch = (width*bpp)/8; - temporaryBufferBPP = bpp; - temporaryBuffer = new pp_uint8[getSize().width*getSize().height*(bpp/8)]; - } - - currentGraphics->lock = true; -} - -PPDisplayDeviceFB::~PPDisplayDeviceFB() -{ - delete[] temporaryBuffer; - // base class is responsible for deleting currentGraphics -} - -PPGraphicsAbstract* PPDisplayDeviceFB::open() -{ - if (!isEnabled()) - return NULL; - - if (currentGraphics->lock) - { - if (SDL_LockSurface(theSurface) < 0) - return NULL; - - currentGraphics->lock = false; - - if (needsTemporaryBuffer) - static_cast(currentGraphics)->setBufferProperties(temporaryBufferPitch, (pp_uint8*)temporaryBuffer); - else - static_cast(currentGraphics)->setBufferProperties(theSurface->pitch, (pp_uint8*)theSurface->pixels); - - return currentGraphics; - } - - return NULL; -} - -void PPDisplayDeviceFB::close() -{ - SDL_UnlockSurface(theSurface); - - currentGraphics->lock = true; -} - -void PPDisplayDeviceFB::update() -{ - if (!isUpdateAllowed() || !isEnabled()) - return; - - if (theSurface->locked) - { - return; - } - - PPRect r(0, 0, getSize().width, getSize().height); - swap(r); - - SDL_UpdateRect(theSurface, 0, 0, 0, 0); -} - -void PPDisplayDeviceFB::update(const PPRect& r) -{ - if (!isUpdateAllowed() || !isEnabled()) - return; - - if (theSurface->locked) - { - return; - } - - PPRect r2(r); - swap(r2); - - PPRect r3(r); - r3.scale(scaleFactor); - - transformInverse(r3); - - SDL_UpdateRect(theSurface, r3.x1, r3.y1, (r3.x2-r3.x1), (r3.y2-r3.y1)); -} - -void PPDisplayDeviceFB::swap(const PPRect& r2) -{ - PPRect r(r2); - pp_int32 h; - if (r.x2 < r.x1) - { - h = r.x1; r.x1 = r.x2; r.x2 = h; - } - if (r.y2 < r.y1) - { - h = r.y1; r.y1 = r.y2; r.y2 = h; - } - - switch (orientation) - { - case ORIENTATION_NORMAL: - { - if (!needsTemporaryBuffer) - return; - - if (SDL_LockSurface(theSurface) < 0) - return; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - switch (temporaryBufferBPP) - { - case 16: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint16* dstPtr = (pp_uint16*)(dst + y*dstPitch + destRect.x1*dstBPP); - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *dstPtr++ = *(pp_uint16*)(srcPtr + (u>>16) * srcBPP); - u += stepU; - } - v += stepV; - } - - - break; - } - - case 24: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint8* dstPtr = (pp_uint8*)(dst + y*dstPitch + destRect.x1*dstBPP); - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *dstPtr = *(pp_uint8*)(srcPtr + (u>>16) * srcBPP); - *(dstPtr+1) = *(pp_uint8*)(srcPtr + (u>>16) * srcBPP + 1); - *(dstPtr+2) = *(pp_uint8*)(srcPtr + (u>>16) * srcBPP + 2); - dstPtr+=3; - u += stepU; - } - v += stepV; - } - - break; - } - - case 32: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint32* dstPtr = (pp_uint32*)(dst + y*dstPitch + destRect.x1*dstBPP); - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *dstPtr++ = *(pp_uint32*)(srcPtr + (u>>16) * srcBPP); - u += stepU; - } - v += stepV; - } - - break; - } - - default: - fprintf(stderr, "Unsupported color depth for requested orientation"); - exit(2); - } - - SDL_UnlockSurface(theSurface); - - break; - } - - case ORIENTATION_ROTATE90CCW: - { - if (SDL_LockSurface(theSurface) < 0) - return; - - switch (temporaryBufferBPP) - { - case 16: - { - pp_uint32 srcPitch = temporaryBufferPitch >> 1; - pp_uint32 dstPitch = theSurface->pitch >> 1; - - pp_uint16* src = (pp_uint16*)temporaryBuffer; - pp_uint16* dst = (pp_uint16*)theSurface->pixels; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint16* srcPtr = src + (v>>16)*srcPitch; - pp_uint16* dstPtr = dst + y + (realHeight-destRect.x1)*dstPitch; - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *(dstPtr-=dstPitch) = *(srcPtr+(u>>16)); - - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint16* srcPtr = src + y*srcPitch + r.x1; - pp_uint16* dstPtr = dst + y + (realHeight-r.x1)*dstPitch; - for (pp_uint32 x = r.x1; x < r.x2; x++) - *(dstPtr-=dstPitch) = *srcPtr++; - } - } - - break; - } - - case 24: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - pp_uint8* dstPtr = dst + y*dstBPP + dstPitch*(realHeight-1-destRect.x1); - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - dstPtr[0] = *(srcPtr+(u>>16) * srcBPP); - dstPtr[1] = *(srcPtr+(u>>16) * srcBPP + 1); - dstPtr[2] = *(srcPtr+(u>>16) * srcBPP + 2); - dstPtr-=dstPitch; - - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint8* srcPtr = src + y*srcPitch + r.x1*srcBPP; - pp_uint8* dstPtr = dst + y*dstBPP + dstPitch*(realHeight-1-r.x1); - for (pp_uint32 x = r.x1; x < r.x2; x++) - { - dstPtr[0] = srcPtr[0]; - dstPtr[1] = srcPtr[1]; - dstPtr[2] = srcPtr[2]; - srcPtr+=srcBPP; - dstPtr-=dstPitch; - } - } - } - - break; - } - - case 32: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - pp_uint32* dstPtr = (pp_uint32*)(dst + y*dstBPP + dstPitch*(realHeight-1-destRect.x1)); - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *(dstPtr-=(dstPitch>>2)) = *(pp_uint32*)(srcPtr + (u>>16) * srcBPP); - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint32* srcPtr = (pp_uint32*)(src + y*srcPitch + r.x1*srcBPP); - pp_uint32* dstPtr = (pp_uint32*)(dst + y*dstBPP + dstPitch*(realHeight-1-r.x1)); - for (pp_uint32 x = r.x1; x < r.x2; x++) - *(dstPtr-=(dstPitch>>2)) = *srcPtr++; - } - } - - break; - } - - default: - fprintf(stderr, "Unsupported color depth for requested orientation"); - exit(2); - } - - SDL_UnlockSurface(theSurface); - break; - } - - case ORIENTATION_ROTATE90CW: - { - if (SDL_LockSurface(theSurface) < 0) - return; - - switch (temporaryBufferBPP) - { - case 16: - { - pp_uint32 srcPitch = temporaryBufferPitch >> 1; - pp_uint32 dstPitch = theSurface->pitch >> 1; - - pp_uint16* src = (pp_uint16*)temporaryBuffer; - pp_uint16* dst = (pp_uint16*)theSurface->pixels; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint16* srcPtr = src + (v>>16)*srcPitch; - pp_uint16* dstPtr = dst + (realWidth-1-y) + (dstPitch*(destRect.x1-1)); - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *(dstPtr+=dstPitch) = *(srcPtr+(u>>16)); - - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint16* srcPtr = src + y*srcPitch + r.x1; - pp_uint16* dstPtr = dst + (realWidth-1-y) + (dstPitch*(r.x1-1)); - for (pp_uint32 x = r.x1; x < r.x2; x++) - *(dstPtr+=dstPitch) = *srcPtr++; - } - } - - break; - } - - case 24: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - pp_uint8* dstPtr = dst + (realWidth-1-y)*dstBPP + (dstPitch*(destRect.x1-1)); - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - dstPtr[0] = *(srcPtr+(u>>16) * srcBPP); - dstPtr[1] = *(srcPtr+(u>>16) * srcBPP + 1); - dstPtr[2] = *(srcPtr+(u>>16) * srcBPP + 2); - dstPtr+=dstPitch; - - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint8* srcPtr = src + y*srcPitch + r.x1*srcBPP; - pp_uint8* dstPtr = dst + (realWidth-1-y)*dstBPP + (dstPitch*r.x1); - for (pp_uint32 x = r.x1; x < r.x2; x++) - { - dstPtr[0] = srcPtr[0]; - dstPtr[1] = srcPtr[1]; - dstPtr[2] = srcPtr[2]; - srcPtr+=srcBPP; - dstPtr+=dstPitch; - } - } - } - - break; - } - - case 32: - { - pp_uint32 srcPitch = temporaryBufferPitch; - pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; - pp_uint8* dst = (pp_uint8*)theSurface->pixels; - - const pp_uint32 srcBPP = temporaryBufferBPP/8; - const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - - if (scaleFactor != 1) - { - PPRect destRect(r); - destRect.scale(scaleFactor); - - const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); - const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - - pp_uint32 v = r.y1 * 65536; - for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) - { - pp_uint32 u = r.x1 * 65536; - pp_uint8* srcPtr = src + (v>>16)*srcPitch; - pp_uint32* dstPtr = (pp_uint32*)(dst + (realWidth-1-y)*dstBPP + (dstPitch*(destRect.x1-1))); - for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) - { - *(dstPtr+=(dstPitch>>2)) = *(pp_uint32*)(srcPtr + (u>>16) * srcBPP); - u += stepU; - } - v += stepV; - } - } - else - { - for (pp_uint32 y = r.y1; y < r.y2; y++) - { - pp_uint32* srcPtr = (pp_uint32*)(src + y*srcPitch + r.x1*srcBPP); - pp_uint32* dstPtr = (pp_uint32*)(dst + (realWidth-1-y)*dstBPP + (dstPitch*(r.x1-1))); - for (pp_uint32 x = r.x1; x < r.x2; x++) - *(dstPtr+=(dstPitch>>2)) = *srcPtr++; - } - } - - break; - } - - default: - fprintf(stderr, "Unsupported color depth for requested orientation"); - exit(2); - } - - SDL_UnlockSurface(theSurface); - - break; - } - - } -} diff --git a/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.h b/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.h deleted file mode 100755 index 19093b77..00000000 --- a/src/ppui/sdl-1.2/DisplayDeviceFB_SDL.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * ppui/sdl/DisplayDeviceFB_SDL.h - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -///////////////////////////////////////////////////////////////// -// -// Our display device -// -///////////////////////////////////////////////////////////////// -#ifndef __DISPLAYDEVICEFB_H__ -#define __DISPLAYDEVICEFB_H__ - -#include "DisplayDevice_SDL.h" - -class PPDisplayDeviceFB : public PPDisplayDevice -{ -private: - bool needsTemporaryBuffer; - pp_uint8* temporaryBuffer; - pp_uint32 temporaryBufferPitch, temporaryBufferBPP; - - // used for rotating coordinates etc. - void swap(const PPRect& r); - -public: - PPDisplayDeviceFB(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation = ORIENTATION_NORMAL, - bool swapRedBlue = false); - - virtual ~PPDisplayDeviceFB(); - - virtual bool supportsScaling() const { return true; } - - virtual PPGraphicsAbstract* open(); - virtual void close(); - - void update(); - void update(const PPRect& r); -}; - -#endif diff --git a/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.cpp b/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.cpp deleted file mode 100755 index ef778a0c..00000000 --- a/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.cpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * ppui/sdl/DisplayDeviceOGL_SDL.cpp - * - * Copyright 2009 Peter Barth, Christopher O'Neill - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* Using the OpenGL API for drawing/font operations turned out to be very CPU - * intensive.. This code left here for historic reasons (edit the relevant - * parts of src/tracker/Makefile.am if you want to play around). - */ - -#include "DisplayDeviceOGL_SDL.h" -#include "Graphics.h" - -#ifdef __OPENGL__ - -#ifdef __APPLE__ -#include -#endif - -PPDisplayDeviceOGL::PPDisplayDeviceOGL(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation/* = ORIENTATION_NORMAL*/, - bool swapRedBlue/* = false*/) : - PPDisplayDevice(screen, width, height, bpp, scaleFactor, fullScreen, theOrientation) -{ - const SDL_VideoInfo* videoinfo; - - /* Some SDL to get display format */ - videoinfo = SDL_GetVideoInfo(); - if (bpp == -1) - { - bpp = videoinfo->vfmt->BitsPerPixel > 16 ? videoinfo->vfmt->BitsPerPixel : 16; - } - - Uint32 videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */ - videoFlags |= SDL_GL_DOUBLEBUFFER; /* Enable double buffering */ - videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware */ - //videoFlags |= SDL_ASYNCBLIT; - - /* This checks to see if surfaces can be stored in memory */ - if (videoinfo->hw_available) - videoFlags |= videoinfo->hw_available ? SDL_HWSURFACE : SDL_SWSURFACE; - - /* This checks if hardware blits can be done */ - if (videoinfo->blit_hw) - videoFlags |= SDL_HWACCEL; - - /* Sets up OpenGL double buffering */ - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - - /* Set a video mode */ - theSurface = screen = CreateScreen(realWidth, realHeight, - bpp, videoFlags | (bFullScreen==true ? SDL_FULLSCREEN : 0)); - if (NULL == screen) - { - fprintf(stderr, "Could not set video mode: %s\n", SDL_GetError()); - exit(2); - } - -#if 0 - CGLError err; - CGLContextObj ctx = CGLGetCurrentContext(); - - // Enable the multi-threading - err = CGLEnable( ctx, kCGLCEMPEngine); - - if (err != kCGLNoError ) - { - exit(2); - } -#endif - - currentGraphics = new PPGraphics_OGL(width, height); - currentGraphics->lock = true; -} - -PPDisplayDeviceOGL::~PPDisplayDeviceOGL() -{ - // base class is responsible for deleting currentGraphics -} - -PPGraphicsAbstract* PPDisplayDeviceOGL::open() -{ - if (!isEnabled()) - return NULL; - - if (currentGraphics->lock) - { - if (SDL_LockSurface(theSurface) < 0) - return NULL; - - currentGraphics->lock = false; - - return currentGraphics; - } - - return NULL; -} - -void PPDisplayDeviceOGL::close() -{ - SDL_UnlockSurface(theSurface); - - currentGraphics->lock = true; -} - -void PPDisplayDeviceOGL::update() -{ - if (!isUpdateAllowed() || !isEnabled()) - return; - - if (theSurface->locked) - { - return; - } - - SDL_GL_SwapBuffers(); - - //SDL_UpdateRect(theSurface, 0, 0, 0, 0); -} - -void PPDisplayDeviceOGL::update(const PPRect& r) -{ - update(); - - //PPRect r3 = r; - //transformInverse(r3); - - //SDL_UpdateRect(theSurface, r3.x1, r3.y1, r3.x2-r3.x1, r3.y2-r3.y1); -} - -#endif diff --git a/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.h b/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.h deleted file mode 100755 index 9ffae037..00000000 --- a/src/ppui/sdl-1.2/DisplayDeviceOGL_SDL.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ppui/sdl/DisplayDeviceOGL_SDL.h - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -/* Using the OpenGL API for drawing/font operations turned out to be very CPU - * intensive.. This code left here for historic reasons (edit the relevant - * parts of src/tracker/Makefile.am if you want to play around). - */ - -#ifndef __DISPLAYDEVICEOGL_H__ -#define __DISPLAYDEVICEOGL_H__ - -#include "DisplayDevice_SDL.h" - -class PPDisplayDeviceOGL : public PPDisplayDevice -{ -public: - PPDisplayDeviceOGL(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation = ORIENTATION_NORMAL, - bool swapRedBlue = false); - - virtual ~PPDisplayDeviceOGL(); - - virtual PPGraphicsAbstract* open(); - virtual void close(); - - void update(); - void update(const PPRect& r); -}; - -#endif diff --git a/src/ppui/sdl-1.2/DisplayDevice_SDL.cpp b/src/ppui/sdl-1.2/DisplayDevice_SDL.cpp deleted file mode 100644 index 14eda518..00000000 --- a/src/ppui/sdl-1.2/DisplayDevice_SDL.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/* - * ppui/sdl/DisplayDevice_SDL.cpp - * - * Copyright 2009 Peter Barth, Christopher O'Neill - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -#include "DisplayDevice_SDL.h" -#include "Graphics.h" - -SDL_Surface* PPDisplayDevice::CreateScreen(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags) -{ - SDL_Surface *screen; - - /* Set the video mode */ - screen = SDL_SetVideoMode(w, h, bpp, flags); - if (screen == NULL) - { - fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError()); - fprintf(stderr, "Retrying with default size..."); - - w = getDefaultWidth(); - h = getDefaultHeight(); - - screen = SDL_SetVideoMode(w, h, bpp, flags); - - if (screen == NULL) - { - fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError()); - fprintf(stderr, "Giving up."); - - return NULL; - } - } - - return screen; -} - -PPDisplayDevice::PPDisplayDevice(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation/* = ORIENTATION_NORMAL*/) : - PPDisplayDeviceBase(width, height, scaleFactor), - realWidth(width), realHeight(height), - orientation(theOrientation) -{ - adjust(realWidth, realHeight); - - bFullScreen = fullScreen; - - initMousePointers(); -} - -PPDisplayDevice::~PPDisplayDevice() -{ - delete currentGraphics; -} - -void PPDisplayDevice::adjust(pp_int32& x, pp_int32& y) -{ - switch (orientation) - { - case ORIENTATION_NORMAL: - case ORIENTATION_ROTATE180: - break; - - case ORIENTATION_ROTATE90CCW: - case ORIENTATION_ROTATE90CW: - { - pp_int32 h = x; - x = y; - y = h; - break; - } - } - - x *= scaleFactor; - y *= scaleFactor; -} - -void PPDisplayDevice::transform(pp_int32& x, pp_int32& y) -{ - pp_int32 h; - - switch (orientation) - { - case ORIENTATION_NORMAL: - break; - - case ORIENTATION_ROTATE90CW: - h = x; - x = y; - y = realWidth - 1 - h; - break; - - case ORIENTATION_ROTATE180: - break; - - case ORIENTATION_ROTATE90CCW: - h = x; - x = realHeight - 1 - y; - y = h; - break; - } -} - -void PPDisplayDevice::transformInverse(pp_int32& x, pp_int32& y) -{ - pp_int32 h; - - switch (orientation) - { - case ORIENTATION_NORMAL: - break; - - case ORIENTATION_ROTATE90CW: - h = x; - x = realWidth - y; - y = h; - break; - - case ORIENTATION_ROTATE180: - break; - - case ORIENTATION_ROTATE90CCW: - h = x; - x = y; - y = realHeight - h; - break; - } -} - -void PPDisplayDevice::transformInverse(PPRect& r) -{ - transformInverse((pp_int32&)r.x1, (pp_int32&)r.y1); - transformInverse((pp_int32&)r.x2, (pp_int32&)r.y2); - - pp_int32 h; - if (r.x2 < r.x1) - { - h = r.x1; r.x1 = r.x2; r.x2 = h; - } - if (r.y2 < r.y1) - { - h = r.y1; r.y1 = r.y2; r.y2 = h; - } -} - - -void PPDisplayDevice::setTitle(const PPSystemString& title) -{ - SDL_WM_SetCaption(title, "MilkyTracker"); -} - -void PPDisplayDevice::setSize(const PPSize& size) -{ - theSurface = SDL_SetVideoMode(size.width, size.height, theSurface->format->BitsPerPixel, theSurface->flags); -} - -bool PPDisplayDevice::goFullScreen(bool b) -{ - // In X11, this will make MilkyTracker go fullscreen at the selected - // resolution. - - SDL_Surface* screen = SDL_GetVideoSurface(); - if (SDL_WM_ToggleFullScreen(screen)) - { - bFullScreen = !bFullScreen; - return true; - } - - return false; -} - -// Defined in main.cpp -void exitSDLEventLoop(bool serializedEventInvoked = true); - -void PPDisplayDevice::shutDown() -{ - exitSDLEventLoop(); -} - -void PPDisplayDevice::setMouseCursor(MouseCursorTypes type) -{ - currentCursorType = type; - - switch (type) - { - case MouseCursorTypeStandard: - SDL_SetCursor(cursorStandard); - break; - - case MouseCursorTypeResizeLeft: - SDL_SetCursor(cursorResizeLeft); - break; - - case MouseCursorTypeResizeRight: - SDL_SetCursor(cursorResizeRight); - break; - - case MouseCursorTypeHand: - SDL_SetCursor(cursorHand); - break; - - case MouseCursorTypeWait: - SDL_SetCursor(cursorEggtimer); - break; - } -} - -void PPDisplayDevice::signalWaitState(bool b, const PPColor& color) -{ - setMouseCursor(b ? MouseCursorTypeWait : MouseCursorTypeStandard); -} - -// Mouse pointer data -Uint8 PPDisplayDevice::resizeLeft_data[] = { 0, 0, 96, 0, 97, 128, 99, 0, 102, 0, 108, 0, 120, 0, 127, 254, 120, 0, 124, 0, 102, 0, 99, 0, 97, 128, 96, 0, 0, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeLeft_mask[] = { 240, 0, 241, 128, 243, 192, 247, 128, 255, 0, 254, 0, 255, 255, 255, 255, 255, 255, 254, 0, 255, 0, 247, 128, 243, 192, 241, 128, 240, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeRight_data[] = { 0, 0, 0, 6, 1, 134, 0, 198, 0, 102, 0, 54, 0, 30, 127, 254, 0, 30, 0, 62, 0, 102, 0, 198, 1, 134, 0, 6, 0, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeRight_mask[] = { 0, 15, 1, 143, 3, 207, 1, 239, 0, 255, 0, 127, 255, 255, 255, 255, 255, 255, 0, 127, 0, 255, 1, 239, 3, 207, 1, 143, 0, 15, 0, 0, }; -Uint8 PPDisplayDevice::eggtimer_data[] = { 0, 0, 127, 192, 32, 128, 32, 128, 17, 0, 17, 0, 10, 0, 4, 0, 4, 0, 10, 0, 17, 0, 17, 0, 32, 128, 32, 128, 127, 192, 0, 0 }; -Uint8 PPDisplayDevice::eggtimer_mask[] = { 255, 224, 255, 224, 127, 192, 127, 192, 63, 128, 63, 128, 31, 0, 14, 0, 14, 0, 31, 0, 63, 128, 63, 128, 127, 192, 127, 192, 255, 224, 255, 224 }; -Uint8 PPDisplayDevice::hand_data[] = {54, 192, 91, 64, 146, 64, 146, 112, 146, 104, 146, 104, 128, 40, 128, 40, 128, 8, 128, 8, 128, 16, 64, 16, 64, 32, 32, 32, 31, 192, 0, 0, }; -Uint8 PPDisplayDevice::hand_mask[] = {54, 192, 127, 192, 255, 192, 255, 240, 255, 248, 255, 248, 255, 248, 255, 248, 255, 248, 255, 248, 255, 240, 127, 240, 127, 224, 63, 224, 31, 192, 0, 0, }; - -void PPDisplayDevice::initMousePointers() -{ - cursorResizeLeft = SDL_CreateCursor(resizeLeft_data, resizeLeft_mask, 16, 16, 2, 7); - cursorResizeRight = SDL_CreateCursor(resizeRight_data, resizeRight_mask, 16, 16, 13, 7); - cursorEggtimer = SDL_CreateCursor(eggtimer_data, eggtimer_mask, 16, 16, 5, 7); - cursorHand = SDL_CreateCursor(hand_data, hand_mask, 16, 16, 5, 5); - - // The current cursor is used as the standard cursor; - // This might cause problems if the system if displaying some other cursor at - // the time, or it might not. It depends. - cursorStandard = SDL_GetCursor(); -} diff --git a/src/ppui/sdl-1.2/DisplayDevice_SDL.h b/src/ppui/sdl-1.2/DisplayDevice_SDL.h deleted file mode 100644 index d35410c8..00000000 --- a/src/ppui/sdl-1.2/DisplayDevice_SDL.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * ppui/sdl/DisplayDevice_SDL.h - * - * Copyright 2009 Peter Barth - * - * This file is part of Milkytracker. - * - * Milkytracker is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Milkytracker is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Milkytracker. If not, see . - * - */ - -///////////////////////////////////////////////////////////////// -// -// Our display device -// -///////////////////////////////////////////////////////////////// -#ifndef __DISPLAYDEVICE_H__ -#define __DISPLAYDEVICE_H__ - -#include "BasicTypes.h" -#include "DisplayDeviceBase.h" - -#include - -// Forwards -class PPGraphicsAbstract; - -class PPDisplayDevice : public PPDisplayDeviceBase -{ -public: - enum Orientations - { - // Orientations - ORIENTATION_NORMAL, - ORIENTATION_ROTATE90CCW, - ORIENTATION_ROTATE180, // unsupported - ORIENTATION_ROTATE90CW, - ORIENTATION_UNKNOWN - }; - -protected: - pp_int32 realWidth, realHeight; - SDL_Surface* theSurface; - Orientations orientation; - - SDL_Surface* CreateScreen(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags); - - // used for rotating coordinates etc. - void adjust(pp_int32& x, pp_int32& y); - - // Mouse pointers - SDL_Cursor *cursorStandard, *cursorResizeLeft, *cursorResizeRight, *cursorEggtimer, *cursorHand; - void initMousePointers(); - static Uint8 resizeLeft_data[], resizeLeft_mask[]; - static Uint8 resizeRight_data[], resizeRight_mask[]; - static Uint8 eggtimer_data[], eggtimer_mask[]; - static Uint8 hand_data[], hand_mask[]; - -public: - PPDisplayDevice(SDL_Surface*& screen, - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation = ORIENTATION_NORMAL); - - virtual ~PPDisplayDevice(); - - virtual void setSize(const PPSize& size); - - void transform(pp_int32& x, pp_int32& y); - void transformInverse(pp_int32& x, pp_int32& y); - void transformInverse(PPRect& r); - - Orientations getOrientation() { return orientation; } - - // ----------------------------- ex. PPWindow ---------------------------- - virtual void setTitle(const PPSystemString& title); - virtual bool goFullScreen(bool b); - virtual void shutDown(); - virtual void signalWaitState(bool b, const PPColor& color); - virtual void setMouseCursor(MouseCursorTypes type); -}; - -#endif diff --git a/src/ppui/sdl/DisplayDeviceFB_SDL.cpp b/src/ppui/sdl/DisplayDeviceFB_SDL.cpp index 2b199966..3b968e03 100644 --- a/src/ppui/sdl/DisplayDeviceFB_SDL.cpp +++ b/src/ppui/sdl/DisplayDeviceFB_SDL.cpp @@ -31,28 +31,17 @@ #include "DisplayDeviceFB_SDL.h" #include "Graphics.h" -#include - -PPDisplayDeviceFB::PPDisplayDeviceFB( -#if !SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Surface*& screen, -#endif - pp_int32 width, - pp_int32 height, - pp_int32 scaleFactor, - pp_int32 bpp, - bool fullScreen, - Orientations theOrientation/* = ORIENTATION_NORMAL*/, - bool swapRedBlue/* = false*/) : - PPDisplayDevice( -#if !SDL_VERSION_ATLEAST(2, 0, 0) - screen, -#endif - width, height, scaleFactor, bpp, fullScreen, theOrientation), +PPDisplayDeviceFB::PPDisplayDeviceFB(pp_int32 width, + pp_int32 height, + pp_int32 scaleFactor, + pp_int32 bpp, + bool fullScreen, + Orientations theOrientation/* = ORIENTATION_NORMAL*/, + bool swapRedBlue/* = false*/) : + PPDisplayDevice(width, height, scaleFactor, bpp, fullScreen, theOrientation), needsTemporaryBuffer((orientation != ORIENTATION_NORMAL) || (scaleFactor != 1)), temporaryBuffer(NULL) { -#if SDL_VERSION_ATLEAST(2, 0, 0) // Create an SDL window and surface theWindow = CreateWindow(realWidth, realHeight, bpp, #ifdef HIDPI_SUPPORT @@ -66,7 +55,7 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( fprintf(stderr, "SDL: Could not create window.\n"); exit(EXIT_FAILURE); } - + // Create renderer for the window theRenderer = SDL_CreateRenderer(theWindow, drv_index, 0); if (theRenderer == NULL) @@ -108,7 +97,7 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( fprintf(stderr, "SDL: SDL_CreateSurface failed: %s\n", SDL_GetError()); exit(EXIT_FAILURE); } - + // Streaming texture for rendering the UI theTexture = SDL_CreateTexture(theRenderer, theSurface->format->format, SDL_TEXTUREACCESS_STREAMING, realWidth, realHeight); if (theTexture == NULL) @@ -116,28 +105,9 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( fprintf(stderr, "SDL: SDL_CreateTexture failed: %s\n", SDL_GetError()); exit(EXIT_FAILURE); } - + // We got a surface: update bpp value bpp = theSurface->format->BitsPerPixel; -#else - const SDL_VideoInfo* videoinfo; - - /* Some SDL to get display format */ - videoinfo = SDL_GetVideoInfo(); - if (bpp == -1) { - bpp = videoinfo->vfmt->BitsPerPixel > 15 ? videoinfo->vfmt->BitsPerPixel : 15; - } - this->bpp = bpp; - - /* Set a video mode */ - theSurface = screen = CreateScreen(realWidth, realHeight, bpp, - SDL_SWSURFACE | (bFullScreen==true ? SDL_FULLSCREEN : 0)); - if ( screen == NULL ) - { - fprintf(stderr, "Could not set video mode: %s\n", SDL_GetError()); - exit(2); - } -#endif // Create a PPGraphics context based on bpp switch (bpp) @@ -151,10 +121,10 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( case 16: currentGraphics = new PPGraphics_16BIT(width, height, 0, NULL); break; + case 24: { PPGraphics_24bpp_generic* g = new PPGraphics_24bpp_generic(width, height, 0, NULL); -#if SDL_VERSION_ATLEAST(2, 0, 0) if (swapRedBlue) { g->setComponentBitpositions(theSurface->format->Bshift, @@ -167,28 +137,13 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( theSurface->format->Gshift, theSurface->format->Bshift); } -#else - if (swapRedBlue) - { - g->setComponentBitpositions(videoinfo->vfmt->Bshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Rshift); - } - else - { - g->setComponentBitpositions(videoinfo->vfmt->Rshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Bshift); - } -#endif currentGraphics = static_cast(g); break; } - + case 32: { PPGraphics_32bpp_generic* g = new PPGraphics_32bpp_generic(width, height, 0, NULL); -#if SDL_VERSION_ATLEAST(2, 0, 0) if (swapRedBlue) { g->setComponentBitpositions(theSurface->format->Bshift, @@ -201,49 +156,30 @@ PPDisplayDeviceFB::PPDisplayDeviceFB( theSurface->format->Gshift, theSurface->format->Bshift); } -#else - if (swapRedBlue) - { - g->setComponentBitpositions(videoinfo->vfmt->Bshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Rshift); - } - else - { - g->setComponentBitpositions(videoinfo->vfmt->Rshift, - videoinfo->vfmt->Gshift, - videoinfo->vfmt->Bshift); - } -#endif currentGraphics = static_cast(g); break; } - + default: fprintf(stderr, "SDL: Unsupported color depth (%i), try either 16, 24 or 32", bpp); exit(EXIT_FAILURE); } - + if (needsTemporaryBuffer) { temporaryBufferPitch = (width*bpp)/8; temporaryBufferBPP = bpp; temporaryBuffer = new pp_uint8[getSize().width*getSize().height*(bpp/8)]; } - + currentGraphics->lock = true; } PPDisplayDeviceFB::~PPDisplayDeviceFB() -{ - pp_uint32 i; - +{ SDL_FreeSurface(theSurface); - -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_DestroyRenderer(theRenderer); SDL_DestroyWindow(theWindow); -#endif delete[] temporaryBuffer; // base class is responsible for deleting currentGraphics @@ -261,15 +197,14 @@ PPGraphicsAbstract* PPDisplayDeviceFB::open() currentGraphics->lock = false; - if (needsTemporaryBuffer) { - static_cast(currentGraphics)->setBufferProperties(temporaryBufferPitch, (pp_uint8*)temporaryBuffer); - } else { - static_cast(currentGraphics)->setBufferProperties(theSurface->pitch, (pp_uint8 *)theSurface->pixels); - } - + if (needsTemporaryBuffer) + static_cast(currentGraphics)->setBufferProperties(temporaryBufferPitch, (pp_uint8*)temporaryBuffer); + else + static_cast(currentGraphics)->setBufferProperties(theSurface->pitch, (pp_uint8*)theSurface->pixels); + return currentGraphics; } - + return NULL; } @@ -297,114 +232,98 @@ void PPDisplayDeviceFB::setPalette(PPColor * pppal) palette[i].b = pppal[i].b; } -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetPaletteColors(theSurface->format->palette, palette, 0, 256); -#else - SDL_SetColors(theSurface, palette, 0, 256); -#endif } void PPDisplayDeviceFB::update() { if (!isUpdateAllowed() || !isEnabled()) return; - + if (theSurface->locked) + { return; - + } + PPRect r(0, 0, getSize().width, getSize().height); - postProcess(r); - -#if SDL_VERSION_ATLEAST(2, 0, 0) + swap(r); + // Update entire texture and copy to renderer SDL_UpdateTexture(theTexture, NULL, theSurface->pixels, theSurface->pitch); SDL_RenderClear(theRenderer); SDL_RenderCopy(theRenderer, theTexture, NULL, NULL); SDL_RenderPresent(theRenderer); -#else - SDL_UpdateRect(theSurface, 0, 0, 0, 0); -#endif } void PPDisplayDeviceFB::update(const PPRect& r) { if (!isUpdateAllowed() || !isEnabled()) return; - + if (theSurface->locked) + { return; + } -#if SDL_VERSION_ATLEAST(2, 0, 0) - postProcess(r); - + swap(r); + PPRect r2(r); r2.scale(scaleFactor); - + transformInverse(r2); SDL_Rect r3 = { r2.x1, r2.y1, r2.width(), r2.height() }; - + // Calculate destination pixel data offset based on row pitch and x coordinate void* surfaceOffset = (char*) theSurface->pixels + r2.y1 * theSurface->pitch + r2.x1 * theSurface->format->BytesPerPixel; - + // Update dirty area of texture and copy to renderer SDL_UpdateTexture(theTexture, &r3, surfaceOffset, theSurface->pitch); SDL_RenderClear(theRenderer); SDL_RenderCopy(theRenderer, theTexture, NULL, NULL); SDL_RenderPresent(theRenderer); -#else - PPRect r2(r); - postProcess(r2); - - PPRect r3(r); - r3.scale(scaleFactor); - - transformInverse(r3); - - SDL_UpdateRect(theSurface, r3.x1, r3.y1, (r3.x2-r3.x1), (r3.y2-r3.y1)); -#endif } -void PPDisplayDeviceFB::postProcess(const PPRect& r2) +void PPDisplayDeviceFB::swap(const PPRect& r2) { PPRect r(r2); pp_int32 h; if (r.x2 < r.x1) { h = r.x1; r.x1 = r.x2; r.x2 = h; - } + } if (r.y2 < r.y1) { h = r.y1; r.y1 = r.y2; r.y2 = h; - } - + } + switch (orientation) { case ORIENTATION_NORMAL: { if (!needsTemporaryBuffer) return; - + if (SDL_LockSurface(theSurface) < 0) return; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - + switch (temporaryBufferBPP) { case 16: { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; pp_uint32 v = r.y1 * 65536; @@ -421,7 +340,7 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) v += stepV; } - + break; } @@ -429,10 +348,10 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; @@ -452,18 +371,18 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) } v += stepV; } - + break; } - + case 32: { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; @@ -483,40 +402,40 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) break; } - + default: fprintf(stderr, "SDL: Unsupported color depth for requested orientation"); exit(2); } - - SDL_UnlockSurface(theSurface); + + SDL_UnlockSurface(theSurface); break; } - + case ORIENTATION_ROTATE90CCW: { if (SDL_LockSurface(theSurface) < 0) return; - + switch (temporaryBufferBPP) { case 16: { pp_uint32 srcPitch = temporaryBufferPitch >> 1; pp_uint32 dstPitch = theSurface->pitch >> 1; - - pp_uint16* src = (pp_uint16*)temporaryBuffer; + + pp_uint16* src = (pp_uint16*)temporaryBuffer; pp_uint16* dst = (pp_uint16*)theSurface->pixels; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - + pp_uint32 v = r.y1 * 65536; for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) { @@ -526,7 +445,7 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) { *(dstPtr-=dstPitch) = *(srcPtr+(u>>16)); - + u += stepU; } v += stepV; @@ -542,7 +461,7 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) *(dstPtr-=dstPitch) = *srcPtr++; } } - + break; } @@ -550,21 +469,21 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - + pp_uint32 v = r.y1 * 65536; for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) { @@ -577,7 +496,7 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) dstPtr[1] = *(srcPtr+(u>>16) * srcBPP + 1); dstPtr[2] = *(srcPtr+(u>>16) * srcBPP + 2); dstPtr-=dstPitch; - + u += stepU; } v += stepV; @@ -599,26 +518,26 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) } } } - + break; } - + case 32: { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); @@ -646,16 +565,16 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) *(dstPtr-=(dstPitch>>2)) = *srcPtr++; } } - + break; } - + default: fprintf(stderr, "SDL: Unsupported color depth for requested orientation"); exit(2); } - - SDL_UnlockSurface(theSurface); + + SDL_UnlockSurface(theSurface); break; } @@ -663,25 +582,25 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) { if (SDL_LockSurface(theSurface) < 0) return; - + switch (temporaryBufferBPP) { case 16: - { + { pp_uint32 srcPitch = temporaryBufferPitch >> 1; pp_uint32 dstPitch = theSurface->pitch >> 1; - - pp_uint16* src = (pp_uint16*)temporaryBuffer; + + pp_uint16* src = (pp_uint16*)temporaryBuffer; pp_uint16* dst = (pp_uint16*)theSurface->pixels; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); - + pp_uint32 v = r.y1 * 65536; for (pp_uint32 y = destRect.y1; y < destRect.y2; y++) { @@ -691,7 +610,7 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) for (pp_uint32 x = destRect.x1; x < destRect.x2; x++) { *(dstPtr+=dstPitch) = *(srcPtr+(u>>16)); - + u += stepU; } v += stepV; @@ -707,26 +626,26 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) *(dstPtr+=dstPitch) = *srcPtr++; } } - + break; } - + case 24: { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); @@ -764,26 +683,26 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) } } } - + break; } - + case 32: { pp_uint32 srcPitch = temporaryBufferPitch; pp_uint32 dstPitch = theSurface->pitch; - - pp_uint8* src = (pp_uint8*)temporaryBuffer; + + pp_uint8* src = (pp_uint8*)temporaryBuffer; pp_uint8* dst = (pp_uint8*)theSurface->pixels; - + const pp_uint32 srcBPP = temporaryBufferBPP/8; const pp_uint32 dstBPP = theSurface->format->BytesPerPixel; - + if (scaleFactor != 1) { - PPRect destRect(r); + PPRect destRect(r); destRect.scale(scaleFactor); - + const pp_uint32 stepU = (r.x2 - r.x1) * 65536 / (destRect.x2 - destRect.x1); const pp_uint32 stepV = (r.y2 - r.y1) * 65536 / (destRect.y2 - destRect.y1); @@ -811,10 +730,10 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) *(dstPtr+=(dstPitch>>2)) = *srcPtr++; } } - + break; } - + default: fprintf(stderr, "SDL: Unsupported color depth for requested orientation"); exit(EXIT_FAILURE); @@ -824,9 +743,9 @@ void PPDisplayDeviceFB::postProcess(const PPRect& r2) break; } } - + } -#if SDL_VERSION_ATLEAST(2, 0, 0) + // This is unused at the moment, could be useful if we manage to get the GUI resizable in the future. void PPDisplayDeviceFB::setSize(const PPSize& size) { @@ -835,4 +754,3 @@ void PPDisplayDeviceFB::setSize(const PPSize& size) theTexture = SDL_CreateTextureFromSurface(theRenderer, theSurface); theRenderer = SDL_GetRenderer(theWindow); } -#endif diff --git a/src/ppui/sdl/DisplayDeviceFB_SDL.h b/src/ppui/sdl/DisplayDeviceFB_SDL.h index 140460a9..7b7c9c3d 100644 --- a/src/ppui/sdl/DisplayDeviceFB_SDL.h +++ b/src/ppui/sdl/DisplayDeviceFB_SDL.h @@ -33,10 +33,6 @@ #include "DisplayDevice_SDL.h" -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 2 -#endif - class PPDisplayDeviceFB : public PPDisplayDevice { private: @@ -47,27 +43,21 @@ class PPDisplayDeviceFB : public PPDisplayDevice SDL_Color palette[256]; // used for rotating coordinates etc. - void postProcess(const PPRect& r); + void swap(const PPRect& r); public: - PPDisplayDeviceFB( -#if !SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Surface*& screen, -#endif - pp_int32 width, - pp_int32 height, + PPDisplayDeviceFB(pp_int32 width, + pp_int32 height, pp_int32 scaleFactor, - pp_int32 bpp, + pp_int32 bpp, bool fullScreen, - Orientations theOrientation = ORIENTATION_NORMAL, + Orientations theOrientation = ORIENTATION_NORMAL, bool swapRedBlue = false); - + virtual ~PPDisplayDeviceFB(); virtual bool supportsScaling() const { return true; } -#if SDL_VERSION_ATLEAST(2, 0, 0) virtual void setSize(const PPSize& size); -#endif virtual void setPalette(PPColor * palette); virtual PPGraphicsAbstract* open(); @@ -75,12 +65,10 @@ class PPDisplayDeviceFB : public PPDisplayDevice void update(); void update(const PPRect& r); -#if SDL_VERSION_ATLEAST(2, 0, 0) protected: SDL_Surface* theSurface; SDL_Texture* theTexture; SDL_Renderer* theRenderer; -#endif }; #endif diff --git a/src/ppui/sdl/DisplayDevice_SDL.cpp b/src/ppui/sdl/DisplayDevice_SDL.cpp index 33b16f7d..a4b966cf 100644 --- a/src/ppui/sdl/DisplayDevice_SDL.cpp +++ b/src/ppui/sdl/DisplayDevice_SDL.cpp @@ -23,7 +23,6 @@ #include "DisplayDevice_SDL.h" #include "Graphics.h" -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_Window* PPDisplayDevice::CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags) { size_t namelen = 0; @@ -59,9 +58,9 @@ SDL_Window* PPDisplayDevice::CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bp w = getDefaultWidth(); h = getDefaultHeight(); - + theWindow = SDL_CreateWindow("MilkyTracker", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_OPENGL | flags); - + if (theWindow == NULL) { fprintf(stderr, "SDL: SDL_CreateWindow (width: %d, height: %d) failed: %s\n", w, h, SDL_GetError()); @@ -72,7 +71,7 @@ SDL_Window* PPDisplayDevice::CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bp SDL_GLContext ctx = SDL_GL_CreateContext(theWindow); SDL_GL_MakeCurrent(theWindow, ctx); - + glGetStringAPI = (PFNGLGETSTRINGPROC)SDL_GL_GetProcAddress("glGetString"); fprintf(stdout, "Available Renderers: %s\n", rendername); @@ -91,47 +90,12 @@ SDL_Window* PPDisplayDevice::CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bp return theWindow; } -#else -SDL_Surface* PPDisplayDevice::CreateScreen(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags) -{ - SDL_Surface *screen; - - printf("%ld %ld %ld %ld\n", w, h, bpp, flags); - - /* Set the video mode */ - screen = SDL_SetVideoMode(w, h, bpp, flags); - if (screen == NULL) - { - fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError()); - fprintf(stderr, "Retrying with default size..."); - w = getDefaultWidth(); - h = getDefaultHeight(); - - screen = SDL_SetVideoMode(w, h, bpp, flags); - - if (screen == NULL) - { - fprintf(stderr, "Couldn't set display mode: %s\n", SDL_GetError()); - fprintf(stderr, "Giving up."); - - return NULL; - } - } - - return screen; -} -#endif - -PPDisplayDevice::PPDisplayDevice( -#if !SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Surface*& screen, -#endif - pp_int32 width, - pp_int32 height, +PPDisplayDevice::PPDisplayDevice(pp_int32 width, + pp_int32 height, pp_int32 scaleFactor, pp_int32 bpp, - bool fullScreen, + bool fullScreen, Orientations theOrientation/* = ORIENTATION_NORMAL*/) : PPDisplayDeviceBase(width, height, scaleFactor), realWidth(width), realHeight(height), @@ -141,14 +105,13 @@ PPDisplayDevice::PPDisplayDevice( bFullScreen = fullScreen; -#if SDL_VERSION_ATLEAST(2, 0, 0) drv_index = -1; -#endif + initMousePointers(); } PPDisplayDevice::~PPDisplayDevice() -{ +{ delete currentGraphics; } @@ -158,7 +121,7 @@ void PPDisplayDevice::adjust(pp_int32& x, pp_int32& y) { case ORIENTATION_NORMAL: break; - + case ORIENTATION_ROTATE90CCW: case ORIENTATION_ROTATE90CW: { @@ -167,8 +130,8 @@ void PPDisplayDevice::adjust(pp_int32& x, pp_int32& y) y = h; break; } - } - + } + x *= scaleFactor; y *= scaleFactor; } @@ -181,13 +144,13 @@ void PPDisplayDevice::transform(pp_int32& x, pp_int32& y) { case ORIENTATION_NORMAL: break; - + case ORIENTATION_ROTATE90CW: h = x; x = y; y = realWidth - 1 - h; break; - + case ORIENTATION_ROTATE90CCW: h = x; x = realHeight - 1 - y; @@ -204,13 +167,13 @@ void PPDisplayDevice::transformInverse(pp_int32& x, pp_int32& y) { case ORIENTATION_NORMAL: break; - + case ORIENTATION_ROTATE90CW: h = x; x = realWidth - y; y = h; break; - + case ORIENTATION_ROTATE90CCW: h = x; x = y; @@ -221,68 +184,52 @@ void PPDisplayDevice::transformInverse(pp_int32& x, pp_int32& y) void PPDisplayDevice::transformInverse(PPRect& r) { - transformInverse((pp_int32&)r.x1, (pp_int32&)r.y1); - transformInverse((pp_int32&)r.x2, (pp_int32&)r.y2); + transformInverse((pp_int32&)r.x1, (pp_int32&)r.y1); + transformInverse((pp_int32&)r.x2, (pp_int32&)r.y2); pp_int32 h; if (r.x2 < r.x1) { h = r.x1; r.x1 = r.x2; r.x2 = h; - } + } if (r.y2 < r.y1) { h = r.y1; r.y1 = r.y2; r.y2 = h; - } + } } void PPDisplayDevice::setTitle(const PPSystemString& title) { -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_SetWindowTitle(theWindow, title); -#else - SDL_WM_SetCaption(title, "MilkyTracker"); -#endif -} - -#if !SDL_VERSION_ATLEAST(2, 0, 0) -void PPDisplayDevice::setSize(const PPSize& size) -{ - theSurface = SDL_SetVideoMode(size.width, size.height, theSurface->format->BitsPerPixel, theSurface->flags); } -#endif bool PPDisplayDevice::goFullScreen(bool b) { // In X11, this will make MilkyTracker go fullscreen at the selected // resolution. -#if SDL_VERSION_ATLEAST(2, 0, 0) - if (SDL_SetWindowFullscreen(theWindow, (!b)?SDL_FALSE:SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) + + if (!b && (SDL_SetWindowFullscreen(theWindow, SDL_FALSE) == 0)) { - bFullScreen = b; + bFullScreen = false; return true; } -#else - SDL_Surface* screen = SDL_GetVideoSurface(); - if (SDL_WM_ToggleFullScreen(screen)) + + else if (b && (SDL_SetWindowFullscreen(theWindow, SDL_WINDOW_FULLSCREEN_DESKTOP) == 0)) { - bFullScreen = !bFullScreen; + bFullScreen = true; return true; } -#endif - + return false; } -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_Window* PPDisplayDevice::getWindow() { return theWindow; } -#endif // Defined in main.cpp void exitSDLEventLoop(bool serializedEventInvoked = true); -#if SDL_VERSION_ATLEAST(2, 0, 0) PPSize PPDisplayDevice::getDisplayResolution() const { // Find the monitor MilkyTracker is being displayed on int currentDisplay = SDL_GetWindowDisplayIndex(theWindow); @@ -297,7 +244,6 @@ PPSize PPDisplayDevice::getDisplayResolution() const { // Return the desktop size return PPSize(displayMode.w, displayMode.h); } -#endif void PPDisplayDevice::shutDown() { @@ -307,26 +253,18 @@ void PPDisplayDevice::shutDown() void PPDisplayDevice::setMouseCursor(MouseCursorTypes type) { currentCursorType = type; - + switch (type) { case MouseCursorTypeStandard: SDL_SetCursor(cursorStandard); break; -#if SDL_VERSION_ATLEAST(2, 0, 0) + case MouseCursorTypeResizeLeft: case MouseCursorTypeResizeRight: SDL_SetCursor(cursorResizeHoriz); break; -#else - case MouseCursorTypeResizeLeft: - SDL_SetCursor(cursorResizeLeft); - break; - - case MouseCursorTypeResizeRight: - SDL_SetCursor(cursorResizeRight); - break; -#endif + case MouseCursorTypeHand: SDL_SetCursor(cursorHand); break; @@ -342,7 +280,6 @@ void PPDisplayDevice::signalWaitState(bool b, const PPColor& color) setMouseCursor(b ? MouseCursorTypeWait : MouseCursorTypeStandard); } -#if SDL_VERSION_ATLEAST(2, 0, 0) void PPDisplayDevice::initMousePointers() { cursorStandard = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW); @@ -350,27 +287,3 @@ void PPDisplayDevice::initMousePointers() cursorEggtimer = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_WAIT); cursorHand = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); } -#else -// Mouse pointer data -Uint8 PPDisplayDevice::resizeLeft_data[] = { 0, 0, 96, 0, 97, 128, 99, 0, 102, 0, 108, 0, 120, 0, 127, 254, 120, 0, 124, 0, 102, 0, 99, 0, 97, 128, 96, 0, 0, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeLeft_mask[] = { 240, 0, 241, 128, 243, 192, 247, 128, 255, 0, 254, 0, 255, 255, 255, 255, 255, 255, 254, 0, 255, 0, 247, 128, 243, 192, 241, 128, 240, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeRight_data[] = { 0, 0, 0, 6, 1, 134, 0, 198, 0, 102, 0, 54, 0, 30, 127, 254, 0, 30, 0, 62, 0, 102, 0, 198, 1, 134, 0, 6, 0, 0, 0, 0 }; -Uint8 PPDisplayDevice::resizeRight_mask[] = { 0, 15, 1, 143, 3, 207, 1, 239, 0, 255, 0, 127, 255, 255, 255, 255, 255, 255, 0, 127, 0, 255, 1, 239, 3, 207, 1, 143, 0, 15, 0, 0, }; -Uint8 PPDisplayDevice::eggtimer_data[] = { 0, 0, 127, 192, 32, 128, 32, 128, 17, 0, 17, 0, 10, 0, 4, 0, 4, 0, 10, 0, 17, 0, 17, 0, 32, 128, 32, 128, 127, 192, 0, 0 }; -Uint8 PPDisplayDevice::eggtimer_mask[] = { 255, 224, 255, 224, 127, 192, 127, 192, 63, 128, 63, 128, 31, 0, 14, 0, 14, 0, 31, 0, 63, 128, 63, 128, 127, 192, 127, 192, 255, 224, 255, 224 }; -Uint8 PPDisplayDevice::hand_data[] = {54, 192, 91, 64, 146, 64, 146, 112, 146, 104, 146, 104, 128, 40, 128, 40, 128, 8, 128, 8, 128, 16, 64, 16, 64, 32, 32, 32, 31, 192, 0, 0, }; -Uint8 PPDisplayDevice::hand_mask[] = {54, 192, 127, 192, 255, 192, 255, 240, 255, 248, 255, 248, 255, 248, 255, 248, 255, 248, 255, 248, 255, 240, 127, 240, 127, 224, 63, 224, 31, 192, 0, 0, }; - -void PPDisplayDevice::initMousePointers() -{ - cursorResizeLeft = SDL_CreateCursor(resizeLeft_data, resizeLeft_mask, 16, 16, 2, 7); - cursorResizeRight = SDL_CreateCursor(resizeRight_data, resizeRight_mask, 16, 16, 13, 7); - cursorEggtimer = SDL_CreateCursor(eggtimer_data, eggtimer_mask, 16, 16, 5, 7); - cursorHand = SDL_CreateCursor(hand_data, hand_mask, 16, 16, 5, 5); - - // The current cursor is used as the standard cursor; - // This might cause problems if the system if displaying some other cursor at - // the time, or it might not. It depends. - cursorStandard = SDL_GetCursor(); -} -#endif diff --git a/src/ppui/sdl/DisplayDevice_SDL.h b/src/ppui/sdl/DisplayDevice_SDL.h index da59a03d..aa6967cb 100644 --- a/src/ppui/sdl/DisplayDevice_SDL.h +++ b/src/ppui/sdl/DisplayDevice_SDL.h @@ -32,11 +32,9 @@ #include "DisplayDeviceBase.h" #include -#if SDL_VERSION_ATLEAST(2, 0, 0) #include typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); -#endif // Forwards class PPGraphicsAbstract; @@ -54,65 +52,44 @@ class PPDisplayDevice : public PPDisplayDeviceBase protected: pp_int32 realWidth, realHeight; - Orientations orientation; -#if SDL_VERSION_ATLEAST(2, 0, 0) SDL_Window* theWindow; + Orientations orientation; int drv_index; - + SDL_Window* CreateWindow(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags); - SDL_Cursor *cursorStandard, *cursorResizeHoriz, *cursorEggtimer, *cursorHand; -#else - SDL_Surface* theSurface; - SDL_Surface* CreateScreen(pp_int32& w, pp_int32& h, pp_int32& bpp, Uint32 flags); - SDL_Cursor *cursorStandard, *cursorResizeLeft, *cursorResizeRight, *cursorEggtimer, *cursorHand; - static Uint8 resizeLeft_data[], resizeLeft_mask[]; - static Uint8 resizeRight_data[], resizeRight_mask[]; - static Uint8 eggtimer_data[], eggtimer_mask[]; - static Uint8 hand_data[], hand_mask[]; -#endif // used for rotating coordinates etc. void adjust(pp_int32& x, pp_int32& y); // Mouse pointers + SDL_Cursor *cursorStandard, *cursorResizeHoriz, *cursorEggtimer, *cursorHand; void initMousePointers(); public: - PPDisplayDevice( -#if !SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Surface*& screen, -#endif - pp_int32 width, - pp_int32 height, + PPDisplayDevice(pp_int32 width, + pp_int32 height, pp_int32 scaleFactor, - pp_int32 bpp, + pp_int32 bpp, bool fullScreen, Orientations theOrientation = ORIENTATION_NORMAL); - + virtual ~PPDisplayDevice(); -#if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_Window* getWindow(); - virtual PPSize getDisplayResolution() const; -#else - virtual void setSize(const PPSize& size); -#endif + void transform(pp_int32& x, pp_int32& y); void transformInverse(pp_int32& x, pp_int32& y); void transformInverse(PPRect& r); Orientations getOrientation() { return orientation; } + + SDL_Window* getWindow(); // ----------------------------- ex. PPWindow ---------------------------- - virtual void setTitle(const PPSystemString& title); + virtual void setTitle(const PPSystemString& title); virtual bool goFullScreen(bool b); - + virtual PPSize getDisplayResolution() const; virtual void shutDown(); virtual void signalWaitState(bool b, const PPColor& color); virtual void setMouseCursor(MouseCursorTypes type); - -#if defined(AMIGA_SAGA_PIP) - virtual void setSAGAPiPSize() = 0; -#endif }; #endif diff --git a/src/tracker/sdl/SDL_Main.cpp b/src/tracker/sdl/SDL_Main.cpp index 0182b46c..f496567a 100644 --- a/src/tracker/sdl/SDL_Main.cpp +++ b/src/tracker/sdl/SDL_Main.cpp @@ -84,8 +84,7 @@ #endif // -------------------------------------------------------------------------- -#ifdef AMIGA -SDL_Surface* screen = NULL; +#ifdef __AMIGA__ static #endif SDL_TimerID timer; diff --git a/src/tracker/version.h b/src/tracker/version.h deleted file mode 100644 index 45904e55..00000000 --- a/src/tracker/version.h +++ /dev/null @@ -1,5 +0,0 @@ -// 0xXYYZZ = X.YY.ZZ -const int MILKYTRACKER_VERSION = 0x10000; -// Version string restricted to 20 chars for XM export! -const char MILKYTRACKER_VERSION_STRING[] = "MilkyTracker 1.0.0"; -// 012345678901234567890