⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 world.h

📁 神经网络和遗传算法组合应用
💻 H
字号:
#ifndef WORLD_H#define WORLD_H#include <stdio.h>#include <stdlib.h>#include <gdk/gdk.h>#include <gtk/gtk.h>#include "callbacks.h"#include <unistd.h>#define GUI_COLORS 6#define GUI_WHITE 0#define GUI_BLACK 1#define GUI_BLUE 2#define GUI_RED 3#define GUI_GREEN 4#define GUI_YELLOW 5typedef struct Window{  GtkWidget *window;  GdkColormap *cm;  GdkColor **palette;  GdkGC *pen;  GtkDrawingArea *da;  gint w;  gint h;  GdkPixmap *bb;  Window *next;};/* Draw */extern void gui_drawRobot(int x, int y, double direction, int radius,int drawOrErase, int color);extern void gui_drawWall(int x1, int y1, int x2, int y2);extern void gui_drawSObst(int x, int y, int radius);extern void gui_drawObst(int x, int y, int radius);extern void gui_drawZone(int x, int y, int radius);extern void gui_drawLight(int x, int y, int radius);extern void gui_redrawWorld();extern void gui_setSensorWindow(int nrOfSens, int sensHeight, int sensHistory);extern void gui_setSensor(int i, float value);extern void gui_recreateWorld();extern void gui_setWorldSize(int x, int y);extern void gui_clearSensor();extern void gui_drawSensor(int sensor, int time, double value, int color);extern void gui_drawSensorMarker(int time);extern void gui_redrawSensors();extern void gui_clear();extern void gui_drawBG();extern void gui_drawGripper(int *a, int *b, int layer, int color,int c);extern void gui_updateSensorWindow(int robotNr);/* Creates a new window    with specified dimensions in pixels   and title as specified by title.   It has a preallocated gray scale    palette with 256 entries   Returns the newly created window*/extern Window *gui_window_new(gint width, gint height,			      const gchar *title);/*  Changes the palette entry of window specified with  color [0..255] with the new values  specified by red, green, blue [0..65536]*/extern void gui_window_palette_change(Window *window,				      gint color,				      guint red,				      guint green,				      guint blue);/*  Sets the current drawing color*/extern void gui_window_set_color(Window *window,				 gint color);/*  Draws a line between point x1,y1 and x2,y2*/extern void gui_window_line(Window *window,			    gint x1, gint y1,			    gint x2, gint y2);/*  Draws a rectangle with the corner  x1,y1 and x2,y2. Filled [0..1] where  0 is non filled and 1 is filled. */extern void gui_window_rectangle(Window *window,				 gint x1, gint y1,				 gint x2, gint y2,				 gint filled);/*  Draws a circle with center x,y and radius  radius. Filled [0..1] where 0 is non filled  and 1 is filled.*/extern void gui_window_circle(Window *window,			      gint x, gint y,			      gint radius,			      gint filled);/*  Draws a arc with center x,y from startAngle  specified in degrees where 0 degrees is at   3 o'clock and ends the arc at the endAngle  specified relative startAngle.  The arc is drawn counter clockwise.  Filled [0..1] where 0 is non filled and  1 is filled. */extern void gui_window_arc(Window *window,			   gint x, gint y,			   gint radius,			   gint filled,			   gint startAngle,			   gint endAngle);/*  Plots a pixel with the current color  at point x,y.*/extern void gui_window_plot(Window *window,			    gint x, gint y);/*  Clears the window using the color specified  with the index color [0..255].*/extern void gui_window_clear(Window *window,			     gint color);/*  Flushes all draws to window to screen.  Call when you want the window to be updated.*/			 extern void gui_window_flush(Window *window);#endif /* WORLD_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -