-
Posts
11 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by zack57
-
-
Ok I tryed that as well no text comes on the sceen?
main.lua
function App:Start()
self.window = Window:Create()
self.context = Context:Create(self.window)
local font = Font:Load("Fonts/Arial.ttf",36)
self.context:SetFont(font)
font:Release()
return true
end
function App:Loop()
if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end
self.context:SetColor(0,0,0)
self.context:Clear()
--Draw some centered text on the screen
local text = "Leadwerks"
local font = self.context:GetFont()
local x = self.window:GetWidth()/2
local y = self.window:GetHeight()/2
x = x - font:GetTextWidth(text)/2
y = y - font:GetHeight()/2
self.context:SetBlendMode(Blend.Alpha)
self.context:SetColor(1,1,1)
self.context:DrawText(text,x,y)
self.context:SetBlendMode(Blend.Solid)
self.context:Sync()
return true
end
--Initialize Steamworks (optional)
Steamworks:Initialize()
--Initialize analytics (optional). Create an account at www.gameamalytics.com to get your game keys
--[[if DEBUG==false then
Analytics:SetKeys("GAME_KEY_xxxxxxxxx", "SECRET_KEY_xxxxxxxxx")
Analytics:Enable()
end]]
--Set the application title
title="Training_For_Life"
--Create a window
local windowstyle = window.Titlebar
if System:GetProperty("fullscreen")=="1" then windowstyle=windowstyle+window.FullScreen end
window=Window:Create(title,0,0,System:GetProperty("screenwidth","1024"),System:GetProperty("screenheight","768"),windowstyle)
window:HideMouse()
--Create the graphics context
context=Context:Create(window,0)
if context==nil then return end
--Create a world
world=World:Create()
world:SetLightQuality((System:GetProperty("lightquality","1")))
--Load a map
local mapfile = System:GetProperty("map","Maps/start.map")
if Map:Load(mapfile)==false then return end
prevmapname = FileSystem:StripAll(changemapname)
--Send analytics event
Analytics:SendProgressEvent("Start",prevmapname)
while window:KeyDown(Key.Escape)==false do
--If window has been closed, end the program
if window:Closed() then break end
--Handle map change
if changemapname~=nil then
--Pause the clock
Time:Pause()
--Pause garbage collection
System:GCSuspend()
--Clear all entities
world:Clear()
--Send analytics event
Analytics:SendProgressEvent("Complete",prevmapname)
--Load the next map
if Map:Load("Maps/"..changemapname..".map")==false then return end
prevmapname = changemapname
--Send analytics event
Analytics:SendProgressEvent("Start",prevmapname)
--Resume garbage collection
System:GCResume()
--Resume the clock
Time:Resume()
changemapname = nil
end
--Update the app timing
Time:Update()
--Update the world
world:Update()
--Render the world
world:Render()
--Render statistics
context:SetBlendMode(Blend.Alpha)
if DEBUG then
context:SetColor(1,0,0,1)
context:DrawText("Debug Mode",2,2)
context:SetColor(1,1,1,1)
context:DrawStats(2,22)
context:SetBlendMode(Blend.Solid)
else
--Toggle statistics on and off
if (window:KeyHit(Key.F11)) then showstats = not showstats end
if showstats then
context:SetColor(1,1,1,1)
context:DrawText("FPS: "..Math:Round(Time:UPS()),2,2)
end
end
--Refresh the screen
context:Sync(true)
end
-
I must be missing something I did try that extenz but I can't seem to see anything. when I run it the frist time I got an error then I run it again and I got no error.
-
I did put this in a text.lua and the put the pivot for the text.lua and put the pivot as a child of the fpsplayer. The in the text.lua I see Script: PostRender I hope this is what you mean?
-This function will be called after the world is rendered, before the screen is refreshed.
--Use this to perform any 2D drawing you want the entity to display.
function Script:PostRender(context)
function App:Start()
self.window = Window:Create()
self.context = Context:Create(self.window)
local font = Font:Load("Fonts/Arial.ttf",36)
self.context:SetFont(font)
font:Release()
return true
end
function App:Loop()
if (self.window:Closed() or self.window:KeyDown(Key.Escape)) then return false end
self.context:SetColor(0,0,0)
self.context:Clear()
--Draw some centered text on the screen
local text = "Leadwerks"
local font = self.context:GetFont()
local x = self.window:GetWidth()/2
local y = self.window:GetHeight()/2
x = x - font:GetTextWidth(text)/2
y = y - font:GetHeight()/2
self.context:SetBlendMode(Blend.Alpha)
self.context:SetColor(1,1,1)
self.context:DrawText(text,x,y)
self.context:SetBlendMode(Blend.Solid)
self.context:Sync()
return true
end
end
-
I am new to Lua, I am trying to learn Lua but I can's seem to get the text to show on the screen. Josh send me this link
http://www.leadwerks.com/werkspace/page/api-reference/_/context/contextdrawtext-r731 .
I have tried to put it in main.lua, tried to create text.lua, I tried to put it in a child of the player as a pivot but nothing shows up. I am trying to learn lua show I need to see the test to know I did it if you know what I mean?
-
In the picture I have a terrain and vegetation. When I move the vegetation moves with me. Not sure if I am making the water right or not.
https://postimg.org/image/ngb6h3sk7/
-
When I try to search the Halloween Model Pack I get the Xml error.
-
-
I am trying to get the light or lights close to right. Any ideas what I can do? I have tried Point Light, Directional Light and a Spot Light tried to adjusting the Properties but can't get close to right lighting for this room. when I tried the Directional Light I adjusting the Range but seem to me it go the the other room then just this this room. So I tried the Point Light but it gets to bright or it is to dark in the corners.
In both of these Pictures I just used the Directional Light so the pictures would not be dark.
-
Yes I have looked at them. I read the frist one the Editor Interface.
-
I just got Leadwerks on steam today and I seem to think that it is in beta still but I do not know. I have mapped for few games but never had these problems before as I am still learning Leadwerks. The grid snap it looks like it dose not snap right on the line when I go to grid 8 and as well it dose not stay on grid 8 it goes back to grid 32. When I look at the Tutorials on the site I do not see the "maybe very basic" basics tutorials and I am getting confused where to start here. I just created a basics room figure a little bit how things work in the editor. How do you change the keys and look at them in the editor? When I use the arrows keys in the 2d window it is really slow? When I move 2 or more brushes the bottom part of the brush moves off the grid line? I really like the layout of the editor. When I was testing the maps that come with Leadwerks I got confused how you test the level I when to the render in the menu bar it kept going to some kind of screen shot and it was under Game of the menu bar I would have not look there. I hope someone can help me out here.
Thanks,
Zack
Text on the screen
in Programming
Posted
Thanks for all the help guys!