From 06ad4a23a0c8366c20b28463d1829cd5637fde33 Mon Sep 17 00:00:00 2001 From: "Ben Russell (300178622)" Date: Sat, 16 Mar 2013 13:21:57 +1300 Subject: [PATCH] beginnings of a tutorial. will eventually be the double-click default. --- pkg/iceball/halp/font-large.tga | Bin 0 -> 11124 bytes pkg/iceball/halp/lib_sdlkey.lua | 279 +++++++++++++++++++++++++++++++ pkg/iceball/halp/main_client.lua | 51 ++++++ pkg/iceball/halp/main_server.lua | 22 +++ 4 files changed, 352 insertions(+) create mode 100644 pkg/iceball/halp/font-large.tga create mode 100644 pkg/iceball/halp/lib_sdlkey.lua create mode 100644 pkg/iceball/halp/main_client.lua create mode 100644 pkg/iceball/halp/main_server.lua diff --git a/pkg/iceball/halp/font-large.tga b/pkg/iceball/halp/font-large.tga new file mode 100644 index 0000000000000000000000000000000000000000..16b8a63a8f5a33bb00bbf05bc676d0535e985288 GIT binary patch literal 11124 zcmeI2t8U#u5Qgod<}LC9?OUW$q^gyAQ{TtHz`(%ZfPe!IFbE6?2q-8BEGP&p2rTF$ zxby9Qe(fGd=|z>IRN7S2z0J(d&U*gw?s3x|HO-UexZ&^UxOv(v@ke86mv(NuRNn4O z`trZ;(Ys3{=j|ALn>6-VWwv1{wsk>c&=AzOeIoi8qyIY9>F=6NJ2X?2eLDrYK8Ea& zc*iI=F+PMI_-=y6@CEwN-$i{$?J?<~e{(R7-ahe)e=1~c;}AT^^=YisjlJ05^+<>0 zs1IQ`w%NvQw6}YEu&dvbcxh+Zv9JsM9`pS819`2li}jDm2ei?L47{wb3&KBL%%Ao4 z&8N2RN*_B?ccsQkjTNDgP{Z}dk6_mkz2H3fD6A7!&e0a`YDM7T6gW5s!AqUe*a|)x zH<2^WW=|jkPoFT9`YwohENdCcvX6S%E_Gr9MBiG@>nX=de(SV8#?T=- ze+jZ)m)3_4^HMK$cz#Osc+7miDt84xa@k(lZCU4VY_RXH+Pc%(+u3u0Dy);C=f_QqwL*03hI=sf3bt$=gAFF%h-{(Peat$r^&g%LwO-vtbC-Q_kelny)t%Gt5sIN2b2a8F zTHc42%012}%3*WhIvz9jgZsjA{l4fNBkUJOTMs31w+mY1xNj_!4|KlM`PVpqw^R&E z7j+YJL)ux}C*p47Mde(Avb7-i$B5&J2-r2eN^+C2tEtxyA7U4M=N~r-zI)A65jH>Q|i%oGx{dv@a9|jM7Yb_ zzutG4oA*GS*?i7We5jB4%Xo2}5i;u++?BAUj~ALX9oyX=lgem@(nG2@7}yW`EdI7^!2M}A77llJbB*y1bPAQ AY5)KL literal 0 HcmV?d00001 diff --git a/pkg/iceball/halp/lib_sdlkey.lua b/pkg/iceball/halp/lib_sdlkey.lua new file mode 100644 index 0000000..e00dcd8 --- /dev/null +++ b/pkg/iceball/halp/lib_sdlkey.lua @@ -0,0 +1,279 @@ +--[[ + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2009 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +]] + +--[[ + part of SDL_keysym.h, converted to Lua by GreaseMonkey in 2012 + accurate as of libSDL-1.2.so.0.11.3 +]] + +SDLK_UNKNOWN = 0 +SDLK_FIRST = 0 +SDLK_BACKSPACE = 8 +SDLK_TAB = 9 +SDLK_CLEAR = 12 +SDLK_RETURN = 13 +SDLK_PAUSE = 19 +SDLK_ESCAPE = 27 +SDLK_SPACE = 32 +SDLK_EXCLAIM = 33 +SDLK_QUOTEDBL = 34 +SDLK_HASH = 35 +SDLK_DOLLAR = 36 +SDLK_AMPERSAND = 38 +SDLK_QUOTE = 39 +SDLK_LEFTPAREN = 40 +SDLK_RIGHTPAREN = 41 +SDLK_ASTERISK = 42 +SDLK_PLUS = 43 +SDLK_COMMA = 44 +SDLK_MINUS = 45 +SDLK_PERIOD = 46 +SDLK_SLASH = 47 +SDLK_0 = 48 +SDLK_1 = 49 +SDLK_2 = 50 +SDLK_3 = 51 +SDLK_4 = 52 +SDLK_5 = 53 +SDLK_6 = 54 +SDLK_7 = 55 +SDLK_8 = 56 +SDLK_9 = 57 +SDLK_COLON = 58 +SDLK_SEMICOLON = 59 +SDLK_LESS = 60 +SDLK_EQUALS = 61 +SDLK_GREATER = 62 +SDLK_QUESTION = 63 +SDLK_AT = 64 +SDLK_LEFTBRACKET = 91 +SDLK_BACKSLASH = 92 +SDLK_RIGHTBRACKET = 93 +SDLK_CARET = 94 +SDLK_UNDERSCORE = 95 +SDLK_BACKQUOTE = 96 +SDLK_a = 97 +SDLK_b = 98 +SDLK_c = 99 +SDLK_d = 100 +SDLK_e = 101 +SDLK_f = 102 +SDLK_g = 103 +SDLK_h = 104 +SDLK_i = 105 +SDLK_j = 106 +SDLK_k = 107 +SDLK_l = 108 +SDLK_m = 109 +SDLK_n = 110 +SDLK_o = 111 +SDLK_p = 112 +SDLK_q = 113 +SDLK_r = 114 +SDLK_s = 115 +SDLK_t = 116 +SDLK_u = 117 +SDLK_v = 118 +SDLK_w = 119 +SDLK_x = 120 +SDLK_y = 121 +SDLK_z = 122 +SDLK_DELETE = 127 +SDLK_WORLD_0 = 160 +SDLK_WORLD_1 = 161 +SDLK_WORLD_2 = 162 +SDLK_WORLD_3 = 163 +SDLK_WORLD_4 = 164 +SDLK_WORLD_5 = 165 +SDLK_WORLD_6 = 166 +SDLK_WORLD_7 = 167 +SDLK_WORLD_8 = 168 +SDLK_WORLD_9 = 169 +SDLK_WORLD_10 = 170 +SDLK_WORLD_11 = 171 +SDLK_WORLD_12 = 172 +SDLK_WORLD_13 = 173 +SDLK_WORLD_14 = 174 +SDLK_WORLD_15 = 175 +SDLK_WORLD_16 = 176 +SDLK_WORLD_17 = 177 +SDLK_WORLD_18 = 178 +SDLK_WORLD_19 = 179 +SDLK_WORLD_20 = 180 +SDLK_WORLD_21 = 181 +SDLK_WORLD_22 = 182 +SDLK_WORLD_23 = 183 +SDLK_WORLD_24 = 184 +SDLK_WORLD_25 = 185 +SDLK_WORLD_26 = 186 +SDLK_WORLD_27 = 187 +SDLK_WORLD_28 = 188 +SDLK_WORLD_29 = 189 +SDLK_WORLD_30 = 190 +SDLK_WORLD_31 = 191 +SDLK_WORLD_32 = 192 +SDLK_WORLD_33 = 193 +SDLK_WORLD_34 = 194 +SDLK_WORLD_35 = 195 +SDLK_WORLD_36 = 196 +SDLK_WORLD_37 = 197 +SDLK_WORLD_38 = 198 +SDLK_WORLD_39 = 199 +SDLK_WORLD_40 = 200 +SDLK_WORLD_41 = 201 +SDLK_WORLD_42 = 202 +SDLK_WORLD_43 = 203 +SDLK_WORLD_44 = 204 +SDLK_WORLD_45 = 205 +SDLK_WORLD_46 = 206 +SDLK_WORLD_47 = 207 +SDLK_WORLD_48 = 208 +SDLK_WORLD_49 = 209 +SDLK_WORLD_50 = 210 +SDLK_WORLD_51 = 211 +SDLK_WORLD_52 = 212 +SDLK_WORLD_53 = 213 +SDLK_WORLD_54 = 214 +SDLK_WORLD_55 = 215 +SDLK_WORLD_56 = 216 +SDLK_WORLD_57 = 217 +SDLK_WORLD_58 = 218 +SDLK_WORLD_59 = 219 +SDLK_WORLD_60 = 220 +SDLK_WORLD_61 = 221 +SDLK_WORLD_62 = 222 +SDLK_WORLD_63 = 223 +SDLK_WORLD_64 = 224 +SDLK_WORLD_65 = 225 +SDLK_WORLD_66 = 226 +SDLK_WORLD_67 = 227 +SDLK_WORLD_68 = 228 +SDLK_WORLD_69 = 229 +SDLK_WORLD_70 = 230 +SDLK_WORLD_71 = 231 +SDLK_WORLD_72 = 232 +SDLK_WORLD_73 = 233 +SDLK_WORLD_74 = 234 +SDLK_WORLD_75 = 235 +SDLK_WORLD_76 = 236 +SDLK_WORLD_77 = 237 +SDLK_WORLD_78 = 238 +SDLK_WORLD_79 = 239 +SDLK_WORLD_80 = 240 +SDLK_WORLD_81 = 241 +SDLK_WORLD_82 = 242 +SDLK_WORLD_83 = 243 +SDLK_WORLD_84 = 244 +SDLK_WORLD_85 = 245 +SDLK_WORLD_86 = 246 +SDLK_WORLD_87 = 247 +SDLK_WORLD_88 = 248 +SDLK_WORLD_89 = 249 +SDLK_WORLD_90 = 250 +SDLK_WORLD_91 = 251 +SDLK_WORLD_92 = 252 +SDLK_WORLD_93 = 253 +SDLK_WORLD_94 = 254 +SDLK_WORLD_95 = 255 +SDLK_KP0 = 256 +SDLK_KP1 = 257 +SDLK_KP2 = 258 +SDLK_KP3 = 259 +SDLK_KP4 = 260 +SDLK_KP5 = 261 +SDLK_KP6 = 262 +SDLK_KP7 = 263 +SDLK_KP8 = 264 +SDLK_KP9 = 265 +SDLK_KP_PERIOD = 266 +SDLK_KP_DIVIDE = 267 +SDLK_KP_MULTIPLY = 268 +SDLK_KP_MINUS = 269 +SDLK_KP_PLUS = 270 +SDLK_KP_ENTER = 271 +SDLK_KP_EQUALS = 272 +SDLK_UP = 273 +SDLK_DOWN = 274 +SDLK_RIGHT = 275 +SDLK_LEFT = 276 +SDLK_INSERT = 277 +SDLK_HOME = 278 +SDLK_END = 279 +SDLK_PAGEUP = 280 +SDLK_PAGEDOWN = 281 +SDLK_F1 = 282 +SDLK_F2 = 283 +SDLK_F3 = 284 +SDLK_F4 = 285 +SDLK_F5 = 286 +SDLK_F6 = 287 +SDLK_F7 = 288 +SDLK_F8 = 289 +SDLK_F9 = 290 +SDLK_F10 = 291 +SDLK_F11 = 292 +SDLK_F12 = 293 +SDLK_F13 = 294 +SDLK_F14 = 295 +SDLK_F15 = 296 +SDLK_NUMLOCK = 300 +SDLK_CAPSLOCK = 301 +SDLK_SCROLLOCK = 302 +SDLK_RSHIFT = 303 +SDLK_LSHIFT = 304 +SDLK_RCTRL = 305 +SDLK_LCTRL = 306 +SDLK_RALT = 307 +SDLK_LALT = 308 +SDLK_RMETA = 309 +SDLK_LMETA = 310 +SDLK_LSUPER = 311 +SDLK_RSUPER = 312 +SDLK_MODE = 313 +SDLK_COMPOSE = 314 +SDLK_HELP = 315 +SDLK_PRINT = 316 +SDLK_SYSREQ = 317 +SDLK_BREAK = 318 +SDLK_MENU = 319 +SDLK_POWER = 320 +SDLK_EURO = 321 +SDLK_UNDO = 322 + +-- not sure where this is defined, it was copied from the man page +KMOD_NONE = 0x0000 +KMOD_LSHIFT = 0x0001 +KMOD_RSHIFT = 0x0002 +KMOD_LCTRL = 0x0040 +KMOD_RCTRL = 0x0080 +KMOD_LALT = 0x0100 +KMOD_RALT = 0x0200 +KMOD_LMETA = 0x0400 +KMOD_RMETA = 0x0800 +KMOD_NUM = 0x1000 +KMOD_CAPS = 0x2000 +KMOD_MODE = 0x4000 + +KMOD_CTRL = (KMOD_LCTRL+KMOD_RCTRL) +KMOD_SHIFT = (KMOD_LSHIFT+KMOD_RSHIFT) +KMOD_ALT = (KMOD_LALT+KMOD_RALT) +KMOD_META = (KMOD_LMETA+KMOD_RMETA) diff --git a/pkg/iceball/halp/main_client.lua b/pkg/iceball/halp/main_client.lua new file mode 100644 index 0000000..7c48b9a --- /dev/null +++ b/pkg/iceball/halp/main_client.lua @@ -0,0 +1,51 @@ +--[[ + This file is part of Ice Lua Components. + + Ice Lua Components is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Ice Lua Components is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Ice Lua Components. If not, see . +]] + +dofile("pkg/iceball/halp/lib_sdlkey.lua") + +gfx_font = common.img_load("pkg/iceball/halp/font-large.tga") + +function sprint(x, y, color, s, ...) + if not s then return end + local i + for i=1,#s do + local c = s:sub(i,i):byte() + client.img_blit(gfx_font, x, y, 4*6, 4*8, 4*6*(c-32), 0, color) + x = x + 4*6 + end + sprint(x, y, color, ...) +end + +function client.hook_tick(sec_current, sec_delta) + -- + return 0.005 +end + +function client.hook_key(key, state, modif, uni) + if key == SDLK_ESCAPE and not state then + client.hook_tick = nil + end +end + +function client.hook_render() + local y = 4 + sprint(4, y, 0xFFFFFFFF, "Welcome to Iceball."); y = y + 32 + sprint(4, y, 0xFFFFFFFF, "INSERT TUTORIAL HERE"); y = y + 32 +end + +client.map_fog_set(0, 35, 75, 30.0) + diff --git a/pkg/iceball/halp/main_server.lua b/pkg/iceball/halp/main_server.lua new file mode 100644 index 0000000..6c10c47 --- /dev/null +++ b/pkg/iceball/halp/main_server.lua @@ -0,0 +1,22 @@ +--[[ + This file is part of Ice Lua Components. + + Ice Lua Components is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Ice Lua Components is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with Ice Lua Components. If not, see . +]] + +function server.hook_tick(sec_current, sec_delta) + -- + return 0.005 +end +