Jump to content

L B

Members
  • Posts

    967
  • Joined

  • Last visited

Everything posted by L B

  1. I think Graphics() does much more than just a normal initialization. Contact Josh about this, I'm no help with C# in this case.
  2. Has anybody converted the wizard? If so, how? I need help on this one :/
  3. http://leadwerks.com/werkspace/index.php?/tracker/issue-12-editor-rescaling-not-saving/
  4. L B

    Why Apple Fails

    I take it as if they don't want or feel like they need any game or intense graphics application on a Mac, since their users wouldn't use them. It's just a vicious circle: don't provide us the means of making a game, we won't make one. Their won't be gamers on Mac, so you won't provide us the means of making a game. Etc, etc.
  5. Scaling doesn't even work at the moment, for this specific reason. Josh has no intent to support it. Look at the tracker.
  6. L B

    Framewerk

    Framewerk is basically the most global effect portal to Leadwerks. If you want to combine it with yours, I'd rather suggest you customize it, as the C++ and BMX headers are open-source.
  7. Here you go with a simple implementation of my OOP drawing system. It's a simple button class that can be used in any way you like. Call "Button.Update()" right before "Graphics.Flip()". Feel free to make a list that updates all of them, I'm simply sharing this class. Couldn't make it part of any other release, really. public enum ButtonState { Idle, Hover, Clicked, Down } public class Button { public Texture IdleTexture { get; set; } public Texture HoverTexture { get; set; } public Texture ClickedTexture { get; set; } public Texture DownTexture { get; set; } public ButtonState State { get; private set; } public Image Image { get; private set; } public Button(Image image) { this.State = ButtonState.Idle; this.Image = image; this.IdleTexture = this.Image.Texture; this.ClickedTexture = this.Image.Texture; this.HoverTexture = this.Image.Texture; this.DownTexture = this.Image.Texture; } public void Update() { this.State = ButtonState.Idle; if ( Mouse.X >= this.Image.X && Mouse.Y >= this.Image.Y && Mouse.X <= this.Image.X + this.Image.Width && Mouse.Y <= this.Image.Y + this.Image.Height ) { this.State = ButtonState.Hover; if (Mouse.ButtonDown(MouseButton.Left)) { this.State = ButtonState.Down; } if (Mouse.ButtonHit(MouseButton.Left)) { this.State = ButtonState.Clicked; } } switch (this.State) { case ButtonState.Clicked: this.Image.Texture = this.ClickedTexture; break; case ButtonState.Down: this.Image.Texture = this.DownTexture; break; case ButtonState.Hover: this.Image.Texture = this.HoverTexture; break; case ButtonState.Idle: this.Image.Texture = this.IdleTexture; break; } Drawing.SetBlend(BlendType.Alpha); this.Image.Draw(); Drawing.SetBlend(BlendType.None); } }
  8. Without any intent to be offensive, most of the things you said are obsolete or wrong. First of all, there are few third party libraries that you will need for C#, considering it's backed up by a completele framework. In other cases, I have always found what I needed as 3rdPL to make my application work. The easiness of a language is really subjective, so I won't comment on this. C# is not Windows only anymore, since Mono is out of Beta and DotGNU is coming along pretty nicely, as far as I know. I have run many applications on Linux, although I do not have a Mac to test.
  9. L B

    Custom Buffer

    Instead of Dim light As IntPtr = 0 light = CreateDirectionalLight(0) Use something as: Dim light As Light = Light.CreateDirectional()
  10. L B

    .NET Headers

    Oh boy, don't get me started on VS2010. I couldn't even write a hello world without my computer to display a blue screen of death.
  11. L B

    Custom Buffer

    Why am I seeing IntPtr's? This is not part of my headers.
  12. L B

    .NET Headers

    Once the source is complete I'll post it, although a DLL can be used with any .NET language and is easier to integrate. If you don't obfuscate your code, this DLL gets distributed with your executable, and is just like giving away headers + engine.dll, which are the core of Leadwerks.
  13. xPos = ScreenWidth() / 4; So to transfer your value (0.25) to what could be used, use: int XPercentToPixel(float percent) { return percent * ScreenWidth(); } int YPercentToPixe(float percent) { return percent * ScreenHeight(); } If you have an alpha channel in a DDS file you render to the screen, transparency will be enabled. You cannot have alpha programmed, as far as I know. I suggest using the OOP drawing approach in my C# wrapper, if that's not too much of a hassle for you. Porting is easy too. More information here.
  14. L B

    .NET Headers

    Initial release. Please post bugs and whatnot. This is not made for your game, as it is not dotfuscated. If you want to use it, dotfuscate the headers before using them. It is illegal not to do so. Please refer to this thread now: http://leadwerks.com/werkspace/index.php?/topic/602-c-headers-mini-roadmap/
  15. L B

    C# Framewerk

    For now I am reserving this post for when I'll be done with the Framewerk. I'm progressing quite well
  16. L B

    .NET Headers

    This thread is outdated. Please see: .NET Leadwerks wrapper on Google Code This wrapper and its child projects are being developed and maintained by TylerH, ZioRed, klepto2 and myself. Enjoy Leadwerks for .NET!
  17. If you're not planning on any intense game, I suggest you simply copy an example code for LUA integration from a C++ or BlitzMax tutorial, then make your whole game in LUA. Or you could wait for my C# wrapper, which will have an all-in-one LUA integration, such as "Scripting.Initialize();".
  18. Awesome news. Interesting charts, too.
  19. If only we could edit a GMF file to either group surfaces or change the .mat file of a surface. I'd be fully happy.
  20. How would I access these objects? I just want to place my streetlamp entity and it already has the light on it. I copied the code from the point light script into the streetlamp script, and it works fine. I have a point light, but at the origin of the model, which is way too low. How would I go making "entity.light" move up? I tried "entity.light:Move(0, -2, 0)" but this doesn't work. dofile("Scripts/base.lua") -- We need the base class entity function InitDialog(grid) base_InitDialog(grid) group=grid:AddGroup("Light") group:AddProperty("Resolution",PROPERTY_CHOICE,"256,512,1024,2048") group:AddProperty("linearoffset",PROPERTY_FLOAT,"0,1,2","Linear offset") group:AddProperty("multoffset",PROPERTY_FLOAT,"0,1,2","Multiplicative offset") group:AddProperty("Range",PROPERTY_FLOAT,"1,100,0") group:Expand(1) end function Spawn(model) local entity=base_Spawn(model) entity.model=model entity.light=CreatePointLight(10,model) return entity end function GetKey( model, key, value ) local entity=entitytable[model] if entity==nil then return value end if entity.model==nil then return end if entity.light==nil then return base_GetKey(model,key,value) else if key=="linearoffset" then return entity.light:GetShadowOffset(0,0)--..","..entity.light:GetShadowOffset(0,1)..","..entity.light:GetShadowOffset(0,2) elseif key=="multoffset" then return entity.light:GetShadowOffset(1,0)--..","..entity.light:GetShadowOffset(1,1)..","..entity.light:GetShadowOffset(1,2) elseif key=="range" then return entity.light:GetRange() else return base_GetKey(model,key,value) end end end function SetKey(model, key,value) local entity=entitytable[model] if entity==nil then return 1 end if entity.model==nil then return 1 end if entity.light==nil then base_SetKey(model,key,value) else if key=="resolution" then if value=="0" then entity.light:SetShadowmapSize(256) elseif value=="1" then entity.light:SetShadowmapSize(512) elseif value=="2" then entity.light:SetShadowmapSize(1024) elseif value=="3" then entity.light:SetShadowmapSize(2048) end elseif key=="range" then entity.light:SetRange(value) elseif key=="shadowresolution" then resolution=entity.light:GetShadowmapSize() if resolution==256 then return 0 elseif resolution==512 then return 1 elseif resolution==1024 then return 2 elseif resolution==2048 then return 3 else return -1 end elseif key=="multoffset" then entity.light:SetShadowOffset(entity.light:GetShadowOffset(0,0),value,0) elseif key=="linearoffset" then entity.light:SetShadowOffset(value,entity.light:GetShadowOffset(1,0),0) else return base_SetKey(model,key,value) end end return 1 end --[[ dofile("Scripts/baseclass.lua") -- We need the base class entity dofile("Scripts/table.lua") -- We need the table.Inherit function -- Set this script"s Entity table to an inherit of BaseClass"s entity table EntityNew = { } Entity = table.Inherit(EntityNew, Entity) function Entity:Spawn(model) if (model == nil) then Notify("Entity passed to Entity:Spawn is nil") end Entity.BaseClass:Spawn(model) -- Since the entity object is passed to the BaseCLass spawn, it is in Entity.BaseClass.model, we need to either remove the above line and uncomment the one below, or simply leave both -- If you are wondering why Entity.model isn"t inherited at the top of the script when we called table.Inherit, it is because we had not yet defined an Entity.model variable -- You will come to notice that variables we assign via BaseClass functions AFTER inheritence will not exist from this Entity scope. We can still access them via Entity.BaseClass.variablename --Entity.model = Entity.BaseClass.model -- Hold onto you for later use and add it to this scope self.model = model model:SetKey("intensity","1") self.light = CreatePointLight(10,model) self.speed=1.0 end function Entity:SetKey(key,value) if self.model==nil then return 1 end if self.light==nil then self.BaseClass:SetKey(key,value) else if key=="resolution" then if value=="0" then self.light:SetShadowmapSize(256) elseif value=="1" then self.light:SetShadowmapSize(512) elseif value=="2" then self.light:SetShadowmapSize(1024) elseif value=="3" then self.light:SetShadowmapSize(2048) end elseif key=="muloffset" then self.light:SetShadowOffset(0,tonumber(value),0) elseif key=="range" then self.light:SetRange(value) elseif key=="shadowresolution" then resolution=self.light:GetShadowmapSize() if resolution==256 then return 0 elseif resolution==512 then return 1 elseif resolution==1024 then return 2 elseif resolution==2048 then return 3 else return -1 end else return self.BaseClass:SetKey(key,value) end end return 1 end function Entity:InitDialog(grid) self.BaseClass:InitDialog(grid) group=grid:AddGroup( "Light" ) group:AddProperty( "Resolution", "1|256,512,1024,2048", PROPERTY_CHOICE, "" ) group:AddProperty( "muloffset","|0,1,2",PROPERTY_FLOAT,"Mult offset" ) group:AddProperty( "range","|1,100,0",PROPERTY_FLOAT,"" ) group:Expand(1) end function Entity:ReceiveMessage(message,extra) if message=="toggle" then if self.model:Hidden()==1 then self.model:Show() else self.model:Hide() end else end end ]]--
×
×
  • Create New...