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
a27078c7
Commit
a27078c7
authored
11 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
c5bdb05f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engines/default/engine/Target.lua
+39
-20
39 additions, 20 deletions
game/engines/default/engine/Target.lua
game/modules/tome/class/Game.lua
+2
-2
2 additions, 2 deletions
game/modules/tome/class/Game.lua
with
41 additions
and
22 deletions
game/engines/default/engine/Target.lua
+
39
−
20
View file @
a27078c7
...
...
@@ -35,41 +35,60 @@ function _M:init(map, source_actor)
self
.
arrow
=
engine
.
Tiles
:
loadImage
(
"target_arrow.png"
):
glTexture
()
self
.
targetshader
=
engine
.
Tiles
:
loadImage
(
"ui/targetshader.png"
):
glTexture
()
self
:
createTextures
()
self
.
source_actor
=
source_actor
-- Setup the tracking target table
-- Notice its values are set to weak references, this has no effects on the number for x and y
-- but it means if the entity field is set to an entity, when it disappears this link wont prevent
-- the garbage collection
self
.
target
=
{
x
=
self
.
source_actor
.
x
,
y
=
self
.
source_actor
.
y
,
entity
=
nil
}
-- setmetatable(self.target, {__mode='v'})
end
function
_M
:
createTextures
()
--Use power of two (pot) width and height, rounded up
local
pot_width
=
math
.
pow
(
2
,
math.ceil
(
math.log
(
map
.
tile_w
-
0
.
1
)
/
math.log
(
2
.
0
)))
local
pot_height
=
math
.
pow
(
2
,
math.ceil
(
math.log
(
map
.
tile_h
-
0
.
1
)
/
math.log
(
2
.
0
)))
local
pot_width
=
math
.
pow
(
2
,
math.ceil
(
math.log
(
self
.
tile_w
-
0
.
1
)
/
math.log
(
2
.
0
)))
local
pot_height
=
math
.
pow
(
2
,
math.ceil
(
math.log
(
self
.
tile_h
-
0
.
1
)
/
math.log
(
2
.
0
)))
self
.
sr
=
core
.
display
.
newSurface
(
pot_width
,
pot_height
)
self
.
sr
:
erase
(
255
,
0
,
0
,
15
0
)
self
.
sr
:
erase
(
255
,
0
,
0
,
self
.
fbo
and
150
or
9
0
)
self
.
sr
=
self
.
sr
:
glTexture
()
self
.
sb
=
core
.
display
.
newSurface
(
pot_width
,
pot_height
)
self
.
sb
:
erase
(
0
,
0
,
255
,
15
0
)
self
.
sb
:
erase
(
0
,
0
,
255
,
self
.
fbo
and
150
or
9
0
)
self
.
sb
=
self
.
sb
:
glTexture
()
self
.
sg
=
core
.
display
.
newSurface
(
pot_width
,
pot_height
)
self
.
sg
:
erase
(
0
,
255
,
0
,
15
0
)
self
.
sg
:
erase
(
0
,
255
,
0
,
self
.
fbo
and
150
or
9
0
)
self
.
sg
=
self
.
sg
:
glTexture
()
self
.
sy
=
core
.
display
.
newSurface
(
pot_width
,
pot_height
)
self
.
sy
:
erase
(
255
,
255
,
0
,
15
0
)
self
.
sy
:
erase
(
255
,
255
,
0
,
self
.
fbo
and
150
or
9
0
)
self
.
sy
=
self
.
sy
:
glTexture
()
self
.
syg
=
core
.
display
.
newSurface
(
pot_width
,
pot_height
)
self
.
syg
:
erase
(
153
,
204
,
50
,
15
0
)
self
.
syg
:
erase
(
153
,
204
,
50
,
self
.
fbo
and
150
or
9
0
)
self
.
syg
=
self
.
syg
:
glTexture
()
self
.
source_actor
=
source_actor
-- Setup the tracking target table
-- Notice its values are set to weak references, this has no effects on the number for x and y
-- but it means if the entity field is set to an entity, when it disappears this link wont prevent
-- the garbage collection
self
.
target
=
{
x
=
self
.
source_actor
.
x
,
y
=
self
.
source_actor
.
y
,
entity
=
nil
}
-- setmetatable(self.target, {__mode='v'})
end
function
_M
:
enableFBORenderer
(
shader
)
function
_M
:
enableFBORenderer
(
texture
,
shader
)
if
not
shader
then
self
.
fbo
=
nil
return
self
:
createTextures
()
end
self
.
fbo
=
core
.
display
.
newFBO
(
Map
.
viewport
.
width
,
Map
.
viewport
.
height
)
if
not
self
.
fbo
then
return
end
if
shader
then
self
.
fbo_shader
=
Shader
.
new
(
shader
)
if
not
self
.
fbo
then
self
:
createTextures
()
return
end
self
.
fbo_shader
=
Shader
.
new
(
shader
)
if
not
self
.
fbo_shader
.
shad
then
self
.
fbo
=
nil
self
:
createTextures
()
return
end
self
.
targetshader
=
engine
.
Tiles
:
loadImage
(
texture
):
glTexture
()
self
:
createTextures
()
end
function
_M
:
displayArrow
(
sx
,
sy
,
tx
,
ty
,
full
)
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/class/Game.lua
+
2
−
2
View file @
a27078c7
...
...
@@ -134,7 +134,7 @@ function _M:runReal()
if
not
self
.
player
then
self
:
newGame
()
end
engine
.
interface
.
GameTargeting
.
init
(
self
)
if
self
.
target
then
self
.
target
:
enableFBORenderer
(
"target_fbo"
)
end
if
self
.
target
then
self
.
target
:
enableFBORenderer
(
"ui/targetshader.png"
,
"target_fbo"
)
end
self
.
uiset
.
hotkeys_display
.
actor
=
self
.
player
self
.
uiset
.
npcs_display
.
actor
=
self
.
player
...
...
@@ -516,7 +516,7 @@ function _M:createFBOs()
if
self
.
fbo
and
self
.
fbo2
then
core
.
particles
.
defineFramebuffer
(
self
.
fbo
)
else
core
.
particles
.
defineFramebuffer
(
nil
)
end
if
self
.
target
then
self
.
target
:
enableFBORenderer
(
"target_fbo"
)
end
if
self
.
target
then
self
.
target
:
enableFBORenderer
(
"ui/targetshader.png"
,
"target_fbo"
)
end
-- self.mm_fbo = core.display.newFBO(200, 200)
-- if self.mm_fbo then self.mm_fbo_shader = Shader.new("mm_fbo") if not self.mm_fbo_shader.shad then self.mm_fbo = nil self.mm_fbo_shader = nil end end
...
...
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