A few questions about gui's and derma

Hi. I’m starting on a new project. But i have a few questions before i start.

  1. I want to use images, for scoreboard, menu’s etc. I’ve exported a png into a vtf with vtfedit, and tried making a button, using this code:
    DermaImage = vgui.Create( “DImageButton”, DermaPanel )
    DermaImage:SetPos( 25, 50 )
    DermaImage:SetImage(“logo.vtf”) – Set your .vtf image
    It only shows up as as a purple square. What am i doing wrong?
  2. Is it possible to use custom fonts(one from dafont.com for example), for the draw.SimpleText method?

For number one, put the path for the image. Example:

If you have the image in

Make it:
DermaImage:SetImage( “hud/name.vtf” )

My file is stored in the root of the materials folder.
Do i need to create a vmt file?

I don’t know about draw.SimpleText, but I’ve always used the versatile draw.DrawText for all of my text drawing needs. In the format:

draw.DrawText( text, font, pos_x, pos_y, color, align )

For instance,

draw.DrawText( "Hello, World!", "ScoreboardText", 10, 20, color_white, 1 )

Will draw the text “hello, world!” with the “ScoreboardText” font centered around position (10,20) with a white color.

I personally like using the MenuLarge and ScoreboardText fonts as good alternatives to the default font, as headers or otherwise.

As to your first problem, yes you have to have a VMT and wakeboarder, that’s not correct. You don’t add the “.vtf” extension – you just include the name of the VMT file without the ‘.vmt’. This is because VMT files are used to define attributes for the texture, including where it is among other options. I would suggest taking an existing VMT file and copying it, then just changing the property “$basetexture” to the appropriate file path.