Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- createObject(1999, 93, 1047.25793, 12.6, 0, 0, 180)
- local width, height = 1600, 900
- local cursorX, cursorY = width/2, height/2
- -- Create the browser
- local webBrowser = createBrowser(width, height)
- -- There is an issue with alpha at the moment --> render everything into a renderTarget first
- local renderTarget = dxCreateRenderTarget(width, height, true)
- -- Request the pages
- requestBrowserPages({"www.youtube.com", "nyan.cat"})
- addEventHandler("onClientRender", root,
- function()
- -- Update pixel data
- updateBrowser(webBrowser)
- -- Switch to the rendertarget (@issue above)
- dxSetRenderTarget(renderTarget)
- dxDrawImage(0, 0, width, height, webBrowser)
- dxDrawImage(cursorX, cursorY, 50, 50, "cursor.png")
- dxSetRenderTarget()
- -- Draw the line
- local x, y = 110.7, 1024.15
- dxDrawMaterialLine3D(x, y, 23.25, x, y, 14.75, renderTarget, 18.2, tocolor(255, 255, 255, 255), x, y+1, 19)
- x, y = 92.025, 1047.38
- dxDrawMaterialLine3D(x, y, 13.83, x, y, 13.47, renderTarget, 0.43, tocolor(255, 255, 255, 255), x, y+1, 19)
- end
- )
- addCommandHandler("nyan",
- function()
- outputChatBox("Nyan!")
- loadBrowserURL(webBrowser, "http://nyan.cat")
- end
- )
- addCommandHandler("url",
- function(cmd, url)
- if not url then return end
- requestBrowserPages({url})
- outputChatBox("Opening: "..url)
- loadBrowserURL(webBrowser, url)
- end
- )
- addCommandHandler("left",
- function(cmd,dist)
- cursorX = cursorX - (dist or 10)
- if cursorX < 0 then
- cursorX = 0
- end
- injectBrowserMouseMove(webBrowser, cursorX, cursorY)
- end
- )
- addCommandHandler("right",
- function(cmd,dist)
- cursorX = cursorX + (dist or 10)
- if cursorX > width then
- cursorX = width
- end
- injectBrowserMouseMove(webBrowser, cursorX, cursorY)
- end
- )
- addCommandHandler("up",
- function(cmd,dist)
- cursorY = cursorY - (dist or 10)
- if cursorY < 0 then
- cursorY = 0
- end
- injectBrowserMouseMove(webBrowser, cursorX, cursorY)
- end
- )
- addCommandHandler("down",
- function(cmd,dist)
- cursorY = cursorY + (dist or 10)
- if cursorY > height then
- cursorY = height
- end
- injectBrowserMouseMove(webBrowser, cursorX, cursorY)
- end
- )
- addCommandHandler("click",
- function()
- injectBrowserMouseMove(webBrowser, cursorX, cursorY)
- injectBrowserMouseDown(webBrowser, 0)
- injectBrowserMouseUp(webBrowser, 0)
- end
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement