Autor Beitrag
Pyr0cracker
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 164

Win XP, Ubuntu 8.04, openSUSE 11.0
Delphi 7 Personal
BeitragVerfasst: Mo 07.04.03 11:16 
Hallo, kann mir jemand sagen wie ich ein "RealToInt" erzeugen kann?
gibt ja keinen Befehl dafür.
Ich brauche das um den Winkel auszurechnen:
ausblenden Quelltext
1:
2:
button1.top := button1.top + cos(winkelx);
button1.left := button1.left + sin(winkelx);

Wenn jemand eine möglichkeit hat bitte sagen !

danke,
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 07.04.03 11:16 
Versuchs mal mit round(), denn int kann ja keine Dezimalstellen aufnehmen.

Gruß
Klabautermann
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Veteran
Beiträge: 6366
Erhaltene Danke: 60

Windows 7, Ubuntu
Delphi 7 Prof.
BeitragVerfasst: Mo 07.04.03 11:20 
Wenn du einfach die Nachkomastellen abschneiden willst, dann ist Trunc dein Befehl.

Gruß
Klabautermann
Pyr0cracker Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 164

Win XP, Ubuntu 8.04, openSUSE 11.0
Delphi 7 Personal
BeitragVerfasst: Mo 07.04.03 11:24 
Dann is es aber immer noch REAL.
Gibts denn keinen RealToInt-ähnlichen Befehl?
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Mo 07.04.03 11:33 
Falsch, sowohl Trunc, als auch round geben einen Int64 zurück, also kein real
LCS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1305
Erhaltene Danke: 1

WIN 7, WIN 8
Delphi XE5, Delphi XE, Delphi 2007
BeitragVerfasst: Mo 07.04.03 11:35 
Hi
Trunc liefert einen Integer zurück. Du kannst also einfach schreiben:
ausblenden Quelltext
1:
2:
button1.top := button1.top + trunc(cos(winkelx));
...


Gruss Lothar

_________________
Der BH ist für die Brust, der Plan ist für'n Ar...