Compare commits

...

22 Commits
ddg ... master

Author SHA1 Message Date
Amaryllis Kulla 2e82b87972 README: Update soundfont link 2023-10-05 21:27:15 +02:00
Amaryllis Kulla dff2a12022 README: Update links 2023-10-05 21:27:15 +02:00
Amaryllis Kulla 9c6d727152 README: Point binary links at mapleshrine.eu 2023-10-05 21:27:15 +02:00
Amaryllis Kulla ab24f0fc74 Update copyright notice again
Keep information on first file creation year,
and update my email address yet again.
2023-10-05 21:27:15 +02:00
Amaryllis Kulla 8bdbef1137 Add bash-friendly source file listings 2022-02-01 22:03:48 +01:00
Amaryllis Kulla 985cf1ad4b doc: Add MKXP.mouse_in_window 2022-02-01 21:56:24 +01:00
Amaryllis Kulla a651639524 Bitmap: Add #v_flip / #h_flip methods 2022-02-01 21:53:26 +01:00
Amaryllis Kulla 1c2dc115b8 Graphics: Reset scissor box on screen resize
Fixes Ancurio/mkxp#248.
2022-02-01 21:53:26 +01:00
Amaryllis Kulla 3c6bc765c6 EThread: Map mouse buttons 8,9 onto X1,X2
This makes the thumb button on my mouse usable under Linux,
still have to check what button code they map to under Windows.
2022-02-01 21:53:26 +01:00
Amaryllis Kulla d71919c2c3 Bitmap: Fix getPixel calls not using cached surface 2022-02-01 21:53:26 +01:00
Amaryllis Kulla e156421b3b Input: Expose mouse X1 and X2 buttons 2022-02-01 21:53:23 +01:00
Amaryllis Kulla 5d38b1f813 doc: Add MKXP.data_directory 2021-12-07 07:21:34 +01:00
Amaryllis Kulla 8fa94c0390 Add documentation for dancing dragon extensions 2021-12-07 07:21:34 +01:00
Amaryllis Kulla 1856e677a3 Bitmap: Add ::writeToPng() 2021-12-07 07:21:33 +01:00
Amaryllis Kulla a92adee7f8 EventThread: Add 'recenter' parameter to window resize request
If true, centers the window on the current screen with the
new size.
2021-12-07 07:21:33 +01:00
Amaryllis Kulla d09fec941b Add Graphics#resize_window
Does what you would expect. Arguments are not bound-checked!
2021-12-07 07:21:33 +01:00
Amaryllis Kulla 94009441be Graphics::resizeScreen(): Remove upper bound 2021-12-07 07:21:33 +01:00
Amaryllis Kulla e32aa71f4b Add Input::scrollV() to query vertical mouse wheel scroll events 2021-12-07 07:21:33 +01:00
Amaryllis Kulla e2bbcde85d MRI-Binding: Expose integer scaling related attributes 2021-12-07 07:15:18 +01:00
Amaryllis Kulla 9cadb91ed1 Graphics: Implement native integer scaling 2021-12-07 07:15:18 +01:00
Amaryllis Kulla f6db7be538 Config: Add integer scaling options 2021-12-07 07:15:18 +01:00
Amaryllis Kulla ca71e6ecb7 windows: Mark app as high-dpi aware 2021-12-07 07:15:18 +01:00
156 changed files with 814 additions and 188 deletions

View File

@ -1,16 +1,16 @@
# mkxp
Read: [Future of mkxp](https://gist.github.com/Ancurio/fc568571eaf7dd62c550dc3a08c0d08f)
Official discord community: https://discord.gg/A8xHE8P
Discord community: https://discord.gg/A8xHE8P
Matrix space: https://matrix.to/#/#mkxp:mapleshrine.eu
Further links: https://mapleshrine.eu
mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
It is licensed under the GNU General Public License v2+.
## Prebuilt binaries
[**Linux (32bit/64bit)**](http://ancurio.bplaced.net/mkxp/generic/)
[**Linux / Windows**](https://www.mapleshrine.eu/releases/)
[**OSX**](https://app.box.com/mkxpmacbuilds) by Ali
[**Windows (mingw-w64 32bit)**](http://ancurio.bplaced.net/mkxp/mingw32/)
## Should I use mkxp
mkxp primarily targets technically versed users that are comfortable with Ruby / RGSS, and ideally know how to compile the project themselves. The reason for this is that for most games, due to Win32-API usage, mkxp is simply not a plug-and-play solution, but a building block with which a fully cross-platform version can be created in time.
@ -89,7 +89,7 @@ To run mkxp, you should have a graphics card capable of at least **OpenGL (ES) 2
## Dependency kit
To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://www.dropbox.com/s/mtp44ur367m2zts/mkxp-depkit.tar.xz). Read the "README" for instructions.
To facilitate hacking, I have assembled a package containing all dependencies to compile mkxp on a bare-bones Ubuntu 12.04 64bit installation. Compatibility with other distributions has not been tested. You can download it [here](https://mapleshrine.eu/depkits/linux64.tar.xz). Read the "README" for instructions.
## Configuration
@ -105,7 +105,7 @@ Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
You can use this public domain soundfont: [GMGSx.sf2](https://www.dropbox.com/s/qxdvoxxcexsvn43/GMGSx.sf2?dl=0)
You can use this public domain soundfont: [GMGSx.sf2](https://mapleshrine.eu/unsorted/GMGSx.sf2)
## Fonts

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -433,6 +433,40 @@ RB_METHOD(bitmapInitializeCopy)
return self;
}
RB_METHOD(bitmapWriteToPng)
{
Bitmap *b = getPrivateData<Bitmap>(self);
const char *filename;
rb_get_args(argc, argv, "z", &filename RB_ARG_END);
b->writeToPng(filename);
return self;
}
RB_METHOD(bitmapVFlip)
{
RB_UNUSED_PARAM;
Bitmap *b = getPrivateData<Bitmap>(self);
b->vFlip();
return Qnil;
}
RB_METHOD(bitmapHFlip)
{
RB_UNUSED_PARAM;
Bitmap *b = getPrivateData<Bitmap>(self);
b->hFlip();
return Qnil;
}
void
bitmapBindingInit()
@ -466,5 +500,9 @@ bitmapBindingInit()
_rb_define_method(klass, "radial_blur", bitmapRadialBlur);
}
_rb_define_method(klass, "write_to_png", bitmapWriteToPng);
_rb_define_method(klass, "v_flip", bitmapVFlip);
_rb_define_method(klass, "h_flip", bitmapHFlip);
INIT_PROP_BIND(Bitmap, Font, "font");
}

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@
*/
#include "graphics.h"
#include "eventthread.h"
#include "sharedstate.h"
#include "binding-util.h"
#include "binding-types.h"
@ -195,6 +196,19 @@ RB_METHOD(graphicsPlayMovie)
return Qnil;
}
RB_METHOD(graphicsResizeWindow)
{
RB_UNUSED_PARAM;
int width, height;
bool recenter = false;
rb_get_args(argc, argv, "ii|b", &width, &height, &recenter RB_ARG_END);
shState->eThread().requestWindowResize(width, height, recenter);
return Qnil;
}
DEF_GRA_PROP_I(FrameRate)
DEF_GRA_PROP_I(FrameCount)
DEF_GRA_PROP_I(Brightness)
@ -203,6 +217,9 @@ DEF_GRA_PROP_B(Fullscreen)
DEF_GRA_PROP_B(ShowCursor)
DEF_GRA_PROP_B(FixedAspectRatio)
DEF_GRA_PROP_B(SmoothScaling)
DEF_GRA_PROP_B(IntegerScaling)
DEF_GRA_PROP_B(LastMileScaling)
#define INIT_GRA_PROP_BIND(PropName, prop_name_s) \
{ \
@ -225,6 +242,9 @@ void graphicsBindingInit()
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
INIT_GRA_PROP_BIND( FixedAspectRatio, "fixed_aspect_ratio" );
INIT_GRA_PROP_BIND( SmoothScaling, "smooth_scaling" );
INIT_GRA_PROP_BIND( IntegerScaling, "integer_scaling" );
INIT_GRA_PROP_BIND( LastMileScaling, "last_mile_scaling" );
if (rgssVer >= 2)
{
@ -246,4 +266,6 @@ void graphicsBindingInit()
INIT_GRA_PROP_BIND( Fullscreen, "fullscreen" );
INIT_GRA_PROP_BIND( ShowCursor, "show_cursor" );
_rb_define_module_function(module, "resize_window", graphicsResizeWindow);
}

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -115,6 +115,13 @@ RB_METHOD(inputMouseY)
return rb_fix_new(shState->input().mouseY());
}
RB_METHOD(inputScrollV)
{
RB_UNUSED_PARAM;
return rb_fix_new(shState->input().scrollV());
}
struct
{
@ -149,7 +156,9 @@ static buttonCodes[] =
{ "MOUSELEFT", Input::MouseLeft },
{ "MOUSEMIDDLE", Input::MouseMiddle },
{ "MOUSERIGHT", Input::MouseRight }
{ "MOUSERIGHT", Input::MouseRight },
{ "MOUSEX1", Input::MouseX1 },
{ "MOUSEX2", Input::MouseX2 }
};
static elementsN(buttonCodes);
@ -168,6 +177,7 @@ inputBindingInit()
_rb_define_module_function(module, "mouse_x", inputMouseX);
_rb_define_module_function(module, "mouse_y", inputMouseY);
_rb_define_module_function(module, "scroll_v", inputScrollV);
if (rgssVer >= 3)
{

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

64
doc/SDL_scancode_map.rb Normal file
View File

@ -0,0 +1,64 @@
SDL = {
:UNKNOWN => 0x00,
:A => 0x04, :B => 0x05, :C => 0x06, :D => 0x07,
:E => 0x08, :F => 0x09, :G => 0x0A, :H => 0x0B,
:I => 0x0C, :J => 0x0D, :K => 0x0E, :L => 0x0F,
:M => 0x10, :N => 0x11, :O => 0x12, :P => 0x13,
:Q => 0x14, :R => 0x15, :S => 0x16, :T => 0x17,
:U => 0x18, :V => 0x19, :W => 0x1A, :X => 0x1B,
:Y => 0x1C, :Z => 0x1D, :N1 => 0x1E, :N2 => 0x1F,
:N3 => 0x20, :N4 => 0x21, :N5 => 0x22, :N6 => 0x23,
:N7 => 0x24, :N8 => 0x25, :N9 => 0x26, :N0 => 0x27,
:RETURN => 0x28, :ESCAPE => 0x29, :BACKSPACE => 0x2A, :TAB => 0x2B,
:SPACE => 0x2C, :MINUS => 0x2D, :EQUALS => 0x2E, :LEFTBRACKET => 0x2F,
:RIGHTBRACKET => 0x30, :BACKSLASH => 0x31, :NONUSHASH => 0x32, :SEMICOLON => 0x33,
:APOSTROPHE => 0x34, :GRAVE => 0x35, :COMMA => 0x36, :PERIOD => 0x37,
:SLASH => 0x38, :CAPSLOCK => 0x39, :F1 => 0x3A, :F2 => 0x3B,
:F3 => 0x3C, :F4 => 0x3D, :F5 => 0x3E, :F6 => 0x3F,
:F7 => 0x40, :F8 => 0x41, :F9 => 0x42, :F10 => 0x43,
:F11 => 0x44, :F12 => 0x45, :PRINTSCREEN => 0x46, :SCROLLLOCK => 0x47,
:PAUSE => 0x48, :INSERT => 0x49, :HOME => 0x4A, :PAGEUP => 0x4B,
:DELETE => 0x4C, :END => 0x4D, :PAGEDOWN => 0x4E, :RIGHT => 0x4F,
:LEFT => 0x50, :DOWN => 0x51, :UP => 0x52, :NUMLOCKCLEAR => 0x53,
:KP_DIVIDE => 0x54, :KP_MULTIPLY => 0x55, :KP_MINUS => 0x56, :KP_PLUS => 0x57,
:KP_ENTER => 0x58, :KP_1 => 0x59, :KP_2 => 0x5A, :KP_3 => 0x5B,
:KP_4 => 0x5C, :KP_5 => 0x5D, :KP_6 => 0x5E, :KP_7 => 0x5F,
:KP_8 => 0x60, :KP_9 => 0x61, :KP_0 => 0x62, :KP_PERIOD => 0x63,
:NONUSBACKSLASH => 0x64, :APPLICATION => 0x65, :POWER => 0x66, :KP_EQUALS => 0x67,
:F13 => 0x68, :F14 => 0x69, :F15 => 0x6A, :F16 => 0x6B,
:F17 => 0x6C, :F18 => 0x6D, :F19 => 0x6E, :F20 => 0x6F,
:F21 => 0x70, :F22 => 0x71, :F23 => 0x72, :F24 => 0x73,
:EXECUTE => 0x74, :HELP => 0x75, :MENU => 0x76, :SELECT => 0x77,
:STOP => 0x78, :AGAIN => 0x79, :UNDO => 0x7A, :CUT => 0x7B,
:COPY => 0x7C, :PASTE => 0x7D, :FIND => 0x7E, :MUTE => 0x7F,
:VOLUMEUP => 0x80, :VOLUMEDOWN => 0x81, :LOCKINGCAPSLOCK => 0x82, :LOCKINGNUMLOCK => 0x83,
:LOCKINGSCROLLLOCK => 0x84, :KP_COMMA => 0x85, :KP_EQUALSAS400 => 0x86, :INTERNATIONAL1 => 0x87,
:INTERNATIONAL2 => 0x88, :INTERNATIONAL3 => 0x89, :INTERNATIONAL4 => 0x8A, :INTERNATIONAL5 => 0x8B,
:INTERNATIONAL6 => 0x8C, :INTERNATIONAL7 => 0x8D, :INTERNATIONAL8 => 0x8E, :INTERNATIONAL9 => 0x8F,
:LANG1 => 0x90, :LANG2 => 0x91, :LANG3 => 0x92, :LANG4 => 0x93,
:LANG5 => 0x94, :LANG6 => 0x95, :LANG7 => 0x96, :LANG8 => 0x97,
:LANG9 => 0x98, :ALTERASE => 0x99, :SYSREQ => 0x9A, :CANCEL => 0x9B,
:CLEAR => 0x9C, :PRIOR => 0x9D, :RETURN2 => 0x9E, :SEPARATOR => 0x9F,
:OUT => 0xA0, :OPER => 0xA1, :CLEARAGAIN => 0xA2, :CRSEL => 0xA3,
:EXSEL => 0xA4, :KP_00 => 0xB0, :KP_000 => 0xB1, :THOUSANDSSEPARATOR => 0xB2,
:DECIMALSEPARATOR => 0xB3, :CURRENCYUNIT => 0xB4, :CURRENCYSUBUNIT => 0xB5, :KP_LEFTPAREN => 0xB6,
:KP_RIGHTPAREN => 0xB7, :KP_LEFTBRACE => 0xB8, :KP_RIGHTBRACE => 0xB9, :KP_TAB => 0xBA,
:KP_BACKSPACE => 0xBB, :KP_A => 0xBC, :KP_B => 0xBD, :KP_C => 0xBE,
:KP_D => 0xBF, :KP_E => 0xC0, :KP_F => 0xC1, :KP_XOR => 0xC2,
:KP_POWER => 0xC3, :KP_PERCENT => 0xC4, :KP_LESS => 0xC5, :KP_GREATER => 0xC6,
:KP_AMPERSAND => 0xC7, :KP_DBLAMPERSAND => 0xC8, :KP_VERTICALBAR => 0xC9, :KP_DBLVERTICALBAR => 0xCA,
:KP_COLON => 0xCB, :KP_HASH => 0xCC, :KP_SPACE => 0xCD, :KP_AT => 0xCE,
:KP_EXCLAM => 0xCF, :KP_MEMSTORE => 0xD0, :KP_MEMRECALL => 0xD1, :KP_MEMCLEAR => 0xD2,
:KP_MEMADD => 0xD3, :KP_MEMSUBTRACT => 0xD4, :KP_MEMMULTIPLY => 0xD5, :KP_MEMDIVIDE => 0xD6,
:KP_PLUSMINUS => 0xD7, :KP_CLEAR => 0xD8, :KP_CLEARENTRY => 0xD9, :KP_BINARY => 0xDA,
:KP_OCTAL => 0xDB, :KP_DECIMAL => 0xDC, :KP_HEXADECIMAL => 0xDD, :LCTRL => 0xE0,
:LSHIFT => 0xE1, :LALT => 0xE2, :LGUI => 0xE3, :RCTRL => 0xE4,
:RSHIFT => 0xE5, :RALT => 0xE6, :RGUI => 0xE7, :MODE => 0x101,
:AUDIONEXT => 0x102, :AUDIOPREV => 0x103, :AUDIOSTOP => 0x104, :AUDIOPLAY => 0x105,
:AUDIOMUTE => 0x106, :MEDIASELECT => 0x107, :WWW => 0x108, :MAIL => 0x109,
:CALCULATOR => 0x10A, :COMPUTER => 0x10B, :AC_SEARCH => 0x10C, :AC_HOME => 0x10D,
:AC_BACK => 0x10E, :AC_FORWARD => 0x10F, :AC_STOP => 0x110, :AC_REFRESH => 0x111,
:AC_BOOKMARKS => 0x112, :BRIGHTNESSDOWN => 0x113, :BRIGHTNESSUP => 0x114, :DISPLAYSWITCH => 0x115,
:KBDILLUMTOGGLE => 0x116, :KBDILLUMDOWN => 0x117, :KBDILLUMUP => 0x118, :EJECT => 0x119,
:SLEEP => 0x11A, :APP1 => 0x11B, :APP2 => 0x11C,
}

48
doc/extension_doc.md Normal file
View File

@ -0,0 +1,48 @@
# mkxp extenions for Dancing Dragon Games / Symphony of War
## Graphics.resize_window(width, height, recenter)
width: Integer
height: Integer
recenter: Boolean, false by default
returns: nil
Resizes the game window to width x height. If `recenter` is **true**, also center the window on the current screen.
## Bitmap.write_to_png(filename)
filename: String
returns: self
Writes the contents of the bitmap to `filename`, in PNG format.
## Bitmap.v_flip() / .h_flip()
returns: nil
Flips the bitmap image vertically / horizontally.
## Input.scroll_v()
returns: Integer
Returns the cumulative amount of scroll events (negative if down, positive if up) inbetween the current and last `Input.update` call.
## Input::MOUSEX1 / ::MOUSEX2
These two constants representing two extra mouse buttons can be passed to the familiar #press?/#trigger?/#repeat? functions.
## MKXP.data_directory()
returns: String
Provides a PC-user-dependant, game-specific path to a writable directory, intended for save states, configuration and similar.
In `mkxp.conf`, both `dataPathOrg` and `dataPathApp` keys need to be set, otherwise it returns a generic directory shared by all mkxp games. It is recommended (though not required) to not put any spaces in the config strings.
Real life example:
```
dataPathOrg=dancingdragon
dataPathApp=skyborn
```
## MKXP.mouse_in_window()
returns: Boolean
Returns true if the mouse cursor is currently within the game window, false otherwise.
## Arbitrary key states
Use `MKXP.raw_key_states` to get the current byte array of keystates, then call `#getbyte(scancode)` with `scancode` being one of the constants defined in `SDL_scancode_map.rb`. **0** means the key is released, **1** that it is pressed.

View File

@ -150,6 +150,30 @@
# maxTextureSize=0
# Scale up the game screen by an integer amount,
# as large as the current window size allows, before
# doing any last additional scalings to fill part or
# all of the remaining window space (or none at all
# if lastMileScaling is disabled).
# If fixedAspectRatio is disabled, the integer scale
# factors in horizontal and vertical direction can differ
# depending on how much space is available, otherwise
# they are forced to the smaller of the two.
# (default: disabled)
#
# integerScaling.active = false
# When integer scaling is enabled, this option controls
# whether the scaled game screen is further scaled
# (with linear interpolation when smoothScaling is enabled)
# to fill the rest of the game window.
# Note that this option still respects fixedAspectRatio.
# (default: enabled)
#
# integerScaling.lastMileScaling = true
# Set the base path of the game to '/path/to/game'
# (default: executable directory)
#

100
sources.def Normal file
View File

@ -0,0 +1,100 @@
SOURCES=(
src/main.cpp
src/audio.cpp
src/bitmap.cpp
src/eventthread.cpp
src/filesystem.cpp
src/font.cpp
src/iniconfig.cpp
src/input.cpp
src/plane.cpp
src/scene.cpp
src/sprite.cpp
src/table.cpp
src/tilequad.cpp
src/viewport.cpp
src/window.cpp
src/texpool.cpp
src/shader.cpp
src/glstate.cpp
src/tilemap.cpp
src/autotiles.cpp
src/graphics.cpp
src/gl-debug.cpp
src/etc.cpp
src/config.cpp
src/settingsmenu.cpp
src/keybindings.cpp
src/tileatlas.cpp
src/sharedstate.cpp
src/gl-fun.cpp
src/gl-meta.cpp
src/vertex.cpp
src/soundemitter.cpp
src/sdlsoundsource.cpp
src/alstream.cpp
src/audiostream.cpp
src/rgssad.cpp
src/bundledfont.cpp
src/vorbissource.cpp
src/windowvx.cpp
src/tilemapvx.cpp
src/tileatlasvx.cpp
src/autotilesvx.cpp
src/midisource.cpp
src/fluid-fun.cpp
)
SOURCES_C=(
steamshim/steamshim_child.c
)
MRI_SOURCES=(
binding-mri/binding-mri.cpp
binding-mri/binding-util.cpp
binding-mri/table-binding.cpp
binding-mri/etc-binding.cpp
binding-mri/bitmap-binding.cpp
binding-mri/font-binding.cpp
binding-mri/graphics-binding.cpp
binding-mri/input-binding.cpp
binding-mri/sprite-binding.cpp
binding-mri/viewport-binding.cpp
binding-mri/plane-binding.cpp
binding-mri/window-binding.cpp
binding-mri/tilemap-binding.cpp
binding-mri/audio-binding.cpp
binding-mri/module_rpg.cpp
binding-mri/filesystem-binding.cpp
binding-mri/windowvx-binding.cpp
binding-mri/tilemapvx-binding.cpp
)
EMBED=(
shader/common.h
shader/transSimple.frag
shader/trans.frag
shader/hue.frag
shader/sprite.frag
shader/plane.frag
shader/gray.frag
shader/bitmapBlit.frag
shader/flatColor.frag
shader/simple.frag
shader/simpleColor.frag
shader/simpleAlpha.frag
shader/simpleAlphaUni.frag
shader/flashMap.frag
shader/minimal.vert
shader/simple.vert
shader/simpleColor.vert
shader/sprite.vert
shader/tilemap.vert
shader/blur.frag
shader/blurH.vert
shader/blurV.vert
shader/simpleMatrix.vert
shader/tilemapvx.vert
assets/liberation.ttf
assets/icon.png
)

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -245,6 +245,48 @@ struct BitmapPrivate
self->modified();
}
void downloadToSurface()
{
if (!surface)
allocSurface();
FBO::bind(gl.fbo);
glState.viewport.pushSet(IntRect(0, 0, gl.width, gl.height));
::gl.ReadPixels(0, 0, gl.width, gl.height, GL_RGBA, GL_UNSIGNED_BYTE, surface->pixels);
glState.viewport.pop();
}
void flip(const IntRect &srcRect)
{
TEXFBO newTex = shState->texPool().request(gl.width, gl.height);
SimpleShader &shader = shState->shaders().simple;
shader.bind();
shader.setTexOffsetX(0);
bindTexture(shader);
Quad &quad = shState->gpQuad();
quad.setTexPosRect(srcRect, IntRect(0, 0, gl.width, gl.height));
quad.setColor(Vec4(1, 1, 1, 1));
glState.blend.pushSet(false);
pushSetViewport(shader);
FBO::bind(newTex.fbo);
blitQuad(quad);
popViewport();
glState.blend.pop();
shState->texPool().release(gl);
gl = newTex;
onModified();
}
};
struct BitmapOpenHandler : FileSystem::OpenHandler
@ -901,17 +943,7 @@ Color Bitmap::getPixel(int x, int y) const
return Vec4();
if (!p->surface)
{
p->allocSurface();
FBO::bind(p->gl.fbo);
glState.viewport.pushSet(IntRect(0, 0, width(), height()));
gl.ReadPixels(0, 0, width(), height(), GL_RGBA, GL_UNSIGNED_BYTE, p->surface->pixels);
glState.viewport.pop();
}
p->downloadToSurface();
uint32_t pixel = getPixelAt(p->surface, p->format, x, y);
@ -1400,6 +1432,28 @@ void Bitmap::setInitFont(Font *value)
p->font = value;
}
void Bitmap::writeToPng(const char *filename)
{
p->downloadToSurface();
IMG_SavePNG(p->surface, filename);
}
void Bitmap::vFlip()
{
guardDisposed();
GUARD_MEGA;
p->flip(IntRect(0, p->gl.height, p->gl.width, -p->gl.height));
}
void Bitmap::hFlip()
{
guardDisposed();
GUARD_MEGA;
p->flip(IntRect(p->gl.width, 0, -p->gl.width, p->gl.height));
}
TEXFBO &Bitmap::getGLTypes()
{
return p->gl;

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -105,6 +105,12 @@ public:
* use at construction */
void setInitFont(Font *value);
/* extensions */
void writeToPng(const char *filename);
void vFlip();
void hFlip();
/* <internal> */
TEXFBO &getGLTypes();
SDL_Surface *megaSurface() const;

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -170,6 +170,8 @@ void Config::read(int argc, char *argv[])
PO_DESC(subImageFix, bool, false) \
PO_DESC(enableBlitting, bool, true) \
PO_DESC(maxTextureSize, int, 0) \
PO_DESC(integerScaling.active, bool, false) \
PO_DESC(integerScaling.lastMileScaling, bool, true) \
PO_DESC(gameFolder, std::string, ".") \
PO_DESC(anyAltToggleFS, bool, false) \
PO_DESC(enableReset, bool, true) \

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -59,6 +59,12 @@ struct Config
bool enableBlitting;
int maxTextureSize;
struct
{
bool active;
bool lastMileScaling;
} integerScaling;
std::string gameFolder;
bool anyAltToggleFS;
bool enableReset;

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -73,6 +73,7 @@ uint8_t EventThread::keyStates[];
EventThread::JoyState EventThread::joyState;
EventThread::MouseState EventThread::mouseState;
EventThread::TouchState EventThread::touchState;
SDL_atomic_t EventThread::verticalScrollDistance;
/* User event codes */
enum
@ -100,6 +101,36 @@ bool EventThread::allocUserEvents()
return true;
}
static void writeResizeRequest(SDL_WindowEvent &event, int w, int h, bool recenter)
{
event.data1 = w;
event.data2 = h;
event.padding3 = recenter ? 1 : 0;
}
static void handleResizeRequest(SDL_Window *win, SDL_WindowEvent &event)
{
int newWidth = event.data1;
int newHeight = event.data2;
bool recenter = event.padding3 == 1;
if (recenter)
{
int display = SDL_GetWindowDisplayIndex(win);
if (display >= 0)
{
SDL_DisplayMode dm;
SDL_GetDesktopDisplayMode(display, &dm);
int newX = (dm.w - newWidth) / 2;
int newY = (dm.h - newHeight) / 2;
SDL_SetWindowPosition(win, newX, newY);
}
}
SDL_SetWindowSize(win, newWidth, newHeight);
}
EventThread::EventThread()
: fullscreen(false),
showCursor(false)
@ -184,6 +215,9 @@ void EventThread::process(RGSSThreadData &rtData)
{
case SDL_MOUSEBUTTONDOWN :
case SDL_MOUSEBUTTONUP :
if (event.button.button == 8 || event.button.button == 9)
event.button.button -= (8 - SDL_BUTTON_X1);
case SDL_MOUSEMOTION :
if (event.button.which == SDL_TOUCH_MOUSEID)
continue;
@ -380,6 +414,11 @@ void EventThread::process(RGSSThreadData &rtData)
updateCursorState(cursorInWindow, gameScreen);
break;
case SDL_MOUSEWHEEL :
/* Only consider vertical scrolling for now */
SDL_AtomicAdd(&verticalScrollDistance, event.wheel.y);
break;
case SDL_FINGERDOWN :
i = event.tfinger.fingerId;
touchState.fingers[i].down = true;
@ -404,7 +443,7 @@ void EventThread::process(RGSSThreadData &rtData)
break;
case REQUEST_WINRESIZE :
SDL_SetWindowSize(win, event.window.data1, event.window.data2);
handleResizeRequest(win, event.window);
break;
case REQUEST_MESSAGEBOX :
@ -575,12 +614,11 @@ void EventThread::requestFullscreenMode(bool mode)
SDL_PushEvent(&event);
}
void EventThread::requestWindowResize(int width, int height)
void EventThread::requestWindowResize(int width, int height, bool recenter)
{
SDL_Event event;
event.type = usrIdStart + REQUEST_WINRESIZE;
event.window.data1 = width;
event.window.data2 = height;
writeResizeRequest(event.window, width, height, recenter);
SDL_PushEvent(&event);
}

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -31,6 +31,7 @@
#include <SDL_joystick.h>
#include <SDL_mouse.h>
#include <SDL_mutex.h>
#include <SDL_atomic.h>
#include <string>
@ -76,6 +77,7 @@ public:
static JoyState joyState;
static MouseState mouseState;
static TouchState touchState;
static SDL_atomic_t verticalScrollDistance;
static bool allocUserEvents();
@ -86,7 +88,7 @@ public:
/* Called from RGSS thread */
void requestFullscreenMode(bool mode);
void requestWindowResize(int width, int height);
void requestWindowResize(int width, int height, bool recenter = false);
void requestShowCursor(bool mode);
void requestTerminate();

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2014 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -119,7 +119,7 @@ GLState::GLState(const Config &conf)
blendMode.init(BlendNormal);
blend.init(true);
scissorTest.init(false);
scissorBox.init(IntRect(0, 0, 640, 480));
scissorBox.init(IntRect());
program.init(0);
if (conf.maxTextureSize > 0)

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -152,6 +152,7 @@ public:
pp.startRender();
glState.viewport.set(IntRect(0, 0, w, h));
glState.scissorBox.pushSet(IntRect(0, 0, w, h));
FBO::clear();
@ -166,6 +167,8 @@ public:
brightnessQuad.draw();
}
glState.scissorBox.pop();
}
void requestViewportRender(const Vec4 &c, const Vec4 &f, const Vec4 &t)
@ -477,6 +480,11 @@ struct GraphicsPrivate
TEXFBO frozenScene;
Quad screenQuad;
Vec2i integerScaleFactor;
TEXFBO integerScaleBuffer;
bool integerScaleActive;
bool integerLastMileScaling;
/* Global list of all live Disposables
* (disposed on reset) */
IntruList<Disposable> dispList;
@ -492,9 +500,18 @@ struct GraphicsPrivate
frameCount(0),
brightness(255),
fpsLimiter(frameRate),
frozen(false)
frozen(false),
integerScaleFactor(0, 0),
integerScaleActive(rtData->config.integerScaling.active),
integerLastMileScaling(rtData->config.integerScaling.lastMileScaling)
{
recalculateScreenSize(rtData);
if (integerScaleActive)
{
integerScaleFactor = Vec2i(1, 1);
rebuildIntegerScaleBuffer();
}
recalculateScreenSize(rtData->config.fixedAspectRatio);
updateScreenResoRatio(rtData);
TEXFBO::init(frozenScene);
@ -510,6 +527,7 @@ struct GraphicsPrivate
~GraphicsPrivate()
{
TEXFBO::fini(frozenScene);
TEXFBO::fini(integerScaleBuffer);
}
void updateScreenResoRatio(RGSSThreadData *rtData)
@ -522,16 +540,27 @@ struct GraphicsPrivate
}
/* Enforces fixed aspect ratio, if desired */
void recalculateScreenSize(RGSSThreadData *rtData)
void recalculateScreenSize(bool fixedAspectRatio)
{
scSize = winSize;
if (!rtData->config.fixedAspectRatio)
if (!fixedAspectRatio && integerLastMileScaling)
{
scOffset = Vec2i(0, 0);
return;
}
/* Last mile scaling disabled: just center the integer scale buffer
* inside the window space */
if (integerScaleActive && !integerLastMileScaling)
{
scOffset.x = (winSize.x - scRes.x * integerScaleFactor.x) / 2;
scOffset.y = (winSize.y - scRes.y * integerScaleFactor.y) / 2;
scSize = Vec2i(scRes.x * integerScaleFactor.x, scRes.y * integerScaleFactor.y);
return;
}
float resRatio = (float) scRes.x / scRes.y;
float winRatio = (float) winSize.x / winSize.y;
@ -544,10 +573,68 @@ struct GraphicsPrivate
scOffset.y = (winSize.y - scSize.y) / 2.f;
}
static int findHighestFittingScale(int base, int target)
{
int scale = 1;
while (base * scale <= target)
scale += 1;
return scale - 1;
}
/* Returns whether a new scale was found */
bool findHighestIntegerScale()
{
Vec2i newScale(findHighestFittingScale(scRes.x, winSize.x),
findHighestFittingScale(scRes.y, winSize.y));
if (threadData->config.fixedAspectRatio)
{
/* Limit both factors to the smaller of the two */
newScale.x = newScale.y = std::min(newScale.x, newScale.y);
}
if (newScale == integerScaleFactor)
return false;
integerScaleFactor = newScale;
return true;
}
void rebuildIntegerScaleBuffer()
{
TEXFBO::fini(integerScaleBuffer);
TEXFBO::init(integerScaleBuffer);
TEXFBO::allocEmpty(integerScaleBuffer, scRes.x * integerScaleFactor.x,
scRes.y * integerScaleFactor.y);
TEXFBO::linkFBO(integerScaleBuffer);
}
bool integerScaleStepApplicable() const
{
if (!integerScaleActive)
return false;
if (integerScaleFactor.x < 1 || integerScaleFactor.y < 1) // XXX should be < 2, this is for testing only
return false;
return true;
}
void checkResize()
{
if (threadData->windowSizeMsg.poll(winSize))
{
/* Query the acutal size in pixels, not units */
SDL_GL_GetDrawableSize(threadData->window, &winSize.x, &winSize.y);
/* Make sure integer buffers are rebuilt before screen offsets are
* calculated so we have the final allocated buffer size ready */
if (integerScaleActive)
if (findHighestIntegerScale())
rebuildIntegerScaleBuffer();
/* some GL drivers change the viewport on window resize */
glState.viewport.refresh();
recalculateScreenSize(threadData);
@ -600,20 +687,64 @@ struct GraphicsPrivate
void metaBlitBufferFlippedScaled()
{
GLMeta::blitRectangle(IntRect(0, 0, scRes.x, scRes.y),
metaBlitBufferFlippedScaled(scRes);
}
void metaBlitBufferFlippedScaled(const Vec2i &sourceSize, bool forceNearestNeighbour = false)
{
GLMeta::blitRectangle(IntRect(0, 0, sourceSize.x, sourceSize.y),
IntRect(scOffset.x, scSize.y+scOffset.y, scSize.x, -scSize.y),
threadData->config.smoothScaling);
!forceNearestNeighbour && threadData->config.smoothScaling);
}
void redrawScreen()
{
screen.composite();
// maybe unspaghetti this later
if (integerScaleStepApplicable() && !integerLastMileScaling)
{
GLMeta::blitBeginScreen(winSize);
GLMeta::blitSource(screen.getPP().frontBuffer());
FBO::clear();
metaBlitBufferFlippedScaled(scRes, true);
GLMeta::blitEnd();
swapGLBuffer();
return;
}
if (integerScaleStepApplicable())
{
assert(integerScaleBuffer.tex != TEX::ID(0));
GLMeta::blitBegin(integerScaleBuffer);
GLMeta::blitSource(screen.getPP().frontBuffer());
GLMeta::blitRectangle(IntRect(0, 0, scRes.x, scRes.y),
IntRect(0, 0, integerScaleBuffer.width, integerScaleBuffer.height),
false);
GLMeta::blitEnd();
}
GLMeta::blitBeginScreen(winSize);
GLMeta::blitSource(screen.getPP().frontBuffer());
Vec2i sourceSize;
if (integerScaleActive)
{
GLMeta::blitSource(integerScaleBuffer);
sourceSize = Vec2i(integerScaleBuffer.width, integerScaleBuffer.height);
}
else
{
GLMeta::blitSource(screen.getPP().frontBuffer());
sourceSize = scRes;
}
FBO::clear();
metaBlitBufferFlippedScaled();
metaBlitBufferFlippedScaled(sourceSize);
GLMeta::blitEnd();
@ -935,8 +1066,8 @@ int Graphics::height() const
void Graphics::resizeScreen(int width, int height)
{
width = clamp(width, 1, 640);
height = clamp(height, 1, 480);
width = std::max(1, width);
height = std::max(1, height);
Vec2i size(width, height);
@ -1026,7 +1157,48 @@ bool Graphics::getFixedAspectRatio() const
void Graphics::setFixedAspectRatio(bool value)
{
shState->config().fixedAspectRatio = value;
p->recalculateScreenSize(p->threadData);
p->findHighestIntegerScale();
p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
p->updateScreenResoRatio(p->threadData);
}
bool Graphics::getSmoothScaling() const
{
// Same deal as with fixed aspect ratio
return shState->config().smoothScaling;
}
void Graphics::setSmoothScaling(bool value)
{
shState->config().smoothScaling = value;
}
bool Graphics::getIntegerScaling() const
{
return p->integerScaleActive;
}
void Graphics::setIntegerScaling(bool value)
{
p->integerScaleActive = value;
p->findHighestIntegerScale();
p->rebuildIntegerScaleBuffer();
p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
p->updateScreenResoRatio(p->threadData);
}
bool Graphics::getLastMileScaling() const
{
return p->integerLastMileScaling;
}
void Graphics::setLastMileScaling(bool value)
{
p->integerLastMileScaling = value;
p->recalculateScreenSize(p->threadData->config.fixedAspectRatio);
p->updateScreenResoRatio(p->threadData);
}

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -63,6 +63,9 @@ public:
DECL_ATTR( ShowCursor, bool )
DECL_ATTR( FixedAspectRatio, bool )
DECL_ATTR( SmoothScaling, bool )
DECL_ATTR( IntegerScaling, bool )
DECL_ATTR( LastMileScaling, bool )
/* <internal> */
Scene *getScreen() const;

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -28,12 +28,13 @@
#include <SDL_scancode.h>
#include <SDL_mouse.h>
#include <SDL_atomic.h>
#include <vector>
#include <string.h>
#include <assert.h>
#define BUTTON_CODE_COUNT 24
#define BUTTON_CODE_COUNT 26
struct ButtonState
{
@ -236,7 +237,7 @@ static const int mapToIndex[] =
0,
16, 17, 18, 19, 20,
0, 0, 0, 0, 0, 0, 0, 0,
21, 22, 23
21, 22, 23, 24, 25
};
static elementsN(mapToIndex);
@ -287,6 +288,9 @@ struct InputPrivate
Input::ButtonCode repeating;
unsigned int repeatCount;
/* Cumulative vertical scroll distance since last update call */
int vScrollDistance;
struct
{
int active;
@ -322,6 +326,8 @@ struct InputPrivate
dir4Data.previous = Input::None;
dir8Data.active = 0;
vScrollDistance = 0;
}
inline ButtonState &getStateCheck(int code)
@ -459,12 +465,14 @@ struct InputPrivate
void initMsBindings()
{
msBindings.resize(3);
msBindings.resize(5);
size_t i = 0;
msBindings[i++] = MsBinding(SDL_BUTTON_LEFT, Input::MouseLeft);
msBindings[i++] = MsBinding(SDL_BUTTON_MIDDLE, Input::MouseMiddle);
msBindings[i++] = MsBinding(SDL_BUTTON_RIGHT, Input::MouseRight);
msBindings[i++] = MsBinding(SDL_BUTTON_X1, Input::MouseX1);
msBindings[i++] = MsBinding(SDL_BUTTON_X2, Input::MouseX2);
}
void pollBindings(Input::ButtonCode &repeatCand)
@ -640,6 +648,9 @@ void Input::update()
}
p->repeating = None;
/* Fetch new cumulative scroll distance and reset counter */
p->vScrollDistance = SDL_AtomicSet(&EventThread::verticalScrollDistance, 0);
}
bool Input::isPressed(int button)
@ -681,6 +692,11 @@ int Input::mouseY()
return (EventThread::mouseState.y - rtData.screenOffset.y) * rtData.sizeResoRatio.y;
}
int Input::scrollV()
{
return p->vScrollDistance;
}
Input::~Input()
{
delete p;

View File

@ -3,7 +3,7 @@
**
** This file is part of mkxp.
**
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
** Copyright (C) 2013 - 2021 Amaryllis Kulla <ancurio@mapleshrine.eu>
**
** mkxp is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@ -43,7 +43,8 @@ public:
F5 = 25, F6 = 26, F7 = 27, F8 = 28, F9 = 29,
/* Non-standard extensions */
MouseLeft = 38, MouseMiddle = 39, MouseRight = 40
MouseLeft = 38, MouseMiddle = 39, MouseRight = 40,
MouseX1 = 41, MouseX2 = 42
};
void update();
@ -58,6 +59,7 @@ public:
/* Non-standard extensions */
int mouseX();
int mouseY();
int scrollV();
private:
Input(const RGSSThreadData &rtData);

Some files were not shown because too many files have changed in this diff Show More