Jump to content

Averice

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by Averice

  1. Looks like it's coming along nicely, I think you should have the enemies only make the alert sound sometimes so they can sneak up on the player occasionally, at the moment it pretty much alerts you of it's presence right away which makes it easy to pre-aim and kill. Something like if prevmode~="chase" then if self.sound.alert and math.random(1, 100) < 25 then self.entity:EmitSound(self.sound.alert); end end -- 25% chance of alerting of presence. On a side note I'm working on the map for the menu background of my game, it's themed in a Spacestation
  2. No I've disabled sandboxing so I can use require, and require works fine except when I try to require .dll
  3. import tries to read it as lua and gives me lua errors on the symbols inside the file.
  4. I don't know if this is on purpose or not but whenever I require a non-lua library it crashes before launching, I can just ffi the C versions of these libs but that's not what I want to do. Is there any ideas on why this is? It's not the libraries themselves as they run perfectly with the lua interpreter outside leadwerks.
  5. Over the past few days I've been porting a GUI library I've written in Lua, it's been a pretty successful and struggle free move over to Leadwerks which has excited me over the future of my time with Leadwerks. I'll give a rundown of what features I've implemented. - Text entry panels with carrat positioning and text clipping. - Labels with multi-line wrapping. - Scroll panels with mousewheel support. - Panel hierarchy with parent-child clipping. - Button and hover events, keytouch events and focus events. - Panel order of precedence via shardui.paintOver(myPanel) - Tool tips for those vague looking buttons. - Scissor rect support - shardui.scrissorStart(x, y, w, h) shardui.scissorEnd() - Simple way of creating your own unique UI items. - Skin system. To give an idea of how it's used I'll show a bit of code. -- In App.start after you've created your graphics context you simple load the ui lib. import "Scripts/shardui/shard.lua"; -- This will include all sub files and folders -- in App.loop - After world rendering so the UI is ontop. shardui.think(); -- Always before paint. shardui.paint(); -- And that's it, the UI lib has been loaded successfully. -- Now to create a panel ( do not create panels in App.loop, they only need to be made once. ); myPanel = shardui.createPanel("ShardFrame") -- second argument to this would be the panel to parent it too, you'll see later on. myPanel:SetPos(100, 100); -- x, y positioning myPanel:SetSize(400, 500); myPanel:SetTitle("TestPanel"); myPanel:SetVisible(true); -- visibility toggling. myPanel:EnableDragging(true); -- Enable dragging by grabbing the title bar. -- Now we'll add a label in the panel. myLabel = shardui.createPanel("ShardLabel", myPanel) -- myPanel is the parent panel. myLabel:SetPos(2, 22); -- Relative positioning to parents positiong. myLabel:SetSize(100, 20); myLabel:SetMaxWidth(100); -- max width, it will line wrap if it's longer than 100 pixels. myLabel:SetColor(ColorL(255, 100, 100, 255)); -- If you don't like the skins color but don't want to create a skin, use this. myLabel:SetText("Hello Leadwerks Community"); Easy as. A console with lua script support I created with the library.
  6. GetMousePosition().z is what I was looking for, thanks!
  7. Currently porting my GUI lib to leadwerks and decided to port my console over. It took a few tweaks but overall it was really easy to port over. The text entry does move and clip text so you can see what you're doing if it's out of the boxs bounds, it also has carrat positioning, line wrapping and scrollbars are there too. Parenting and dragging are supported. Does anyone know if there is a keycode for the mousewheel up and mousewheel down in lua yet?
  8. Sorry for the double post, but if anyone else is looking for a working glScissor ( or other gl functions ) I've managed to get it working using luajits ffi library. ffi = require "ffi"; gl = ffi.load("OPENGL"); -- windows. ffi.cdef[[ enum { GL_SCISSOR_TEST = 0x0C11 }; typedef unsigned int GLenum; typedef int GLint; typedef int GLsizei; void glEnable(GLenum cap); void glScissor (GLint x, GLint y, GLsizei width, GLsizei height); ]] Usage: gl.glEnable(gl.GL_SCISSOR_TEST); gl.glScissor(0, 0, 100, 100); -- draw stuff gl.glScissor(0, 0, scrwidth, scrheight); The only difference is the origin is bottom left instead of top left so I've provided this. function math.glreverse(y, objH) -- y is the position on the y axise, objH is the height of the obj you want to place at y return (App and App.context) and App.context:GetHeight() - y - objH or 0; end
  9. Set the camera as a variable on the entity? That way you can just lookup the entities own camera from the entity itself.
  10. It let's you specify a rectangle on the screen in which anything drawn outside it during that pass is not actually drawn, it's part of openGL I was just wondering if it had been bound to Lua for leadwerks at all. glScissor(x, y, width, height) -- small rect -- Draw stuff glScissor(0, 0, screenwidth, screenheight) -- return to normal
  11. I might have completely missed it if it's already there but can anyone tell me if there is a version of glScissor for Leadwerks Lua? Or if it's planned at all? Thanks
×
×
  • Create New...