6 struct render_object_crosshair
: public render_object
8 render_object_crosshair(int32_t _x
, int32_t _y
, premultiplied_color _color
, uint32_t _length
) throw()
9 : x(_x
), y(_y
), color(_color
), length(_length
) {}
10 ~render_object_crosshair() throw() {}
11 void operator()(struct screen
& scr
) throw()
13 int32_t xmin
= -static_cast<int32_t>(length
);
14 int32_t xmax
= static_cast<int32_t>(length
+ 1);
15 int32_t ymin
= -static_cast<int32_t>(length
);
16 int32_t ymax
= static_cast<int32_t>(length
+ 1);
17 clip_range(scr
.originx
, scr
.width
, x
, xmin
, xmax
);
18 clip_range(scr
.originy
, scr
.height
, y
, ymin
, ymax
);
19 if(xmin
<= 0 && xmax
> 0)
20 for(int32_t r
= ymin
; r
< ymax
; r
++)
21 color
.apply(scr
.rowptr(y
+ r
+ scr
.originy
)[x
+ scr
.originx
]);
22 if(ymin
<= 0 && ymax
> 0)
23 for(int32_t r
= xmin
; r
< xmax
; r
++)
24 color
.apply(scr
.rowptr(y
+ scr
.originy
)[x
+ r
+ scr
.originx
]);
29 premultiplied_color color
;
33 function_ptr_luafun
gui_crosshair("gui.crosshair", [](lua_State
* LS
, const std::string
& fname
) -> int {
36 int64_t color
= 0xFFFFFFU
;
38 int32_t x
= get_numeric_argument
<int32_t>(LS
, 1, fname
.c_str());
39 int32_t y
= get_numeric_argument
<int32_t>(LS
, 2, fname
.c_str());
40 get_numeric_argument
<uint32_t>(LS
, 3, length
, fname
.c_str());
41 get_numeric_argument
<int64_t>(LS
, 4, color
, fname
.c_str());
42 premultiplied_color
pcolor(color
);
43 lua_render_ctx
->queue
->add(*new render_object_crosshair(x
, y
, pcolor
, length
));