summaryrefslogtreecommitdiff
path: root/meme
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2014-09-12 01:07:29 -0300
committerWerner Almesberger <werner@almesberger.net>2014-09-12 01:07:29 -0300
commit80fd84c94a958b18c7d55e1e725040232c457680 (patch)
tree408b9b70db7c6b3c5aa36eb700962c24a77b6ba5 /meme
parent6f5fe859d085a68d12deb5b1d4d9310dab81dd19 (diff)
downloadmisc-80fd84c94a958b18c7d55e1e725040232c457680.tar.gz
misc-80fd84c94a958b18c7d55e1e725040232c457680.tar.bz2
misc-80fd84c94a958b18c7d55e1e725040232c457680.zip
meme/gui.c: add section title comments
Diffstat (limited to 'meme')
-rw-r--r--meme/gui.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/meme/gui.c b/meme/gui.c
index 40c7432..9ff1d7b 100644
--- a/meme/gui.c
+++ b/meme/gui.c
@@ -30,6 +30,21 @@ static int zoom;
static bool show_grid = 1;
+/* ----- Coordinate transform ---------------------------------------------- */
+
+
+static inline int x_screen2model(int x)
+{
+ return ((x - (XRES >> 1)) << zoom)+x_orig;
+}
+
+
+static inline int y_screen2model(int y)
+{
+ return ((y - (YRES >> 1)) << zoom)+y_orig;
+}
+
+
static int coord(int w, int h, int x, int y,
Sint16 *res_x, Sint16 *res_y)
{
@@ -51,6 +66,9 @@ static int coord(int w, int h, int x, int y,
}
+/* ----- Draw the mesh ----------------------------------------------------- */
+
+
static void surface_draw(SDL_Surface *s, int w, int h)
{
const struct facet *f;
@@ -109,16 +127,7 @@ static void draw(SDL_Surface *s)
}
-static inline int x_screen2model(int x)
-{
- return ((x - (XRES >> 1)) << zoom)+x_orig;
-}
-
-
-static inline int y_screen2model(int y)
-{
- return ((y - (YRES >> 1)) << zoom)+y_orig;
-}
+/* ----- Event handling ---------------------------------------------------- */
static void button_event(SDL_MouseButtonEvent *button)
@@ -145,6 +154,9 @@ static void button_event(SDL_MouseButtonEvent *button)
}
+/* ----- Determine model extrema ------------------------------------------- */
+
+
static bool extrema_vertex(const struct vertex *v, void *user)
{
bool *first = user;
@@ -180,6 +192,9 @@ static void extrema(void)
}
+/* ----- Main loop --------------------------------------------------------- */
+
+
void gui(void)
{
SDL_Surface *surf;