ich muss eine Pendel programieren welches sich langsam abklingt ...
ich habe es geschafft dass sich die pendel um 360 grad dreht ...
zu nächst möchte ich dass es sich von einem anfangswinkel auf einen zweiten winkel bewegt und auf die startposition zurück kommt ...
habe das mit einer schleife versucht aber klappt nicht

ich bitte um hilfeee
mein porogramm :
Code: Alles auswählen
nclude <windows.h>
#include <windowsx.h>
#include <commctrl.h>
#include <string.h>
#include <stdio.h>
#include "Prototypen.h"
#include "Projekt39res.h"
#include <math.h>
BOOL Text_schreiben (HWND hwnd)
{
HDC hdc;
PAINTSTRUCT ps;
int farbmischung;
HBRUSH pinsel;
int x, y;
int radius = 10;
int r=150;
static double winkel = 0.5;
double delta_winkel = 0.01;
x = 300+r * cos (winkel);
y = 50+r * sin (winkel);
do
{
winkel= winkel+delta_winkel;
}
while(winkel <=3);
InvalidateRect (hwnd, NULL, TRUE);
hdc = BeginPaint(hwnd, &ps);
farbmischung = RGB(255, 0, 0);
pinsel = CreateSolidBrush(farbmischung);
SelectBrush(hdc,pinsel);
SetViewportOrgEx(hdc, 100,100,NULL);
Ellipse(hdc, (int) x - radius, y - radius, x + radius, y + radius);
MoveToEx (hdc, 300, 50, NULL);
LineTo (hdc, x, y);
Rectangle(hdc, 200, 40, 400, 50);
DeleteObject(pinsel);
EndPaint(hwnd, &ps);
UpdateWindow(hwnd);
return 0;
Edit by Xin: Codetags hinzugefügt