Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Otowa Kotori
Tales of MajEyal
Commits
9463c8cb
Commit
9463c8cb
authored
13 years ago
by
dg
Browse files
Options
Downloads
Patches
Plain Diff
fix!
git-svn-id:
http://svn.net-core.org/repos/t-engine4@3321
51575b47-30f0-44d4-a5cc-537603b46e54
parent
cba88f0a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
game/engines/default/engine/LogDisplay.lua
+11
-3
11 additions, 3 deletions
game/engines/default/engine/LogDisplay.lua
game/engines/default/engine/ui/TextzoneList.lua
+2
-2
2 additions, 2 deletions
game/engines/default/engine/ui/TextzoneList.lua
src/core_lua.c
+7
-13
7 additions, 13 deletions
src/core_lua.c
with
20 additions
and
18 deletions
game/engines/default/engine/LogDisplay.lua
+
11
−
3
View file @
9463c8cb
...
...
@@ -40,6 +40,7 @@ function _M:init(x, y, w, h, max, fontname, fontsize, color, bgcolor)
self
.
max_log
=
max
or
4000
self
.
scroll
=
0
self
.
changed
=
true
self
.
cache
=
{}
self
:
resize
(
x
,
y
,
w
,
h
)
end
...
...
@@ -80,7 +81,8 @@ function _M:call(str, ...)
local
tstr
=
str
:
toString
()
table.insert
(
self
.
log
,
1
,
tstr
)
while
#
self
.
log
>
self
.
max_log
do
table.remove
(
self
.
log
)
local
old
=
table.remove
(
self
.
log
)
self
.
cache
[
old
]
=
nil
end
self
.
max
=
#
self
.
log
self
.
changed
=
true
...
...
@@ -88,6 +90,7 @@ end
--- Clear the log
function
_M
:
empty
()
self
.
cache
=
{}
self
.
log
=
{}
self
.
changed
=
true
end
...
...
@@ -116,8 +119,13 @@ function _M:display()
for
z
=
1
+
self
.
scroll
,
#
self
.
log
do
local
stop
=
false
local
tstr
=
self
.
log
[
z
]
-- local gen = tstring.makeLineTextures(tstr, self.w - 4, self.font)
local
gen
=
self
.
font
:
draw
(
tstr
,
self
.
w
,
255
,
255
,
255
)
local
gen
if
self
.
cache
[
tstr
]
then
gen
=
self
.
cache
[
tstr
]
else
gen
=
self
.
font
:
draw
(
tstr
,
self
.
w
,
255
,
255
,
255
)
self
.
cache
[
tstr
]
=
gen
end
for
i
=
#
gen
,
1
,
-
1
do
self
.
dlist
[
#
self
.
dlist
+
1
]
=
gen
[
i
]
h
=
h
+
self
.
fh
...
...
This diff is collapsed.
Click to expand it.
game/engines/default/engine/ui/TextzoneList.lua
+
2
−
2
View file @
9463c8cb
...
...
@@ -69,7 +69,7 @@ function _M:createItem(item, text)
local
old_style
=
self
.
font
:
getStyle
()
-- Handle normal text
if
type
(
text
)
==
"string"
then
if
false
and
type
(
text
)
==
"string"
then
local
list
=
text
:
splitLines
(
self
.
w
,
self
.
font
)
local
scroll
=
1
local
max
=
#
list
...
...
@@ -98,7 +98,7 @@ function _M:createItem(item, text)
-- Handle "pre formated" text, as a table
else
-- Draw the list items
local
gen
=
tstring
.
makeLineTextures
(
text
,
self
.
fw
,
self
.
font
)
local
gen
=
self
.
font
:
draw
(
text
:
toString
(),
self
.
fw
,
255
,
255
,
255
)
local
scroll
=
1
local
max
=
#
gen
...
...
This diff is collapsed.
Click to expand it.
src/core_lua.c
+
7
−
13
View file @
9463c8cb
...
...
@@ -488,7 +488,7 @@ static int sdl_surface_drawstring_newsurface_aa(lua_State *L)
static
font_make_texture_line
(
lua_State
*
L
,
SDL_Surface
*
s
,
int
id
)
{
lua_
new
table
(
L
);
lua_
create
table
(
L
,
0
,
5
);
lua_pushstring
(
L
,
"_tex"
);
GLuint
*
t
=
(
GLuint
*
)
lua_newuserdata
(
L
,
sizeof
(
GLuint
));
...
...
@@ -520,7 +520,6 @@ static font_make_texture_line(lua_State *L, SDL_Surface *s, int id)
static
int
sdl_font_draw
(
lua_State
*
L
)
{
// if (no_text_aa) return sdl_surface_drawstring(L);
TTF_Font
**
f
=
(
TTF_Font
**
)
auxiliar_checkclass
(
L
,
"sdl{font}"
,
1
);
const
char
*
str
=
luaL_checkstring
(
L
,
2
);
int
max_width
=
luaL_checknumber
(
L
,
3
);
...
...
@@ -528,6 +527,7 @@ static int sdl_font_draw(lua_State *L)
int
g
=
luaL_checknumber
(
L
,
5
);
int
b
=
luaL_checknumber
(
L
,
6
);
int
h
=
TTF_FontLineSkip
(
*
f
);
SDL_Color
color
=
{
r
,
g
,
b
};
int
space_w
=
0
,
space_h
=
0
;
TTF_SizeUTF8
(
*
f
,
" "
,
&
space_w
,
&
space_h
);
...
...
@@ -538,17 +538,9 @@ static int sdl_font_draw(lua_State *L)
#else
rmask
=
0x000000ff
;
gmask
=
0x0000ff00
;
bmask
=
0x00ff0000
;
amask
=
0xff000000
;
#endif
SDL_Surface
*
s
=
SDL_CreateRGBSurface
(
SDL_SWSURFACE
|
SDL_SRCALPHA
,
max_width
,
h
,
32
,
rmask
,
gmask
,
bmask
,
amask
);
SDL_Surface
*
s
=
SDL_CreateRGBSurface
(
SDL_SWSURFACE
|
SDL_SRCALPHA
,
max_width
,
h
,
32
,
rmask
,
gmask
,
bmask
,
amask
);
SDL_FillRect
(
s
,
NULL
,
SDL_MapRGBA
(
s
->
format
,
0
,
0
,
0
,
0
));
SDL_Color
color
=
{
r
,
g
,
b
};
lua_newtable
(
L
);
int
nb_lines
=
1
;
...
...
@@ -568,7 +560,8 @@ static int sdl_font_draw(lua_State *L)
char
old
=
*
next
;
*
next
=
'\0'
;
if
(
txt
)
SDL_FreeSurface
(
txt
);
txt
=
TTF_RenderUTF8_Blended
(
*
f
,
start
,
color
);
if
(
no_text_aa
)
txt
=
TTF_RenderUTF8_Solid
(
*
f
,
start
,
color
);
else
txt
=
TTF_RenderUTF8_Blended
(
*
f
,
start
,
color
);
// If we must do a newline, flush the previous word and the start the new line
if
(
force_nl
||
(
txt
&&
(
size
+
txt
->
w
+
space_w
>
max_width
)))
...
...
@@ -688,7 +681,7 @@ static int sdl_font_draw(lua_State *L)
color
.
g
=
gh
;
color
.
b
=
bh
;
}
lua_pop
(
L
,
1
);
lua_pop
(
L
,
2
);
}
char
old
=
*
codestop
;
...
...
@@ -705,6 +698,7 @@ static int sdl_font_draw(lua_State *L)
}
font_make_texture_line
(
L
,
s
,
nb_lines
);
if
(
size
>
max_size
)
max_size
=
size
;
if
(
txt
)
SDL_FreeSurface
(
txt
);
SDL_FreeSurface
(
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment