Merge branch 'rr1-maint'
This commit is contained in:
commit
5b84aa6cfd
4 changed files with 163 additions and 25 deletions
44
manual.lyx
44
manual.lyx
|
@ -2352,7 +2352,49 @@ outline: Color of outline (default is 0xFFFFFF (white))
|
|||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
fill: Color of fil (default is -1 (transparent))
|
||||
fill: Color of fill (default is -1 (transparent))
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
gui.box(number x, number y, number width, number height[, number thickness[,
|
||||
number outline1[,number outline2[, number fill]]]])
|
||||
\end_layout
|
||||
|
||||
\begin_layout Standard
|
||||
Draw rectangle with 3D effect on the GUI.
|
||||
Parameters:
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
x: X-coordinate of left edge.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
y: Y-coordinate of upper edge.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
width: Width of rectangle.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
height: Height of rectangle.
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
thickness: Thickness of outline (default is 1).
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
outline1: First color of outline (default is 0xFFFFFF (white))
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
outline2: First color of outline (default is 0x808080 (dark gray))
|
||||
\end_layout
|
||||
|
||||
\begin_layout Itemize
|
||||
fill: Color of fill (default is 0xC0C0C0 (light grayy))
|
||||
\end_layout
|
||||
|
||||
\begin_layout Subsubsection
|
||||
|
|
69
manual.txt
69
manual.txt
|
@ -1153,9 +1153,32 @@ Draw rectangle on the GUI. Parameters:
|
|||
|
||||
• outline: Color of outline (default is 0xFFFFFF (white))
|
||||
|
||||
• fill: Color of fil (default is -1 (transparent))
|
||||
• fill: Color of fill (default is -1 (transparent))
|
||||
|
||||
8.3.8 gui.pixel(number x, number y[, number color])
|
||||
8.3.8 gui.box(number x, number y, number width, number height[,
|
||||
number thickness[, number outline1[,number outline2[, number
|
||||
fill]]]])
|
||||
|
||||
Draw rectangle with 3D effect on the GUI. Parameters:
|
||||
|
||||
• x: X-coordinate of left edge.
|
||||
|
||||
• y: Y-coordinate of upper edge.
|
||||
|
||||
• width: Width of rectangle.
|
||||
|
||||
• height: Height of rectangle.
|
||||
|
||||
• thickness: Thickness of outline (default is 1).
|
||||
|
||||
• outline1: First color of outline (default is 0xFFFFFF (white))
|
||||
|
||||
• outline2: First color of outline (default is 0x808080 (dark
|
||||
gray))
|
||||
|
||||
• fill: Color of fill (default is 0xC0C0C0 (light grayy))
|
||||
|
||||
8.3.9 gui.pixel(number x, number y[, number color])
|
||||
|
||||
Draw one pixel on the GUI. Parameters:
|
||||
|
||||
|
@ -1165,7 +1188,7 @@ Draw one pixel on the GUI. Parameters:
|
|||
|
||||
• color: Color of the pixel (default is 0xFFFFFF (white))
|
||||
|
||||
8.3.9 gui.crosshair(number x, number y[, number length[, number
|
||||
8.3.10 gui.crosshair(number x, number y[, number length[, number
|
||||
color]])
|
||||
|
||||
Draw a crosshair. Parameters:
|
||||
|
@ -1178,7 +1201,7 @@ Draw a crosshair. Parameters:
|
|||
|
||||
• color: Color of the crosshair (default is 0xFFFFFF (white))
|
||||
|
||||
8.3.10 gui.line(number x1, number y1, number x2, number y2[,
|
||||
8.3.11 gui.line(number x1, number y1, number x2, number y2[,
|
||||
number color])
|
||||
|
||||
Draw a thin line. Parameters:
|
||||
|
@ -1193,7 +1216,7 @@ Draw a thin line. Parameters:
|
|||
|
||||
• color: Color of the line (default is 0xFFFFFF (white)).
|
||||
|
||||
8.3.11 gui.circle(number x, number y, number r[, number thick[,
|
||||
8.3.12 gui.circle(number x, number y, number r[, number thick[,
|
||||
number border[, number fil]]])
|
||||
|
||||
Draw a circle. Parameters.
|
||||
|
@ -1210,7 +1233,7 @@ Draw a circle. Parameters.
|
|||
|
||||
• fill: Fill color (default is -1 (transparent)).
|
||||
|
||||
8.3.12 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
|
||||
8.3.13 gui.bitmap_draw(number x, number y, bitmap bitmap, palette
|
||||
palette)
|
||||
|
||||
Draw a bitmap on screen with specified palette. Parameters:
|
||||
|
@ -1223,7 +1246,7 @@ Draw a bitmap on screen with specified palette. Parameters:
|
|||
|
||||
• palette: The palette to draw the bitmap using.
|
||||
|
||||
8.3.13 gui.bitmap_draw(number x, number y, dbitmap bitmap)
|
||||
8.3.14 gui.bitmap_draw(number x, number y, dbitmap bitmap)
|
||||
|
||||
Draw a bitmap on screen. Parameters:
|
||||
|
||||
|
@ -1233,12 +1256,12 @@ Draw a bitmap on screen. Parameters:
|
|||
|
||||
• bitmap: The bitmap to draw
|
||||
|
||||
8.3.14 gui.palette_new()
|
||||
8.3.15 gui.palette_new()
|
||||
|
||||
Returns a new palette (initially all transparent). Can be used
|
||||
anywhere.
|
||||
|
||||
8.3.15 gui.bitmap_new(number w, number h, boolean direct[, bool
|
||||
8.3.16 gui.bitmap_new(number w, number h, boolean direct[, bool
|
||||
icolor])
|
||||
|
||||
Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
|
||||
|
@ -1253,14 +1276,14 @@ Returns a new bitmap/dbitmap. Can be used anywhere. Parameters:
|
|||
• icolor: Initital fill color (defaults to 0 on BITMAP, -1 on
|
||||
DBITMAP)
|
||||
|
||||
8.3.16 gui.bitmap_load(string file)
|
||||
8.3.17 gui.bitmap_load(string file)
|
||||
|
||||
Returns loaded bitmap/dbitmap (if bitmap, the second return value
|
||||
is palette for bitmap). Can be used anywhere. Parameters:
|
||||
|
||||
• file: The name of file to load.
|
||||
|
||||
8.3.17 gui.palette_set(palette palette, number index, number
|
||||
8.3.18 gui.palette_set(palette palette, number index, number
|
||||
color)
|
||||
|
||||
Sets color in palette. Can be used anywhere. Parameters:
|
||||
|
@ -1271,7 +1294,7 @@ Sets color in palette. Can be used anywhere. Parameters:
|
|||
|
||||
• color: The color value.
|
||||
|
||||
8.3.18 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
|
||||
8.3.19 gui.bitmap_pset(bitmap/dbitmap bitmap, number x, number y,
|
||||
number color)
|
||||
|
||||
Sets specified pixel in bitmap. Can be used anywhere. Parameters:
|
||||
|
@ -1285,7 +1308,7 @@ Sets specified pixel in bitmap. Can be used anywhere. Parameters:
|
|||
• color: If bitmap is a bitmap, color index (0-65535). Otherwise
|
||||
color value.
|
||||
|
||||
8.3.19 gui.bitmap_size(bitmap/dbitmap bitmap)
|
||||
8.3.20 gui.bitmap_size(bitmap/dbitmap bitmap)
|
||||
|
||||
Get size of bitmap. Can be used anywhere. Parameters:
|
||||
|
||||
|
@ -1293,7 +1316,7 @@ Get size of bitmap. Can be used anywhere. Parameters:
|
|||
|
||||
The first return is the width, the second is the height.
|
||||
|
||||
8.3.20 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
|
||||
8.3.21 gui.bitmap_blit(bitmap/dbitmap dest, number dx, number dy,
|
||||
bitmap/dbitmap src, number sx, number sy, number w, number h[,
|
||||
number ck])
|
||||
|
||||
|
@ -1327,34 +1350,34 @@ Parameters:
|
|||
|
||||
– May be absent or nil for no colorkey blit.
|
||||
|
||||
8.3.21 gui.repaint()
|
||||
8.3.22 gui.repaint()
|
||||
|
||||
Request on_repaint() to happen as soon as possible. Can be used
|
||||
anywhere.
|
||||
|
||||
8.3.22 gui.subframe_update(boolean on)
|
||||
8.3.23 gui.subframe_update(boolean on)
|
||||
|
||||
Request subframe updates (calling on_paint() on subframes) to
|
||||
happen (on=true) or not happen (on=false). Can be used anywhere.
|
||||
|
||||
8.3.23 gui.screenshot(string filename)
|
||||
8.3.24 gui.screenshot(string filename)
|
||||
|
||||
Write PNG screenshot of the current frame (no drawings) to
|
||||
specified file. Can be used anywhere.
|
||||
|
||||
8.3.24 gui.color(number r, number g, number b[, number a])
|
||||
8.3.25 gui.color(number r, number g, number b[, number a])
|
||||
|
||||
Returns color (in notation Lua scripts use) corresponding to
|
||||
color (r,g,b), each component in scale 0-255. If a is specified,
|
||||
that is alpha (0 is fully transparent, 256(sic) is fully opaque).
|
||||
The default alpha is 256.
|
||||
|
||||
8.3.25 gui.status(string name, string value)
|
||||
8.3.26 gui.status(string name, string value)
|
||||
|
||||
Set status field “L[<name>]” to <value> in status area. Can be
|
||||
used anywhere.
|
||||
|
||||
8.3.26 gui.rainbow(number step, number steps[, number color])
|
||||
8.3.27 gui.rainbow(number step, number steps[, number color])
|
||||
|
||||
Perform hue rotation of color <color> (default bright red), by
|
||||
<step> steps. The number of steps per full rotation is given by
|
||||
|
@ -1754,7 +1777,7 @@ Called if savestate goes wrong.
|
|||
8.10.12 Callback: on_post_save(string name, boolean is_savestate)
|
||||
|
||||
Called on successful savaestate. is_savestate gives if this was a
|
||||
savestate or a
|
||||
savestate or a movie.
|
||||
|
||||
8.10.13 Callback: on_quit()
|
||||
|
||||
|
@ -2637,7 +2660,7 @@ set-axis joystick0axis19 disabled
|
|||
|
||||
• Remove calls to runtosave() that aren't supposed to be there
|
||||
|
||||
• Lua function: read_rtc()
|
||||
• Lua function: movie.read_rtc()
|
||||
|
||||
• Ignore src/fonts/font.cpp
|
||||
|
||||
|
@ -2858,7 +2881,7 @@ set-axis joystick0axis19 disabled
|
|||
• Wxwidgets: 128 -> 1024 Autohold slots (in case more are
|
||||
needed).
|
||||
|
||||
• Don't append trailing '-' to prefix when saving
|
||||
• Don't append trailing '-' to prefix when saving movie.
|
||||
|
||||
• Fix ROM/savestate handling (don't let user mismatch ROM and
|
||||
savestates).
|
||||
|
|
73
src/lua/gui-box.cpp
Normal file
73
src/lua/gui-box.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
#include "lua/internal.hpp"
|
||||
#include "core/render.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
struct render_object_box : public render_object
|
||||
{
|
||||
render_object_box(int32_t _x, int32_t _y, uint32_t _width, uint32_t _height,
|
||||
premultiplied_color _outline1, premultiplied_color _outline2, premultiplied_color _fill,
|
||||
uint32_t _thickness) throw()
|
||||
: x(_x), y(_y), width(_width), height(_height), outline1(_outline1), outline2(_outline2),
|
||||
fill(_fill), thickness(_thickness) {}
|
||||
~render_object_box() throw() {}
|
||||
template<bool X> void op(struct screen<X>& scr) throw()
|
||||
{
|
||||
outline1.set_palette(scr);
|
||||
outline2.set_palette(scr);
|
||||
fill.set_palette(scr);
|
||||
int32_t xmin = 0;
|
||||
int32_t xmax = width;
|
||||
int32_t ymin = 0;
|
||||
int32_t ymax = height;
|
||||
clip_range(scr.originx, scr.width, x, xmin, xmax);
|
||||
clip_range(scr.originy, scr.height, y, ymin, ymax);
|
||||
for(int32_t r = ymin; r < ymax; r++) {
|
||||
typename screen<X>::element_t* rptr = scr.rowptr(y + r + scr.originy);
|
||||
size_t eptr = x + xmin + scr.originx;
|
||||
for(int32_t c = xmin; c < xmax; c++, eptr++)
|
||||
if((r < thickness && r <= (width - c)) || (c < thickness && c < (height - r)))
|
||||
outline1.apply(rptr[eptr]);
|
||||
else if(r < thickness || c < thickness || r >= height - thickness ||
|
||||
c >= width - thickness)
|
||||
outline2.apply(rptr[eptr]);
|
||||
else
|
||||
fill.apply(rptr[eptr]);
|
||||
}
|
||||
}
|
||||
void operator()(struct screen<true>& scr) throw() { op(scr); }
|
||||
void operator()(struct screen<false>& scr) throw() { op(scr); }
|
||||
private:
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
premultiplied_color outline1;
|
||||
premultiplied_color outline2;
|
||||
premultiplied_color fill;
|
||||
uint32_t thickness;
|
||||
};
|
||||
|
||||
function_ptr_luafun gui_box("gui.box", [](lua_State* LS, const std::string& fname) -> int {
|
||||
if(!lua_render_ctx)
|
||||
return 0;
|
||||
int64_t outline1 = 0xFFFFFFU;
|
||||
int64_t outline2 = 0x808080U;
|
||||
int64_t fill = 0xC0C0C0U;
|
||||
uint32_t thickness = 1;
|
||||
int32_t x = get_numeric_argument<int32_t>(LS, 1, fname.c_str());
|
||||
int32_t y = get_numeric_argument<int32_t>(LS, 2, fname.c_str());
|
||||
uint32_t width = get_numeric_argument<uint32_t>(LS, 3, fname.c_str());
|
||||
uint32_t height = get_numeric_argument<uint32_t>(LS, 4, fname.c_str());
|
||||
get_numeric_argument<uint32_t>(LS, 5, thickness, fname.c_str());
|
||||
get_numeric_argument<int64_t>(LS, 6, outline1, fname.c_str());
|
||||
get_numeric_argument<int64_t>(LS, 7, outline2, fname.c_str());
|
||||
get_numeric_argument<int64_t>(LS, 8, fill, fname.c_str());
|
||||
premultiplied_color poutline1(outline1);
|
||||
premultiplied_color poutline2(outline2);
|
||||
premultiplied_color pfill(fill);
|
||||
lua_render_ctx->queue->create_add<render_object_box>(x, y, width, height, poutline1, poutline2,
|
||||
pfill, thickness);
|
||||
return 0;
|
||||
});
|
||||
}
|
|
@ -1102,7 +1102,7 @@ void wxwin_mainwindow::handle_menu_click_cancelable(wxCommandEvent& e)
|
|||
runemufn([&bad, &value]() { try { setting::set("targetfps", value); } catch(...) { bad = true; } });
|
||||
if(bad)
|
||||
wxMessageBox(wxT("Invalid speed"), _T("Error"), wxICON_EXCLAMATION | wxOK, this);
|
||||
return
|
||||
return;
|
||||
}
|
||||
case wxID_SET_VOLUME: {
|
||||
std::string value;
|
||||
|
|
Loading…
Add table
Reference in a new issue