Info
Get involved
Documentation
00001 /* 00002 SAL - Simple Application Library 00003 Copyright (C) 2006-2006 Kronon 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 00019 Kronon 00020 kronon88@users.sourceforge.net 00021 */ 00022 00023 //SAL data tree 00024 //Created by Kronon 00025 00026 #ifndef SAL_DTREE_H 00027 #define SAL_DTREE_H 00028 00029 //Libs with some class types 00030 //3th party SDL lib's 00031 #include "SDL/SDL_image.h" 00032 #include "SDL/SDL_ttf.h" 00033 #include "SDL/SDL_thread.h" 00034 #include "SDL/SDL_net.h" 00035 00036 //SAL headers 00037 #include "SAL_list.h" 00038 #include "gui/SAL_objects.h" 00039 00040 //Colors 00041 #include "SAL_colors.h" 00042 00043 //Handler classes 00044 struct SAL_action_handler 00045 { 00046 int (*action)(int); 00047 int (*mouse)(int, int, char, char); 00048 int (*keyboard)(SDLKey, SDLMod); 00049 }; 00050 00051 //Structures used to store variables for SAL 00052 //All gui objects 00053 struct SAL_int_gui 00054 { 00055 SAL_GuiContainer buttons; 00056 SAL_GuiContainer images; 00057 SAL_GuiContainer textboxes; 00058 SAL_GuiContainer inputBoxes; 00059 }; 00060 00061 struct SAL_int_checks 00062 { 00063 int start; 00064 bool alive; 00065 }; 00066 00067 struct SAL_int_render //Internal render variables 00068 { 00069 //TODO:deleteme bool lock; //Don't render 00070 SDL_Thread *thread; 00071 SDL_Surface *display; 00072 }; 00073 00074 struct SAL_int_application 00075 { 00076 00077 }; 00078 00079 struct SAL_network_listener 00080 { 00081 SDL_Thread *thread; 00082 salList<UDPsocket> sockets; 00083 SDLNet_SocketSet socketSet; 00084 }; 00085 00086 struct SAL_network_handler 00087 { 00088 int (*handler)(char *, IPaddress *); 00089 }; 00090 00091 struct SAL_int_event 00092 { 00093 //Mouse/keyboard based 00094 SDL_Thread *thread; 00095 SAL_action_handler action_handler; 00096 SAL_network_handler network_handler; 00097 salList<SAL_gui_object*> select_matrix[5][5]; 00098 salList<SAL_gui_object*> visable_objects; 00099 SAL_gui_object * active_object; 00100 Uint32 active_time; 00101 //Network based 00102 SAL_network_listener *last_network_listener; 00103 salList<SAL_network_listener*> network_listeners; 00104 salList<char> sockets_free; 00105 salList<UDPsocket> socketsOut; 00106 00107 }; 00108 00109 struct SAL_intern 00110 { 00111 //RemoveMe: SAL_GuiContainer clickables; 00112 SAL_int_checks checks; 00113 SAL_int_render render; 00114 SAL_int_application app; 00115 SAL_int_event event; 00116 SAL_int_gui gui; 00117 }; 00118 00119 //Color mask 00120 struct SAL_set_cmask 00121 { 00122 //Color masks 00123 int r; 00124 int g; 00125 int b; 00126 int a; 00127 }; 00128 00129 //Purerly the defaults for buttons 00130 struct SAL_set_button 00131 { 00132 int w; //Width of the button 00133 int h; //Height of the button 00134 //int next_id; //Next id for this button 00135 TTF_Font* font; //Font of the text 00136 Uint32 fgcolor; //Color of the text 00137 Uint32 bgcolor; //Color of the background 00138 Uint32 bocolor; //Color of the border 00139 Uint32 prcolor; //Color of the pressed border 00140 }; 00141 00142 //Gui object 00143 struct SAL_set_gui 00144 { 00145 SAL_set_button button; 00146 int keyboard_delay; 00147 int mouse_delay; 00148 }; 00149 00150 //Render settings 00151 struct SAL_set_render 00152 { 00153 int refresh_rate; 00154 string mode; 00155 SAL_set_cmask cmask; 00156 }; 00157 00158 //Audio settings 00159 struct SAL_set_audio 00160 { 00161 bool on; 00162 00163 }; 00164 00165 //Common settings 00166 struct SAL_set_common 00167 { 00168 Uint8 max_con_network_listener; 00169 Uint16 network_time_out_time; 00170 int (*network_time_out_function)(void); 00171 string library_dir; 00172 }; 00173 00174 //All SAL settings 00175 struct SAL_setting 00176 { 00177 SAL_set_gui gui; 00178 SAL_set_audio audio; 00179 SAL_set_render render; 00180 SAL_set_common common; 00181 }; 00182 00183 struct SAL_structure 00184 { 00185 SAL_intern internal; 00186 SAL_setting setting; 00187 }; 00188 00189 #ifndef __SAL_CORE__ 00190 extern SAL_structure SAL_struct; 00191 #else 00192 SAL_structure SAL_struct; 00193 #endif 00194 00195 #endif