This commit is contained in:
2022-10-14 17:25:23 +02:00
parent a3cf02fac4
commit a2f0837add
7 changed files with 21707 additions and 24 deletions

View File

@@ -1,6 +1,4 @@
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
/**
@@ -9,15 +7,25 @@ import javax.swing.JFrame;
public class Fun {
public static void main(String[] args) {
FunPanel p = new FunPanel();
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(100, 100);
frame.setSize(700, 700);
frame.add(p);
FunPanel p = new FunPanel();
frame.add(p, BorderLayout.CENTER);
frame.setVisible(true);
p.repaint();
while (true) {
FunPanel.table += 0.001d;
p.repaint();
try {
Thread.sleep(16L);
} catch (Exception e) {
}
}
}
}

View File

@@ -2,8 +2,8 @@ import javax.swing.JPanel;
import java.awt.*;
public class FunPanel extends JPanel {
private int table = 3;
private int limit = 150;
public static double table = 50;
public static int limit = 30;
public FunPanel() {
super();
@@ -18,14 +18,25 @@ public class FunPanel extends JPanel {
gg.fillRect(this.getX(), this.getY(), getWidth(), getHeight());
}
double size = (double)getX();
System.out.println(size);
double size = (double)(getWidth() > getHeight() ? getHeight() : getWidth()) / 2.5d;
gg.setColor(Color.RED);
gg.setColor(Color.BLACK);
for (double i = 0; i < limit; i++) {
double theta = (i / (double)limit) * Math.PI * 2;
gg.fillOval((int)(Math.cos(theta) * size) + getX() / 2, (int)(Math.sin(theta) * size) + getY() / 2, 10, 10);
gg.fillOval((int)(Math.cos(theta) * size) + getWidth() / 2, (int)(Math.sin(theta) * size) + getHeight() / 2, 6, 6);
for (double j = 0; j < limit; j++) {
double theta2 = (table * j / (double)limit) * Math.PI * 2;
int x1 = (int)(Math.cos(theta) * size) + getWidth() / 2;
int x2 = (int)(Math.cos(theta2) * size) + getWidth() / 2;
int y1 = (int)(Math.sin(theta) * size) + getHeight() / 2;
int y2 = (int)(Math.sin(theta2) * size) + getHeight() / 2;
gg.drawLine(x1 + 3, y1 + 3, x2 + 3, y2 + 3);
}
}
}
}

20
Fun/pointeurs.c Normal file
View File

@@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
struct t {
int a;
int b;
char c;
};
typedef struct t quatre;
int main(int argc, char** argv) {
quatre katr = {2, 3, 'q'};
printf("%d\n", katr.a);
quatre* katreu = &katr;
printf("%d\n", katreu->b);
}