From 974739dc1883486d788c1bf465aed6363ff549b1 Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Sun, 5 Mar 2023 23:08:21 -0800 Subject: [PATCH] Helper icons for key buttons --- assets.mdesk | 8 ++++++++ assets/shift_icon.png | Bin 0 -> 1692 bytes assets/space_icon.png | Bin 0 -> 2060 bytes main.c | 26 ++++++++++++++++++++++++-- todo.txt | 2 +- 5 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 assets/shift_icon.png create mode 100644 assets/space_icon.png diff --git a/assets.mdesk b/assets.mdesk index 9a3618f..73c9f43 100644 --- a/assets.mdesk +++ b/assets.mdesk @@ -50,6 +50,14 @@ { filepath: "white square.png", } +@image shift_icon: +{ + filepath: "shift_icon.png", +} +@image space_icon: +{ + filepath: "space_icon.png", +} @image mystery_tile: { filepath: "mystery_tile.png", diff --git a/assets/shift_icon.png b/assets/shift_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..f1d9a02b0ffb6b87c225095466adac4a9deab528 GIT binary patch literal 1692 zcmcIli&N5h5dZ%0b)spPW@Va|ji%lCXd+8AHMH^_oUg3Rt_CwxOnkq{D>Lg9P09B= zQqO!BkBib}R`xZp7-j)BG@J+9nP40iNz1fYee zCb^&lfU=c~lcRSWG|!^rwEcF0?-oH@(os2DrHXLIZk|dv*YubX>e*VS%23@4 zk7T%Lo9LTfHfJzLT(mQ)LhHVhv$TyWktVxs_D}B7LtawohV@v*o}*2r_OXg7(il-F>-Z{FMZ9(SKV4>D{O^SNJG z-p64HZ~V;&=7`PO`T)a`ok@r@si1h&ETwBJ8dqB~l&`-NHgzxM7_2!i=yae1jGL|D zdAhQqDi;ZN)7) zZ(gqEK%GDf1YPICyn~|6Qlx7uZHa>Li7?Gww*G8d<+<1(>!|wB`*ZiHIusl`kg~AM z9la(I^4203t~_;Jsb9N#!xhx}|BATD^g0?sU1x?iIh#HoL+nftO$jd~*kEfOzHc~_ zz#sg&)YU}0!_3Hto{(7D>gA|Wk8K0W1?m+MeBv%f`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$jml!)~L%CiiXK$J;k%5uMu=Qb$+T`DE}#WKJDKSxko-4Ij25x zPuv>TkT) zw)<33$;cmp9C;LWW)KeF{*m7z3PJg}vcKlC??+4Ag)4TJnx&J<6?rp@d-SYAOwFs( z5TfMdE)8OMj~M^yDGg!0(J!F9WJ!RFj<)ThD5#L9nDd2A%g z?{asGl|O-+arTDkKvN0Bt1k>d3gIccDVArdNK?kO2h^WWjq&ostFE<5n~h&BXaiiC zcVaK!@m6s{ceK(en3(9P1-gn9a#UYATm27sg3n9J=?e;LcEqpB*Io+ zbW>8NH*hd>M-uuIc*dZ%`KELbrihk){{EdXL@uBGyC8ITbCLC+srgVxE<7jY(Dj8* zbA|XF2KGVmIk@Vkg1Q_YWy8O%9v;`xNRhSg!rX-!f&FxV?pO{9GV44wwc?%FImN>y zUO7E+fqQefU7;%XpEw_C!5eFj&CB_o-B2h;u(TWVzv3fk zI+{kDV-Gd3S>w{Toe9jN7&@JarKqukk(#8eBa)8Lp@I=X>6XSsrq@&L^bZ2fk@5b< zQ&N-$v%pMeOwa%IJB=n!9k(1k>nmG{g6)tqUt)NU`tdLO;yTXFwKRQ69{H`-E8rqEC7wvwaD-rgyT*fP0r z?c7kS7S^=KZ!eg*0R2DNI|Wj>Sg#dU+V3P_*BE5NKub$Yu`|tae;58paV?+Vnhmx^ zccl*}uEU*?;Ki!OD~evlThHG(XLK?^f+O$I1@C=1;xo{BE#q zX=&+Ib2IwqI^-$aMQ3N{;3isUC_N06rjSyT@osAFIYsO?k!8W$MV^1jR}3)KEK!+x zBvt7LWvOb^V?U9Zb#|N9mGM_Ep7u5Z6Z)){^n?T!QtPTInuOHT$_xTJ`~e4O7`FIn`PV<#fDko8L|T|wg#`ba 1.0) { @@ -2225,6 +2227,18 @@ void frame(void) } } + // ui + +#define HELPER_SIZE 250.0f + float total_height = HELPER_SIZE * 2.0f; + float vertical_spacing = HELPER_SIZE/2.0f; + total_height -= (total_height - (vertical_spacing + HELPER_SIZE)); + const float padding = 50.0f; + float y = screen_size().y/2.0f + total_height/2.0f; + draw_quad((DrawParams){false, quad_at(V2(padding, y), V2(HELPER_SIZE,HELPER_SIZE)), IMG(image_shift_icon), (Color){1.0f,1.0f,1.0f,fmaxf(0.0f, 1.0f-learned_shift)}}); + y -= vertical_spacing; + draw_quad((DrawParams){false, quad_at(V2(padding, y), V2(HELPER_SIZE,HELPER_SIZE)), IMG(image_space_icon), (Color){1.0f,1.0f,1.0f,fmaxf(0.0f, 1.0f-learned_space)}}); + PROFILE_SCOPE("flush rendering") { flush_quad_batch(); @@ -2275,6 +2289,14 @@ void event(const sapp_event *e) roll_just_pressed = true; } + if(e->key_code == SAPP_KEYCODE_LEFT_SHIFT) + { + learned_shift += 0.15f; + } + if(e->key_code == SAPP_KEYCODE_SPACE) + { + learned_space += 0.15f; + } #ifdef DESKTOP // very nice for my run from cmdline workflow, escape to quit if(e->key_code == SAPP_KEYCODE_ESCAPE) { diff --git a/todo.txt b/todo.txt index 1ff4a07..d4858f1 100644 --- a/todo.txt +++ b/todo.txt @@ -2,7 +2,7 @@ Happening: DONE - Animate text characters coming in DONE - Escape exits typing DONE - Get rid of enters and stars in javascript input box - - Space and e for attack and roll, tooltip +DONE - Space and e for attack and roll, tooltip - Skeleton enemy - Shopkeep character - Don't flip player direction when you walk vertically