From f3d4a24caa812d09a73a8c989502bb544bb422bd Mon Sep 17 00:00:00 2001 From: Aidan Haas <94150901+ahaas25@users.noreply.github.com> Date: Sat, 29 Oct 2022 22:26:16 -0400 Subject: [PATCH] Commit 4 --- a.out | Bin 25840 -> 26512 bytes string_helpers.c | 0 typing_test.c | 48 +++ words.txt | 1000 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1048 insertions(+) create mode 100644 string_helpers.c create mode 100644 words.txt diff --git a/a.out b/a.out index 7978c5f942f58b6fce07fd107b5ad16a9439a996..82bfbd8676af428dbb5f7298ec032d88479544ed 100755 GIT binary patch delta 7125 zcmZ`;3se+Gx~}S(9=dtXOasH9NP~~yYX%e*HN-(h2Ze|N3W+)*ps*700TR7Q2CuSa z!X*JK9?4mgtJz~t+>?hM){WV$ikcPKBnGptF}X>W?9oK8d7#lqjM=&WU)@az@fK&Q z>ige+y}G*T?V>I3)0Q~9$4+?hXbovu-a6)`P;aOPy`iliyF&NtXn!cPQ>S~&7oeZu9vFo8Ld_Kr?>1leKV;=)oc%L%QZ47XU_=> zlK#I)dUT6DOg8zV|Fv&=_s$2tAN%iD(?2d4vGk`iS7%c8m?lo1(s!=%l0lZvuJZP+iQ-al(iN(SU2=ea)~xxUt?6PcfJK? zZ6uzkd0McN){q;lRXiY;Raca5U>TPChxvRPYfH=4_{u8R_*RuxRg;ai8>%bTVpCRH z%eGkN&~)~OA_!P_10QL1@l`Ttk*Qps%?XK5%hpwmNjH*G6_AILqED(p?_sSWvz*}? zlh;>fXaJW&1p7L~;nbHVC-)8D#LP zHi-`c&)e8hD+ha`5*uJR$SJ)A`ORE@(grr)K9r7RmG)tyGl4|v#ujag1KZY9!>E%BKgRDl0jXZ+nE877=w9PCvdN^Ik3Zq^AtzUV}=>O=M zAA`Zb;kU8g)d6+6x5+#*1+=_@?7p;)&c+@f;uiBZHKJ_P8y-trpz#uP!Q^*SP_XmL zkh{U)wxg&|q8gt?>E^~>6zMzx2?f1@lROe{;KLiQc>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*{Zn|44O4B>bP4{bHj5cR(8IL~y+Qkdy7&@^5~cI&%LDsvQs`3; S&E7EAe3-9OD628tdH(?wuOW>9 diff --git a/string_helpers.c b/string_helpers.c new file mode 100644 index 0000000..e69de29 diff --git a/typing_test.c b/typing_test.c index 2306119..d615b94 100644 --- a/typing_test.c +++ b/typing_test.c @@ -43,6 +43,52 @@ int print_centered_text_menu(WINDOW *win, int row, int target, char str[][MAX_ST } } +int typing_ui(WINDOW *win, int level, int mode) { + int run = 1, ch, i, words, win_x = win->_maxx; + char str[1024]; + + clear(); + if (mode == 0) { + strcat(str, "Timed Test - "); + strcat(str, TIMED_MODES_STRING[level]); + print_centered_text(stdscr, 0, str); + } else { + strcat(str, "Word Test - "); + strcat(str, WORD_MODES_STRING[level]); + print_centered_text(stdscr, 0, str); + } + + for (i = 0; i < words; i++) { + /* Will print the words centered in the screen */ + /* Will scroll down when user finishes middle line */ + /* Will automatically wrap text to next line based on + how big the console size is */ + } + + /* For now prints placeholder text for the purposes of testing */ + + print_centered_text(win, 3, "The quick brown fox jumps over the lazy dog"); + print_centered_text(win, 4, "Line 2"); + print_centered_text(win, 5, "Line 3"); + + printw("%d", win_x); + + move(7, (win_x / 8)); + + + while (run) { + ch = getch(); + printw("%c", ch); + if (ch == ' ') { + printw("RESET TEST"); + } + } +} + +int load_words_file() { + FILE *words_file; +} + /* Main function. Creates main menu */ int main() { int cursor_x = 0, cursor_y = 0, run = 1; @@ -101,6 +147,8 @@ int main() { if (ch == '\n') { if (cursor_x == 0 && cursor_y == 2) { run = 0; + } else if (cursor_y == 1 || cursor_y == 0) { + typing_ui(stdscr, cursor_x, cursor_y); } } diff --git a/words.txt b/words.txt new file mode 100644 index 0000000..f10b1af --- /dev/null +++ b/words.txt @@ -0,0 +1,1000 @@ +the +of +to +and +a +in +is +it +you +that +he +was +for +on +are +with +as +I +his +they +be +at +one +have +this +from +or +had +by +not +word +but +what +some +we +can +out +other +were +all +there +when +up +use +your +how +said +an +each +she +which +do +their +time +if +will +way +about +many +then +them +write +would +like +so +these +her +long +make +thing +see +him +two +has +look +more +day +could +go +come +did +number +sound +no +most +people +my +over +know +water +than +call +first +who +may +down +side +been +now +find +any +new +work +part +take +get +place +made +live +where +after +back +little +only +round +man +year +came +show +every +good +me +give +our +under +name +very +through +just +form +sentence +great +think +say +help +low +line +differ +turn +cause +much +mean +before +move +right +boy +old +too +same +tell +does +set +three +want +air +well +also +play +small +end +put +home +read +hand +port +large +spell +add +even +land +here +must +big +high +such +follow +act +why +ask +men +change +went +light +kind +off +need +house +picture +try +us +again +animal +point +mother +world +near +build +self +earth +father +head +stand +own +page +should +country +found +answer +school +grow +study +still +learn +plant +cover +food +sun +four +between +state +keep +eye +never +last +let +thought +city +tree +cross +farm +hard +start +might +story +saw +far +sea +draw +left +late +run +don't +while +press +close +night +real +life +few +north +open +seem +together +next +white +children +begin +got +walk +example +ease +paper +group +always +music +those +both +mark +often +letter +until +mile +river +car +feet +care +second +book +carry +took +science +eat +room +friend +began +idea +fish +mountain +stop +once +base +hear +horse +cut +sure +watch +color +face +wood +main +enough +plain +girl +usual +young +ready +above +ever +red +list +though +feel +talk +bird +soon +body +dog +family +direct +pose +leave +song +measure +door +product +black +short +numeral +class +wind +question +happen +complete +ship +area +half +rock +order +fire +south +problem +piece +told +knew +pass +since +top +whole +king +space +heard +best +hour +better +true +during +hundred +five +remember +step +early +hold +west +ground +interest +reach +fast +verb +sing +listen +six +table +travel +less +morning +ten +simple +several +vowel +toward +war +lay +against +pattern +slow +center +love +person +money +serve +appear +road +map +rain +rule +govern +pull +cold +notice +voice +unit +power +town +fine +certain +fly +fall +lead +cry +dark +machine +note +wait +plan +figure +star +box +noun +field +rest +correct +able +pound +done +beauty +drive +stood +contain +front +teach +week +final +gave +green +oh +quick +develop +ocean +warm +free +minute +strong +special +mind +behind +clear +tail +produce +fact +street +inch +multiply +nothing +course +stay +wheel +full +force +blue +object +decide +surface +deep +moon +island +foot +system +busy +test +record +boat +common +gold +possible +plane +stead +dry +wonder +laugh +thousand +ago +ran +check +game +shape +equate +hot +miss +brought +heat +snow +tire +bring +yes +distant +fill +east +paint +language +among +grand +ball +yet +wave +drop +heart +am +present +heavy +dance +engine +position +arm +wide +sail +material +size +vary +settle +speak +weight +general +ice +matter +circle +pair +include +divide +syllable +felt +perhaps +pick +sudden +count +square +reason +length +represent +art +subject +region +energy +hunt +probable +bed +brother +egg +ride +cell +believe +fraction +forest +sit +race +window +store +summer +train +sleep +prove +lone +leg +exercise +wall +catch +mount +wish +sky +board +joy +winter +sat +written +wild +instrument +kept +glass +grass +cow +job +edge +sign +visit +past +soft +fun +bright +gas +weather +month +million +bear +finish +happy +hope +flower +clothe +strange +gone +jump +baby +eight +village +meet +root +buy +raise +solve +metal +whether +push +seven +paragraph +third +shall +held +hair +describe +cook +floor +either +result +burn +hill +safe +cat +century +consider +type +law +bit +coast +copy +phrase +silent +tall +sand +soil +roll +temperature +finger +industry +value +fight +lie +beat +excite +natural +view +sense +ear +else +quite +broke +case +middle +kill +son +lake +moment +scale +loud +spring +observe +child +straight +consonant +nation +dictionary +milk +speed +method +organ +pay +age +section +dress +cloud +surprise +quiet +stone +tiny +climb +cool +design +poor +lot +experiment +bottom +key +iron +single +stick +flat +twenty +skin +smile +crease +hole +trade +melody +trip +office +receive +row +mouth +exact +symbol +die +least +trouble +shout +except +wrote +seed +tone +join +suggest +clean +break +lady +yard +rise +bad +blow +oil +blood +touch +grew +cent +mix +team +wire +cost +lost +brown +wear +garden +equal +sent +choose +fell +fit +flow +fair +bank +collect +save +control +decimal +gentle +woman +captain +practice +separate +difficult +doctor +please +protect +noon +whose +locate +ring +character +insect +caught +period +indicate +radio +spoke +atom +human +history +effect +electric +expect +crop +modern +element +hit +student +corner +party +supply +bone +rail +imagine +provide +agree +thus +capital +won't +chair +danger +fruit +rich +thick +soldier +process +operate +guess +necessary +sharp +wing +create +neighbor +wash +bat +rather +crowd +corn +compare +poem +string +bell +depend +meat +rub +tube +famous +dollar +stream +fear +sight +thin +triangle +planet +hurry +chief +colony +clock +mine +tie +enter +major +fresh +search +send +yellow +gun +allow +print +dead +spot +desert +suit +current +lift +rose +continue +block +chart +hat +sell +success +company +subtract +event +particular +deal +swim +term +opposite +wife +shoe +shoulder +spread +arrange +camp +invent +cotton +born +determine +quart +nine +truck +noise +level +chance +gather +shop +stretch +throw +shine +property +column +molecule +select +wrong +gray +repeat +require +broad +prepare +salt +nose +plural +anger +claim +continent +oxygen +sugar +death +pretty +skill +women +season +solution +magnet +silver +thank +branch +match +suffix +especially +fig +afraid +huge +sister +steel +discuss +forward +similar +guide +experience +score +apple +bought +led +pitch +coat +mass +card +band +rope +slip +win +dream +evening +condition +feed +tool +total +basic +smell +valley +nor +double +seat +arrive +master +track +parent +shore +division +sheet +substance +favor +connect +post +spend +chord +fat +glad +original +share +station +dad +bread +charge +proper +bar +offer +segment +slave +duck +instant +market +degree +populate +chick +dear +enemy +reply +drink +occur +support +speech +nature +range +steam +motion +path +liquid +log +meant +quotient +teeth +shell +neck \ No newline at end of file