FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
gfx_width.c
Go to the documentation of this file.
1
/* graphical text console mode changing */
2
3
#include "
fb_gfx.h
"
4
5
int
fb_GfxWidth
(
int
w,
int
h)
6
{
7
int
font_w, font_h;
8
const
FONT
*font =
NULL
;
9
int
cur =
__fb_gfx
->
text_w
| (
__fb_gfx
->
text_h
<< 16);
10
11
if
( (w < 1) && (h < 1) )
12
return
cur;
13
14
if
(w > 0)
15
font_w =
__fb_gfx
->
w
/ w;
16
else
{
17
font_w =
__fb_gfx
->
font
->
w
;
18
w =
__fb_gfx
->
text_w
;
19
}
20
21
if
(h > 0)
22
font_h =
__fb_gfx
->
h
/ h;
23
else
{
24
font_h =
__fb_gfx
->
font
->
h
;
25
h =
__fb_gfx
->
text_h
;
26
}
27
28
switch
( font_w ) {
29
case
8:
30
switch
( font_h ) {
31
case
8:
32
font = &
__fb_font
[
FB_FONT_8
];
33
break
;
34
case
14:
35
font = &
__fb_font
[
FB_FONT_14
];
36
break
;
37
case
16:
38
font = &
__fb_font
[
FB_FONT_16
];
39
break
;
40
}
41
break
;
42
}
43
44
if
(font) {
45
/* Update font data */
46
__fb_gfx
->
text_w
= w;
47
__fb_gfx
->
text_h
= h;
48
__fb_gfx
->
font
= font;
49
50
fb_hResetCharCells
(
fb_hGetContext
(),
TRUE
);
51
52
/* Reset graphics VIEW */
53
fb_GfxView
( -32768, -32768,
54
-32768, -32768,
55
0, 0,
56
DEFAULT_COLOR_1
|
DEFAULT_COLOR_2
);
57
58
/* Reset VIEW PRINT */
59
fb_ConsoleView
( 0, 0 );
60
61
/* Clear the whole screen */
62
fb_GfxClear
(0);
63
}
64
65
return
cur;
66
}
gfxlib2
gfx_width.c
Generated on Thu Jan 23 2014 19:40:06 for FreeBASIC by
1.8.4