Home | Reviews | GUIpedia | Forum | Fun500
| pharoah | 100 Lines GUI contestFirst, let me start by saying I know you're all probably wrapped up in writing a GUI already. This contest is designed to not take too much time away from that, and give everyone a chance to branch out and try different designs and GUI concepts. To enter, just write a GUI in 100 lines or less (no libraries, that's cheating) in QB or FB and post a link here by 12 noon EST on Sunday. Post whatever you've got then, even if it's not complete. Since this is so restricted, your entry probably won't (and shouldn't) be a fork of your main GUI project. Instead, go ahead and play around a little. Don't get too carried away with extra lines though, it's a bad idea to have too many colons. The code should be readable. So, to recap: Parameters: 100 lines or less Open Source (as if I had to write that) QB or FB Original GUI Concept No Libraries Contest Closes: 12 noon on Sunday This one is just for bragging rights, hope it'll be fun and a good way to get me back into writing code. | 2008-08-06 | 12:01 PM |
| Brandon | Re:100 Lines GUI contestIf at least 3 people enter, I'll give the winner a badge. | 2008-08-06 | 12:29 PM |
| Todd | Re:100 Lines GUI contestI hate to say it, but there are ways to cheat. COMMAND1(a$, b$):NEWCOMMAND(5):s$=FUNCTION1$(4) | 2008-08-06 | 1:04 PM |
| aguma | Re:100 Lines GUI contesthow bout colons count as another line? | 2008-08-06 | 1:07 PM |
| Brandon | Re:100 Lines GUI contestYeah they should | 2008-08-06 | 2:05 PM |
| pharoah | Re:100 Lines GUI contestLet's start by counting colons as new lines, and see where that takes us. Better yet, just leave them out so I can use word count to count the lines. If people end up hitting the limit early and can't see a way around, we'll either up it or allow limited colons (IE you can put colons in between math operations, NEXTs, and the like) | 2008-08-06 | 2:13 PM |
| Todd | Re:100 Lines GUI contestWhat are the requirements for a GUI? I'd recommend windows (draggable or static - points decide) and at least 2 controls (e.g. buttons and text boxes). | 2008-08-06 | 2:21 PM |
| aguma | Re:100 Lines GUI contestis it okay if it's 500 lines? | 2008-08-06 | 2:29 PM |
| pharoah | Re:100 Lines GUI contestTodd - It can be whatever you want it to be... I'll judge it on overall quality, utility, and stability. There doesn't have to be a windowing system, or even any working controls, but don't expect to get a good rating on it. Aguma - Nope, a major part of the contest is the size restriction. It's supposed to challenge you, without taking up too much time. Everyone has the same limit, so anything over 100 lines will be rejected. | 2008-08-06 | 2:40 PM |
| aguma | Re:100 Lines GUI contestAh well, at least making windowing engines is fun! :P | 2008-08-06 | 2:42 PM |
| Todd | Re:100 Lines GUI contestOh another mindless question, what about comments? Do they count as lines? | 2008-08-06 | 2:58 PM |
| aguma | Re:100 Lines GUI contestDoes whitespace count too? | 2008-08-06 | 3:19 PM |
| Todd | Re:100 Lines GUI contestPlus font routines (even simple ones using system fonts in SCREEN 12) with mouse routines take up almost 50 lines. | 2008-08-06 | 3:21 PM |
| aguma | Re:100 Lines GUI contestand my fancy wancy windowing engine takes up around 75 lines. | 2008-08-06 | 3:24 PM |
| Todd | Re:100 Lines GUI contestI've got an interesting idea. How about the GUI with the least amount of lines is the one that wins? We don't know how long to make our GUIs so the shortest GUI with certain requirements. The requirements should be: [quote] -Windows (draggable) -Buttons -Edit boxes -Labels -Radiobuttons -Checkboxes -Listboxes are a bonus (50 pts) -For every 2 lines exceeding the last GUI, minus 1 pt. So if your GUI is 210 lines, and the last GUI is 180, 30/2 is 15 so -15 pts. But if you have listboxes, +50 pts so your score would put you 35 pts over the last GUI. [/quote] How about that? | 2008-08-06 | 3:31 PM |
| aguma | Re:100 Lines GUI contestOkay, but is it okay if the only controls are text boxes and buttons? EDIT: Never mind, that's a good idea. | 2008-08-06 | 3:33 PM |
| Brandon | Re:100 Lines GUI contestBad idea. Nothing creative will be made. | 2008-08-06 | 3:36 PM |
| aguma | Re:100 Lines GUI contestI guess you're right... how about increasing it to 250 lines? | 2008-08-06 | 3:37 PM |
| pharoah | Re:100 Lines GUI contestYes comments and whitespace count, so I don't have to manually count all the lines. Just put your comments to the right on the same line with statements, and they don't. I like the idea of trying this contest within the scope of 100 lines, that means trying to pack in a very small font routine (I think I can do it), and mouse routine. If you're lazy, you could use FB to do these things, so bonus points for QB users. Let's see how this turns out. Remember that a complete, useful GUI is (at least in the Judge's opinion), better than a toolkit of GUI elements like checkboxes and the like. So if the GUI is there to be a program launcher, it should be a nice complete one. No windows needed if it accomplishes a good task. If, on the other hand, it relies on scripts or something to make it useful, it should have a good stable scripter. If you find copying and pasting code from your main GUI takes up too much space, rewrite it and take out some of the fluff. Maybe you'll have to go with a tiling window manager, nobody'll think less of it in a 100 line GUI. | 2008-08-06 | 3:41 PM |
| aguma | Re:100 Lines GUI contestI came up with a really great idea, now my windowing engine is a lot smaller, plus it accomplishes about as much as the other one. | 2008-08-06 | 3:44 PM |
| pharoah | Re:100 Lines GUI contestGreat! The 100 line contest is accomplishing its goal :D | 2008-08-06 | 3:52 PM |
| aguma | Re:100 Lines GUI contestI guess so :P Even though I'm using FB with INCREDIBLY tight code, I can't fit any controls into it... | 2008-08-06 | 3:54 PM |
| pharoah | Re:100 Lines GUI contestYou might have to find a different way to make your GUI functional than using the standard controls-as-objects system. | 2008-08-06 | 3:58 PM |
| aguma | Re:100 Lines GUI contestI suppose so... | 2008-08-06 | 4:00 PM |
| Todd | Re:100 Lines GUI contest[b]Brandon wrote:[/b] [quote]Bad idea. Nothing creative will be made.[/quote] The creativity is fitting a full-featured GUI in the smallest and most efficient code. Plus we don't stop creativity at the door. If something is put in that is neat, we'll award bonus points. | 2008-08-06 | 4:12 PM |
| pharoah | Re:100 Lines GUI contestHow about this week we see what we can fit into 100 lines, then next week we add what we want to it and award whoever adds the most in the fewest lines of code. Then we can try both approaches. | 2008-08-06 | 4:25 PM |
| Todd | Re:100 Lines GUI contestHow will the GUIs be judged this week? | 2008-08-06 | 4:43 PM |
| pharoah | Re:100 Lines GUI contestI'll look at them and assign arbitrary numbers based on the number of vowels and consonants in a person's name. | 2008-08-06 | 4:44 PM |
| Todd | Re:100 Lines GUI contestSo they have nothing to do with the GUIs themselves? | 2008-08-06 | 5:29 PM |
| Brandon | Re:100 Lines GUI contestlol, grading code by number of lines is silly: http://www.folklore.org/StoryView.py?project=Macintosh&story=Negative_2000_Lines_Of_Code.txt&characters=Bill%20Atkinson&sortOrder=Sort%20by%20Date&detail=medium | 2008-08-06 | 6:10 PM |
| Todd | Re:100 Lines GUI contestI grade by how many modules/functions are completed, function/procedure revisions, code revisions, main program completion, etc. | 2008-08-06 | 6:17 PM |
| pharoah | Re:100 Lines GUI contest2 things I thought of to save lines, for people who are still interested in trying this contest: 1. Use DRAW statements to make windows, etc... They can be scaled and are still only 1 line per statement. Beats using LINEs and PSETs 2. In Qbasic, you can use GOSUB RETURN instead of CALL, SUB, END SUB. It saves one line and doesn't require you to dim shared variables (more lines saved). Just be careful with variable use and you'll be fine. EDIT- For the gosub thing, you'd put a line number at the beginning of the first line of your "sub". Also, it saves another line I hadn't thought about (DECLARES are lines, too) | 2008-08-06 | 6:20 PM |
| Brandon | Re:100 Lines GUI contestOld spagetti code, is making a comeback eh? Maybe I can finally release my GUIs code. | 2008-08-06 | 6:33 PM |
| Re:100 Lines GUI contestHey can one of u moderators delete this account i don't want it any more. Plz reply before you act | 2008-08-06 | 6:38 PM |
| Re:100 Lines GUI contestREPLY OR I"LL SWEAR EVERY WHERE ON THIS WEBSITE! | 2008-08-06 | 6:40 PM |
| Re:100 Lines GUI contestor u could give me a warning award | 2008-08-06 | 6:40 PM |
| Todd | Re:100 Lines GUI contestYou don't want it anymore? Just stop logging in or posting and people won't even know you exist. | 2008-08-06 | 6:46 PM |
| Brandon | Re:100 Lines GUI contest1 this is off topic. 2 your friend aguma will be getting warned for this not you. Aguma, if your friends are going to act like they are five then don't invite them. 3 No triple posting! 4 The Euphyllia account has been deleted. | 2008-08-06 | 6:55 PM |
| Brandon | Re:100 Lines GUI contestMy entry #1 (I will have 1 more soon) anyways its a new desktop system for Fun500 or any other GUI! [file name=UniDesk.zip size=140602]http://qbguiblog.xetaspace.net/images/fbfiles/files/UniDesk.zip[/file] | 2008-08-07 | 1:56 PM |
| Brandon | Re:100 Lines GUI contest[quote] DECLARE SUB NEW_WINDOW (ID,X,Y,X2,Y,TITLE$) declare sub refresh (ID) TYPE GWIN X AS INTEGER Y AS INTEGER X2 AS INTEGER Y2 AS INTEGER TITLE AS STRING END TYPE DIM SHARED WINDOWS(3) AS GWIN,UC(3),image_buffer(3) As Any Ptr,mx,my,buttons Screen 18,32,3,1 open "prefs.txt" for input as #1 for z=1 to 4 input #1,UC(z) next z close #1 Screenset 2,0 'makes 2 the work/hidden page so the wallpaper can be loaded to it to save time BLOAD "TEST.BMP" Screenset 0,0 NEW_WINDOW 1,100,100,300,300,"Test 1" NEW_WINDOW 2,330,200,620,300,"About" NEW_WINDOW 3,100,330,150,400,"Lol" Draw String image_buffer(2), (5,20),"Fun500 4 Windowing Demo 1" ,RGBA(0,0,0,255) Draw String image_buffer(2), (5,56),"2005-2008 Brandon Cornell" ,RGBA(0,0,0,255) refresh 2 DO res = GetMouse (mx, my, , buttons) IF buttons=1 then FOR Z=1 TO 3 res = GetMouse (mx, my, , buttons) IF mx > WINDOWS(z).X and mx < WINDOWS(z).X2 and my > WINDOWS(z).y and my < WINDOWS(z).y+17 then 'click in titlebar difx=mx-WINDOWS(z).X dify=my-WINDOWS(z).y widt= WINDOWS(z).x2- WINDOWS(z).x hieg= WINDOWS(z).y2- WINDOWS(z).y DO res = GetMouse (mx, my, , buttons) WINDOWS(z).y=my-dify WINDOWS(z).X=mx-difx WINDOWS(z).X2=WINDOWS(z).X+widt WINDOWS(z).y2=WINDOWS(z).y+hieg refresh z loop while buttons=1 WINDOWS(z).y=my-dify WINDOWS(z).X=mx-difx WINDOWS(z).X2=WINDOWS(z).X+widt WINDOWS(z).y2=WINDOWS(z).y+hieg refresh z 'redraws while moving end if NEXT Z end if LOOP while inkey$="" SUB NEW_WINDOW (ID,X,Y,X2,Y2,TITLE$) image_buffer(ID) = ImageCreate(x2-x,y2-y) 'Makes the Buffer for the windo LINE image_buffer(ID),(0,0)-(X2-X,Y2-Y),RGBA(255,0,0,0),BF WINDOWS(ID).X=X WINDOWS(ID).Y=Y WINDOWS(ID).X2=X2 WINDOWS(ID).Y2=Y2 WINDOWS(ID).TITLE=TITLE$ LINE image_buffer(ID), (0,2)-(0,Y2-Y),RGBA(UC(1),UC(2),UC(3),128) 'draws window to buffer LINE image_buffer(ID), (1,1)-(1,Y2-Y),RGBA(UC(1),UC(2),UC(3),128) TEMP=UC(UC(4)) FOR Z= 2 TO X2-X-3 IF UC(UC(4))< 255 THEN UC(UC(4))=UC(UC(4))+1 LINE image_buffer(ID), (Z,0)-(Z,16),RGBA(UC(1),UC(2),UC(3),128) LINE image_buffer(ID), (Z,Y2-Y-1)-(Z,Y2-Y-2),RGBA(UC(1),UC(2),UC(3),128) NEXT Z LINE image_buffer(ID), (X2-X-1,2)-(X2-X-1,Y2-Y),RGBA(UC(1),UC(2),UC(3),128) LINE image_buffer(ID), (X2-X-2,1)-(X2-X-2,Y2-Y),RGBA(UC(1),UC(2),UC(3),128) LINE image_buffer(ID), (2,17)-(X2-X-3,Y2-Y-3),RGBA(255,255,255,255),BF Draw String image_buffer(ID), (5,2), TITLE$ ,RGBA(255,255,255,255) UC(UC(4))=TEMP Put (X, Y), image_buffer(ID), Alpha END SUB SUB REFRESH (id) Screenset 1,0 'makes screen 1 hidden and 0 visible screencopy 2,1 'copies wallpaper to hidden screen FOR Z2=1 TO 3 IF IDZ2 THEN Put (WINDOWS(Z2).X, WINDOWS(Z2).Y), image_buffer(Z2), Alpha NEXT Z2 Put (WINDOWS(id).X, WINDOWS(id).Y), image_buffer(id), Alpha 'draws window buffer to hidden screen 1 SCREENCOPY 1,0 'copies screen 0 over screen 1 END SUB [/quote] Get drooling thats the FB code to my sweet windowing demo. | 2008-08-07 | 2:09 PM |
| Re:100 Lines GUI contest1) I don't think it's fair to compare programs made in FB to those made in QB. 2) If you insist on using FB, please include a "sleep 25" in your loops so it won't freeze my pc. I made a simple gui in qb that supports windows & buttons. It's 100 lines & didn't take that long to make. [quote] DECLARE SUB xrect (x1%, y1%, x2%, y2%, c%) DECLARE SUB mouse (ax AS INTEGER, bx AS INTEGER, cx AS INTEGER, dx AS INTEGER) DECLARE SUB printx (a$, x AS INTEGER, y AS INTEGER, c AS INTEGER) DEFINT A-Z SCREEN 12 g$ = MKL$(&H100) + MKL$(&H40008001) + MKL$(&H60018000) + MKI$(&H601) + "Window" + MKL$(&H1010201) + MKL$(&HA400A401) + MKL$(&H18003800) + MKI$(&H500) + "Click" + MKL$(&H2010301) + MKL$(&HBE00A401) + MKL$(&H18003000) + MKI$(&H400) + "Exit" DIM SHARED font(7, 15, 255) AS INTEGER FOR i = 32 * 128 - 1 TO 127 * 128 + 127 font(i AND 7, (i AND 127) 8, i 128) = POINT(i AND 7, (i AND 127) 8) IF (i AND 127) = 0 THEN PRINT CHR$(i 128), , "Loading..." ELSE IF (i AND 127) = 127 THEN CLS NEXT i mouse 0, 0, 0, 0 mouse 1, 0, 0, 0 first.frame = -1 1337 mouse 3, mb, mx, my FOR i = 1 TO LEN(g$) update = 0 p = ASC(MID$(g$, i + 2, 1)) x = CVI(MID$(g$, i + 5, 2)) y = CVI(MID$(g$, i + 7, 2)) 666 FOR ii = 1 TO LEN(g$) IF p = ASC(MID$(g$, ii + 1, 1)) THEN x = x + CVI(MID$(g$, ii + 5, 2)) IF p = ASC(MID$(g$, ii + 1, 1)) THEN y = y + CVI(MID$(g$, ii + 7, 2)) IF p = ASC(MID$(g$, ii + 1, 1)) THEN p = ASC(MID$(g$, ii + 2, 1)) ii = ii + 13 + ASC(MID$(g$, ii + 13, 1)) NEXT ii IF p > 0 THEN GOTO 666 IF ASC(MID$(g$, i + 4, 1)) 0 THEN IF mx >= x AND my >= y AND mx < x + CVI(MID$(g$, i + 9, 2)) AND my < y + CVI(MID$(g$, i + 11, 2)) AND mb = 1 THEN IF ASC(MID$(g$, i, 1)) = 1 THEN mouse 2, 0, 0, 0 LINE (x + 1, y + 1)-(x + CVI(MID$(g$, i + 9, 2)) - 2, y + CVI(MID$(g$, i + 11, 2)) - 2), 1, BF LINE (x, y)-(x + CVI(MID$(g$, i + 9, 2)) - 1, y + CVI(MID$(g$, i + 11, 2)) - 1), 8, B IF ASC(MID$(g$, i, 1)) >= 1 AND ASC(MID$(g$, i, 1)) = x AND my >= y AND mx < x + CVI(MID$(g$, i + 9, 2)) AND my < y + CVI(MID$(g$, i + 11, 2)) THEN IF ASC(MID$(g$, i + 3, 1)) = 1 THEN PRINT "blah" IF ASC(MID$(g$, i + 3, 1)) = 2 THEN END END IF ELSEIF ASC(MID$(g$, i, 1)) = 0 THEN IF my < y + 24 THEN 'title bar x0 = mx y0 = my xrect x, y, x + CVI(MID$(g$, i + 9, 2)) - 1, y + CVI(MID$(g$, i + 11, 2)) - 1, 15 WHILE mb = 1 mouse 3, mb, mx, my x = x + (mx - x0) y = y + (my - y0) IF x0 mx OR y0 my THEN xrect x - (mx - x0), y - (my - y0), x - (mx - x0) + CVI(MID$(g$, i + 9, 2)) - 1, y - (my - y0) + CVI(MID$(g$, i + 11, 2)) - 1, 15 IF x0 mx OR y0 my THEN xrect x, y, x + CVI(MID$(g$, i + 9, 2)) - 1, y + CVI(MID$(g$, i + 11, 2)) - 1, 15 x0 = mx y0 = my WEND MID$(g$, i + 5, 4) = MKI$(x) + MKI$(y) mouse 2, 0, 0, 0 CLS mouse 1, 0, 0, 0 i = 1 first.frame = -1 END IF END IF END IF IF update OR first.frame THEN mouse 2, 0, 0, 0 IF update OR first.frame THEN LINE (x + 1, y + 1)-(x + CVI(MID$(g$, i + 9, 2)) - 2, y + CVI(MID$(g$, i + 11, 2)) - 2), 7, BF IF update OR first.frame THEN LINE (x, y)-(x + CVI(MID$(g$, i + 9, 2)) - 1, y + CVI(MID$(g$, i + 11, 2)) - 1), 8, B IF (update OR first.frame) AND ASC(MID$(g$, i, 1)) >= 1 AND ASC(MID$(g$, i, 1)) 0 THEN PSET (x + (i% 128 - 1) * 8 + (i% AND 7), y + (i% AND 127) 8), c NEXT i% END SUB SUB xrect (x1%, y1%, x2%, y2%, c%) mouse 2, 0, 0, 0 FOR x% = x1% TO x2% PSET (x%, y1%), POINT(x%, y1%) XOR c% PSET (x%, y2%), POINT(x%, y2%) XOR c% NEXT x% FOR y% = y1% TO y2% PSET (x1%, y%), POINT(x1%, y%) XOR c% PSET (x2%, y%), POINT(x2%, y%) XOR c% NEXT y% mouse 1, 0, 0, 0 END SUB [/quote] | 2008-08-08 | 3:07 PM |
| Brandon | Re:100 Lines GUI contestFB vs QB isn't fair, I agree. If you weren't in windows there wouldn't be the problem. | 2008-08-08 | 3:09 PM |
| pharoah | Re:100 Lines GUI contestYes, I decided that QB and FB would be in 2 separate categories but forgot to write it. I might need somebody else to judge the QB code for me, though, because I originally intended to write my entry in QB but found it won't run on my PC anymore (same OS and all, go figure). | 2008-08-08 | 3:17 PM |
| Todd | Re:100 Lines GUI contestOne thing about FB is that it includes mouse routines. QB does not. I think certain things should count and others not count. Giving FBers better advantage because QBers have to put mouse routines in would seem somewhat unfair. | 2008-08-08 | 4:38 PM |
| aguma | Re:100 Lines GUI contesthey its not my fault Qbasic won't run on Vista. | 2008-08-08 | 4:53 PM |
| Todd | Re:100 Lines GUI contestNothing runs on Vista. I was really upset when I tried running my programs on Vista and it said that since it wasn't Vista-compatible, I couldn't run them. :( | 2008-08-08 | 5:00 PM |
| jasonwoodland | Re:100 Lines GUI contest[b]aguma wrote:[/b] [quote]hey its not my fault Qbasic won't run on Vista.[/quote] I thought you use DOSBox? | 2008-08-08 | 6:50 PM |
| aguma | Re:100 Lines GUI contestdosbox doesn't work correctly on Vista. :P | 2008-08-08 | 7:14 PM |
| SonicBrit | Re:100 Lines GUI contestWell so I decided to take up on this challenge, accept I focused too much on the design, so I have about 100 lines that replicates the win 3.1 gui quite well, accept now I don't have enough lines for a demo. So I'm going to write a more simple gui which will look more ugly but hey I'll have a demo. | 2008-08-08 | 8:15 PM |
| aguma | Re:100 Lines GUI contestSorry this is really off subject, but Todd check your pms. | 2008-08-08 | 8:16 PM |
| Todd | Re:100 Lines GUI contestI did. To backup a MySQL database, you export the SQL queries used to re-create the database from scratch. | 2008-08-08 | 9:29 PM |
| aguma | Re:100 Lines GUI contestOh yeah, I forgot about that. Brandon, just select the database and choose 'Backup to SQL dump' or something like that. | 2008-08-08 | 9:36 PM |
| Brandon | Re:100 Lines GUI contestNo shit. I need a link and the username/password. | 2008-08-08 | 9:38 PM |
| jasonwoodland | Re:100 Lines GUI contest[b]aguma wrote:[/b] [quote]Sorry this is really off subject, but Todd check your pms.[/quote] PMS?:dry: | 2008-08-09 | 3:24 AM |
| Todd | Re:100 Lines GUI contestPrivate Messages. | 2008-08-09 | 3:52 AM |
| Re:100 Lines GUI contest[code] ' Contest Challenge: Code a 100-line GUI in QBasic, due Aug 10, 2008, at 12:00PM (unknown time-zone) ' This code requires QBasic 7.1 or better to run. ' -- The ComputerGhost DECLARE SUB DrawGUI(GUI$, offset%, bx%, by%, bw%, bh%) DIM SHARED active% active% = 307 GUI$ = "{D01018025ComputerGhost's 100-line GUI${S02025001Controls:$S04032001Tab, Shift+Tab$S34032601- Change active object$S04041501Arrow keys$S34042501- Move dialog boxes$S04057001Alpha-Numeric keys, Backspace - Edit edit control text$S04061001Space$S34062601- Try this on buttons$S04071001Escape$S34071001- Exit$D01106413Dialog${E02024501Edit Control$B53020901Button!$D03044006Nested Dialog$D20064005Nested #2${S01013001Btw, this one is on top.$}}}}" CALL DrawGUI(GUI$, 1, 0, 0, 82, 27) 10 k$ = INKEY$ GOSUB 20 GOTO 10 20 ending% = INSTR(active%, GUI$, "$") IF k$ = CHR$(27) THEN SYSTEM ELSEIF k$ = CHR$(9) THEN active% = INSTR(active%, GUI$, "$") + 1 WHILE INSTR("{}", MID$(GUI$, active%, 1)) 0 active% = active% + 1 IF active% > LEN(GUI$) THEN active% = 1 WEND ELSEIF k$ = CHR$(0) + CHR$(15) THEN WHILE MID$(GUI$, active%, 1) "$" active% = active% - 1 IF active% = 0 THEN active% = LEN(GUI$) WEND active% = active% - 1 WHILE INSTR("{}$", MID$(GUI$, active%, 1)) = 0 active% = active% - 1 WEND active% = active% + 1 ELSEIF k$ = CHR$(0) + "K" AND MID$(GUI$, active%, 1) = "D" AND VAL(MID$(GUI$, active%+1, 2)) > 1 THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1)) MID$(GUI$, active%+1, 2) = n$ ELSEIF k$ = CHR$(0) + "M" AND MID$(GUI$, active%, 1) = "D" THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))+1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))+1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))+1)) MID$(GUI$, active%+1, 2) = n$ ELSEIF k$ = CHR$(0) + "H" AND MID$(GUI$, active%, 1) = "D" AND VAL(MID$(GUI$, active%+3, 2)) > 1 THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1)) MID$(GUI$, active%+3, 2) = n$ ELSEIF k$ = CHR$(0) + "P" AND MID$(GUI$, active%, 1) = "D" THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))+1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))+1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))+1)) MID$(GUI$, active%+3, 2) = n$ ELSEIF k$ = CHR$(8) AND MID$(GUI$, active%, 1) = "E" THEN IF ending% > active% + 9 THEN GUI$ = LEFT$(GUI$, ending% - 2) + RIGHT$(GUI$, LEN(GUI$)-ending%+1) ELSEIF LEN(k$) = 1 AND MID$(GUI$, active%, 1) = "E" THEN IF VAL(MID$(GUI$, active%+5, 2)) - 2 > ending% - active% - 9 THEN GUI$ = LEFT$(GUI$, ending% - 1) + k$ + RIGHT$(GUI$, LEN(GUI$)-ending%+1) ELSE IF k$ = CHR$(32) AND MID$(GUI$, active%, 1) = "B" THEN BEEP RETURN END IF CALL DrawGUI(GUI$, 1, 0, 0, 82, 27) RETURN SUB DrawGUI(GUI$, offset%, bx%, by%, bw%, bh%) offset% = offset% + 1 WHILE MID$(GUI$, offset%, 1) "}" GOSUB 30 offset% = ending% WEND offset% = offset% + 1 EXIT SUB 30 ending% = INSTR(offset%, GUI$, "$") c$ = MID$(GUI$, offset%, 1) x% = VAL(MID$(GUI$, offset%+1, 2)) + bx% y% = VAL(MID$(GUI$, offset%+3, 2)) + by% w% = VAL(MID$(GUI$, offset%+5, 2)) h% = VAL(MID$(GUI$, offset%+7, 2)) t$ = MID$(GUI$, offset%+9, ending%-offset%-9) IF x% + w% = bx% + bw% THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+1, 2))-1)) MID$(GUI$, active%+1, 2) = n$ x% = x% - 1 END IF IF y% + h% = by% + bh% THEN IF LEN(LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1))) = 1 THEN n$ = "0" + LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1)) ELSE n$ = LTRIM$(STR$(VAL(MID$(GUI$, active%+3, 2))-1)) MID$(GUI$, active%+3, 2) = n$ y% = y% - 1 END IF GOSUB 40 ending% = ending% + 1 IF MID$(GUI$, ending%, 1) = "{" THEN CALL DrawGUI(GUI$, ending%, x%, y%, w%, h%) RETURN 40 IF active% = offset% THEN COLOR 15, 5 ELSE COLOR 7, 5 IF c$ = "S" THEN COLOR , 1 IF c$ = "E" THEN COLOR , 0 LOCATE y%, x% t$ = " " + t$ + SPACE$(w%-LEN(t$)-1) PRINT t$; COLOR 7, 1 bg$ = CHR$(179) + SPACE$(w%-2) + CHR$(179) FOR yi% = y% + 1 TO y% + h% - 2 LOCATE yi%, x% PRINT bg$; NEXT yi% bg$ = CHR$(192) + STRING$(w%-2, CHR$(196)) + CHR$(217) LOCATE y%+h%-1, x% IF h% > 1 THEN PRINT bg$; RETURN END SUB 'OMG, THIS IS LINE 100!!! [/code] | 2008-08-10 | 1:24 PM |
| Brandon | Re:100 Lines GUI contestI IM Pharoah quite a bit, and he hasn't been around today. I guess as admin I'll extend the deadline 1 day, 24 hours to, Monday the 11th at 12 noon EST. Hey Aguma, you haven't posted. | 2008-08-10 | 6:27 PM |
| aguma | Re:100 Lines GUI contestSorry I forgot to post! Here: [code]declare sub DoCHK declare function MouseIn(x1,y1,x2,y2) declare function lpressed declare sub Redraw declare sub DrawWin type WnTyp x1 as integer y1 as integer x2 as integer y2 as integer title as string free as integer end type dim shared win as integer,MaxX=1023,MaxY=767,MouseX,MouseY,MouseB,BgColor,Wins(1 to 20) as WnTyp,true = 1,false = 0,activewin,fixit screenres 1024,768,32 Wins(1).x1 = 50 Wins(1).y1 = 50 Wins(1).x2 = 300 Wins(1).y2 = 300 Wins(1).title = "Hello World!" Wins(1).free = 1 Wins(2).x1 = 60 Wins(2).y1 = 60 Wins(2).x2 = 310 Wins(2).y2 = 310 Wins(2).title = "Hello Worlds" Wins(2).free = 1 activewin = 1 fixit = 1 do until inkey$ = chr$(27) for win = 1 to 20 g = GetMouse(MouseX,MouseY,,MouseB) if Wins(win).free = 1 then DoCHK next loop sub DoCHK static oldx,oldy d = GetMouse(MouseX,MouseY,,MouseB) if lpressed and MouseIn(Wins(win).x2 - 10, Wins(win).y1,Wins(win).x2,Wins(win).y1 + 10) then Wins(win).free = false Redraw end if if lpressed and MouseIn(Wins(win).x1,Wins(win).y1,Wins(win).x2,Wins(win).y1 + 10) then activewin = win Redraw end if if lpressed and MouseIn(Wins(win).x1,Wins(win).y1,Wins(win).x2,Wins(win).y1 + 10) then cx = MouseX - Wins(win).x1 cy = MouseY - Wins(win).y1 dx = Wins(win).x2 - Wins(win).x1 dy = Wins(win).y2 - Wins(win).y1 MouseB = 1 do until lpressed = false loop g = GetMouse(MouseX,MouseY,,MouseB) Wins(win).x1 = MouseX - cx Wins(win).y1 = MouseY - cy Wins(win).x2 = MouseX - cx + dx Wins(win).y2 = MouseY - cy + dy DrawWin fixit = 1 end if if fixit = 1 then line(0,0)-(1024,768),BgColor,bf fixit = 0 Redraw win = 1 end if end sub function MouseIn(x1,y1,x2,y2) g = GetMouse(MouseX,MouseY,,MouseB) if MouseX >= x1 and MouseX = y1 and MouseY | 2008-08-10 | 6:44 PM |
| Todd | Re:100 Lines GUI contestCrap! I gotta post. I've been trying to work on one. I think my plan will be to make a simple GUI then strip it down and shorten it later. | 2008-08-10 | 9:02 PM |
| jasonwoodland | Re:100 Lines GUI contest[b]tlsuess wrote:[/b] [quote]Private Messages.[/quote] Oh. | 2008-08-11 | 4:25 AM |
| Brandon | 100 Lines GUI contest: HijackedThe contest was supposed to end sunday at noon, but still no Pharaoh and its Wednesday morning. I'm tired on waiting. The winner will be decided by the poll. In the last poll Todd and I tied. NOTICE: In the poll I pointed out if a GUI was made in QB, if I didn't then its in FB, please keep in mind that QB can be somewhat limiting. | 2008-08-13 | 7:43 AM |
| ksr | Re:100 Lines GUI contestAguma, I can't get yours to run. You seem to be using features of both -lang qb and -lang fb (i.e. implicit variable declaration, but '=' within dim statements). What version of FB are you using? | 2008-08-13 | 2:40 PM |
| aguma | Re:100 Lines GUI contesttry it with -lang deprecated. | 2008-08-13 | 2:41 PM |
| ksr | Re:100 Lines GUI contestAh right, thanks. Nice! Now I just have to find QB again to run the others :P | 2008-08-13 | 2:43 PM |
| ksr | Re:100 Lines GUI contestWow, all of these are actually much more impressive than I thought a 100-line GUI would be. ComputerGhost gets my vote though, because (being very much a scripting language person) I love the way the whole GUI is defined in a single string, which is then parsed. And there was even room for some controls! Brandon, your Alpha WM came a close second for me, and again I'm impressed what you've managed to squeeze into 100 lines. Some interactivity would have been nice, though. | 2008-08-13 | 3:08 PM |
| Brandon | Re:100 Lines GUI contestWhat about my desktop? It has a use in the real world, and try to compile ComputerGhost's, If it wont compile what good is it? | 2008-08-13 | 3:26 PM |
| Todd | Re:100 Lines GUI contestA little off topic but I think these contests are good. Brandon, I think you should hold these more often. Mainly because we had two new entries aside from our regular members. I think it might help spark some creativity. | 2008-08-13 | 4:46 PM |
2021 Brandon Cornell