Real Time
[Release] Bubble Chat  »

AroliS^

  • Newbie
  • Learning of Mike Tyson K.O
  • Posts: 46
Real Time
«  »Last edited
it is working great!
Code: [Select]
   
function Script::ScriptProcess()
{     
local time = System.GetDate( System.GetTimestamp( ), 'r' );
::time[ "date" ].Text = time.hour +" : "+ time.min;
}

in somewhere in your clientside's script!
Code: [Select]
function labelcreator( pos, colour, resizable )
{
local ui = GUILabel( pos, colour, resizable );
return  ui;
}

::time <-
{
date = labelcreator( VectorScreen( sX * 0.671, sY * 0.115 ), Colour( 255, 255, 255 ), true )
}

::timer[ "date" ].FontSize = sX * 0.025;




pastebin - https://pastebin.com/YUZPZkxz

dracc

  • Jr. Member
  • Posts: 84
Re: Real Time
« Reply #1,  »
Well, you run System.GetDate and update the GUILabel on every single processed frame - no wonder it's slow.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,805
Re: Real Time
« Reply #2,  »
Quote from dracc on May 21st, 09:01 AM
Well, you run System.GetDate and update the GUILabel on every single processed frame - no wonder it's slow.
Updating a GUI already happens at every frame.

His problem is that he is changing the font size at every frame. Which means the font atlas must be re-built on every frame. And that will actually kill your performance.

Basically it all boils down to this line:
Code: [Select]
::timer[ "date" ].FontSize = sX * 0.025;

This is a known issue. Pick a set of fonts and sizes and stick with them. Otherwise use a pre-generated image with the text and scale that.
.

AroliS^

  • Newbie
  • Learning of Mike Tyson K.O
  • Posts: 46
Re: Real Time
« Reply #3,  »
Updated it thank u :)

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 445
Re: Real Time
« Reply #4,  »
You are genius bro ;X

i don't know when i made my own server with helpless...
Try to UnderStand ME!

[Release] Bubble Chat  »