FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
gfx_pmap.c
Go to the documentation of this file.
1
/* pmap statement and point function with one argument */
2
3
#include "
fb_gfx.h
"
4
5
6
/*:::::*/
7
FBCALL
float
fb_GfxPMap
(
float
coord,
int
func)
8
{
9
FB_GFXCTX
*
context
=
fb_hGetContext
();
10
11
if
(!
__fb_gfx
)
12
return
0.0;
13
14
fb_hPrepareTarget
(context,
NULL
);
15
fb_hSetPixelTransfer
(context,
MASK_A_32
);
16
17
switch
(func) {
18
19
case
0:
20
if
(context->
flags
&
CTX_WINDOW_ACTIVE
)
21
coord = ((coord - context->
win_x
) * context->
view_w
) / context->
win_w
;
22
return
coord;
23
24
case
1:
25
if
(context->
flags
&
CTX_WINDOW_ACTIVE
) {
26
coord = ((coord - context->
win_y
) * context->
view_h
) / context->
win_h
;
27
if
((context->
flags
&
CTX_WINDOW_SCREEN
) == 0)
28
coord = context->
view_h
- 1 - coord;
29
}
30
return
coord;
31
32
case
2:
33
if
(context->
flags
&
CTX_WINDOW_ACTIVE
)
34
coord = ((coord * context->
win_w
) / context->
view_w
) + context->
win_x
;
35
return
coord;
36
37
case
3:
38
if
(context->
flags
&
CTX_WINDOW_ACTIVE
) {
39
if
((context->
flags
&
CTX_WINDOW_SCREEN
) == 0)
40
coord = context->
view_h
- 1 - coord;
41
coord = ((coord * context->
win_h
) / context->
view_h
) + context->
win_y
;
42
}
43
return
coord;
44
}
45
return
0;
46
}
47
48
49
/*:::::*/
50
FBCALL
float
fb_GfxCursor
(
int
func)
51
{
52
FB_GFXCTX
*
context
=
fb_hGetContext
();
53
54
if
(!
__fb_gfx
)
55
return
0.0;
56
57
switch
(func) {
58
59
case
0:
return
fb_GfxPMap
(context->
last_x
, 0);
60
case
1:
return
fb_GfxPMap
(context->
last_y
, 1);
61
case
2:
return
context->
last_x
;
62
case
3:
return
context->
last_y
;
63
}
64
return
0;
65
}
gfxlib2
gfx_pmap.c
Generated on Thu Jan 23 2014 19:40:06 for FreeBASIC by
1.8.4