Jump to content

CreateInterface


Alienhead
 Share

Go to solution Solved by Josh,

Recommended Posts

Ok I found out why I was silent crashing with CreateInterface()

I am pulling my camera from the editor with this code :

    local camlist = world:GetTaggedEntities("maincamera")
    if camlist == nil then Notify("ERROR: No camera labeled 'maincamera' in scene!!!") end
    cam = camlist[1]

Then creating my interface:

        if ConsolePadfont == nil then
            ConsolePadfont = LoadFont("Fonts/JetBrainsMono-Bold.ttf")
        end

        --Create user interface
        ConsolePadui = CreateInterface(cam, ConsolePadfont, framebuffer.size)

Upon until just a day or two ago this worked fine..  

And I was deeply puzzled why it kept crashing at createinterface..  Then I removed the Camera from the main scene in the editor, 

Created my own camera via code. and it works fine.

 afont  = LoadFont("Fonts/JetBrainsMono-Bold.ttf")
 icam = CreateCamera(world)
 iface = CreateInterface(icam, afont, framebuffer.size)

So not sure if this is a bug or just the way things got changed... but thats what was happening.

 

Link to comment
Share on other sites

  • Solution

It should work if you just cast the entity to a camera:

cam = camlist[1]
cam = Camera(cam)

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

CreateCamera returns a Camera object.

GetTaggedEntities() returns a table of Entity objects. So the Entity has to be cast to a Camera before it can be used.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...