Benvenuto Visitatore(Log In|Registrati)

> Disegnare un orologio
Vincent
messaggio8 Feb 2015, 20:42
Messaggio #1





Gruppo: Gamer
Messaggi: 42
Iscritto il: 3 February 15
Da: Lecce, Italy
Utente Nr.: 20.669
BGE Psychic detective
Playing Phantasmagoria
SO Windows7




Ciao Ragazzi,
Sono nuovo nel forum è vorrei poter chiedere un opinione riguardo un problema che sto avendo..
Cerco in tempo reale di disegnare un orologio sulla mia room tramite il comando DrawLines.
Va tutto alla grande tranne il fatto che quando cerco di inizializzare il disegno il gioco interno incomincia ad andare a rilento...
Come se si stesse sforzando tantissimo a fare questa operazione...
La eseguo tramite repeatedly_execute_always()
Dato che dovrebbe disegnare le linee ad ogni frame al secondo...
Qualcuno potrebbe darmi una mano ?
Grazie in anticipo ragazzi.

CODICE
DynamicSprite*backgroundCopy;

function DrawClock(this Object*, int centrex,  int centrey,  int radius)
{  

  DrawingSurface *ds = Room.GetDrawingSurfaceForBackground();
  backgroundCopy = DynamicSprite.CreateFromBackground(0);
  
  ds.Clear();
  ds.DrawImage(0, 0, backgroundCopy.Graphic);
  
  DateTime *dt = DateTime.Now;
  int gametimeh = dt.Hour;
  int gametimem = dt.Minute;
  int gametimes = dt.Second;
  //clock position and size
  
  ds.DrawingColor = 15; //white
  ds.DrawCircle(centrex, centrey, radius);
  ds.DrawingColor = 0; //black
  ds.DrawCircle(centrex, centrey, radius-1);
  ds.DrawingColor = 15; //white
  

  ds.DrawLine(centrex, centrey,
    centrex+FloatToInt(0.6*IntToFloat(radius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimeh)*30.0)), eRoundNearest),
    centrey-FloatToInt(0.6*IntToFloat(radius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimeh)*30.0)), eRoundNearest), 3);
  ds.DrawLine(centrex, centrey,
    centrex+FloatToInt(0.9*IntToFloat(radius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimem)*6.0)), eRoundNearest),
    centrey-FloatToInt(0.9*IntToFloat(radius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimem)*6.0)), eRoundNearest), 2);
  ds.DrawLine(centrex, centrey,
    centrex+FloatToInt(0.9*IntToFloat(radius)*Maths.Sin(Maths.DegreesToRadians(IntToFloat(gametimes)*6.0)), eRoundNearest),
    centrey-FloatToInt(0.9*IntToFloat(radius)*Maths.Cos(Maths.DegreesToRadians(IntToFloat(gametimes)*6.0)), eRoundNearest), 1);  

  ds.Release();
  this.Graphic = backgroundCopy.Graphic;
  backgroundCopy.Delete();
}


--------------------
 

Inserisci in questo messaggio


Reply to this topicStart new topic
1 utenti stanno leggendo questa discussione (1 visitatori e 0 utenti anonimi)
0 utenti:

 

Modalità di visualizzazione: Passa a: Normale · Passa a: Lineare · Outline


Versione Lo-Fi Oggi è il: 16th November 2026 - 05:46