Wysłany: 2019-04-16, 19:54
_jvneczek
Wiek: 22 Na forum: 4325 dni Posty: 1513
Nick w MP: _jvneczek
Piwa : 3949
Mam drobny k?opot, pr?bowa?em zrobi? obrazek kt?ry b?dzie porusza? si? w ruch myszki(teksture z drift paradise wzi??em)
Niestety nic nie wy?wietla na ekranie, tak samo z db3 kt?re jest puste.
I = {}
UI . textures = {}
local screenW , screenH = guiGetScreenSize ()
MAX_TRANSFORM_ANGLE = 12
dxSetRenderTarget ()
if renderTarget then
rt3DDraw ( renderTarget , 0 , 0 , screenW , screenH )
local mx , my = getCursorPosition ( )
mx = mx * screenW
my = my * screenH
if not isCursorShowing () then
mx , my = 0 * screenW , 0 * screenH
end
local rx =-( mx - screenW / 2 )/ screenW * MAX_TRANSFORM_ANGLE
local ry =( my - screenH / 2 )/ screenH * MAX_TRANSFORM_ANGLE
rt3DTransform ( renderTarget , rx , ry , 0 )
end
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
renderTarget = rt3DCreate ( screenW , screenH )
UI . textures . background = dxCreateTexture ( "assets/images/login/background.png" )
end )
function animacja ()
rt3DSet ( renderTarget )
dxDrawImage ( 0 , 0 , screenW , screenH , UI . textures . background , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ) )
end
Wysłany: 2019-04-16, 19:57
Mikołajj
Wiek: 22 Na forum: 2885 dni Posty: 303
Nick w MP: Mikołaj
Piwa : 132
Gdzie jest onClientRender?
Wysłany: 2019-04-16, 20:02
_jvneczek
Wiek: 22 Na forum: 4325 dni Posty: 1513
Nick w MP: _jvneczek
Piwa : 3949
ST4GE , Poprawi?em troch?, teraz wy?wietla obrazek lecz nic si? nie dzieje;/
UI = {}
UI . textures = {}
local screenW , screenH = guiGetScreenSize ()
MAX_TRANSFORM_ANGLE = 12
dxSetRenderTarget ()
if renderTarget then
rt3DDraw ( renderTarget , 0 , 0 , screenW , screenH )
local mx , my = getCursorPosition ( )
mx = mx * screenW
my = my * screenH
if not isCursorShowing () then
mx , my = 0 * screenW , 0 * screenH
end
local rx =-( mx - screenW / 2 )/ screenW * MAX_TRANSFORM_ANGLE
local ry =( my - screenH / 2 )/ screenH * MAX_TRANSFORM_ANGLE
rt3DTransform ( renderTarget , rx , ry , 0 )
end
function animacja ()
rt3DSet ( renderTarget )
dxDrawImage ( 0 , 0 , screenW , screenH , UI . textures . background , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ) )
end
addEventHandler ( "onClientResourceStart" , resourceRoot , function()
renderTarget = rt3DCreate ( screenW , screenH )
UI . textures . background = dxCreateTexture ( "assets/images/login/background.png" )
addEventHandler ( 'onClientRender' , root , animacja )
showCursor ( true )
end )
kod od animacji(w oddzielnym pliku)
local PATH_SHADER = "assets/shader/"
function rt3DCreate ( w , h )
local rt = { }
rt . w = w
rt . h = h
rt . shader = dxCreateShader ( PATH_SHADER .. "texture3d.fx" )
rt . renderTarget = dxCreateRenderTarget ( w , h , true )
rt . fallback = not rt . renderTarget or not rt . shader
return rt
end
function rt3DDestroy ( rt )
if isElement ( rt . shader ) then
destroyElement ( rt . shader )
return nil
end
end
function rt3DSet ( rt )
if not rt then return end
if rt . renderTarget and not rt . fallback then
dxSetRenderTarget ( rt . renderTarget , true )
end
end
function rt3DDraw ( rt , x , y , w , h )
if rt . fallback then return end
dxSetShaderValue ( rt . shader , "sPicTexture" , rt . renderTarget )
dxDrawImage ( x , y , w , h , rt . shader , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 245 ), true )
end
function rt3DTransform ( rt , rx , ry , offset )
if rt . fallback then return end
if not offset then offset = 0 end
dxSetShaderTransform ( rt . shader , rx , ry , 0 , 0 , 0 , offset )
end
Wysłany: 2019-04-16, 20:25
Kuks*
Wiek: 15 Na forum: 3030 dni Posty: 246
Nick w MP: Kuks*
Piwa : 2208
SataN.
funkcja rt3DCreate zwraca tabel?
Wi?c zmienna renderTarget jest tabel? z warto?ciami w, h, shader, renderTarget i fallback
[ Dodano : 2019-04-16, 20:27 ]
A nie, cofam - fakt, zwraca tabel?, ale funkcje sobie tam z tej tabeli bior? dane, wi?c jest ok. P??niej mo?e to ogarn? to napisz?
Wysłany: 2019-04-18, 16:17
_jvneczek
Wiek: 22 Na forum: 4325 dni Posty: 1513
Nick w MP: _jvneczek
Piwa : 3949
Tagi: gui :: nie :: wyświetla
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: