Post

Visualizzazione dei post da febbraio, 2020

Hello world - Progress Bar (Loading...)

Immagine
Vector2 m_Position = {100, 100}; Vector2 m_Size = {400, 20}; Vector2 m_ProgressBar_Size = m_Size; int m_Progress = 0;  // Update m_Progress  m_Progress_Rectangle.setPosition(m_Position);  m_ProgressBar_Size.x = (m_Size.x / 100)*m_Progress;  m_Progress_Rectangle.setSize( m_ProgressBar_Size );  print( "Loading...%d%" , m_Progress); 

Hello world - Game Loop

// Ver.1 - Easy Loop --------------------------------------------------- while( true ) {   processInput();   update();   render(); } // Ver. 2 - Add Time and FPS --------------------------------------------------- MS_PER_FRAME 16 //60 FPS == 16 millisecondi per frame   while( true ) {   double  start  =  getCurrentTime();   processInput();   update();   render();   sleep( start  +  MS_PER_FRAME  -  getCurrentTime ()); }