From 26b790ed789802493e00e583d2b71008d949be85 Mon Sep 17 00:00:00 2001 From: marcus13345 Date: Tue, 7 Oct 2014 14:55:52 -0400 Subject: [PATCH] ADDED ALL THE THINGS --- .classpath | 6 + .project | 17 + .settings/org.eclipse.jdt.core.prefs | 11 + bin/MAndApps/AppHelper.class | Bin 0 -> 2650 bytes bin/MAndApps/BasicApp.class | Bin 0 -> 518 bytes bin/MAndApps/Button.class | Bin 0 -> 5292 bytes bin/MAndApps/ButtonListener.class | Bin 0 -> 159 bytes bin/MAndApps/Engine.class | Bin 0 -> 8949 bytes bin/MAndApps/ImageCreator.class | Bin 0 -> 5947 bytes bin/MAndApps/LogItem.class | Bin 0 -> 946 bytes bin/MAndApps/Pointer.class | Bin 0 -> 666 bytes bin/MAndApps/Variable$1.class | Bin 0 -> 597 bytes bin/MAndApps/Variable.class | Bin 0 -> 3081 bytes bin/MAndApps/VariableNotFoundException.class | Bin 0 -> 440 bytes src/MAndApps/AppHelper.java | 117 +++++ src/MAndApps/BasicApp.java | 95 ++++ src/MAndApps/Button.java | 195 ++++++++ src/MAndApps/ButtonListener.java | 7 + src/MAndApps/Engine.java | 449 +++++++++++++++++++ src/MAndApps/ImageCreator.java | 171 +++++++ src/MAndApps/LogItem.java | 38 ++ src/MAndApps/Pointer.java | 12 + src/MAndApps/Variable.java | 186 ++++++++ src/MAndApps/VariableNotFoundException.java | 10 + 24 files changed, 1314 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/MAndApps/AppHelper.class create mode 100644 bin/MAndApps/BasicApp.class create mode 100644 bin/MAndApps/Button.class create mode 100644 bin/MAndApps/ButtonListener.class create mode 100644 bin/MAndApps/Engine.class create mode 100644 bin/MAndApps/ImageCreator.class create mode 100644 bin/MAndApps/LogItem.class create mode 100644 bin/MAndApps/Pointer.class create mode 100644 bin/MAndApps/Variable$1.class create mode 100644 bin/MAndApps/Variable.class create mode 100644 bin/MAndApps/VariableNotFoundException.class create mode 100644 src/MAndApps/AppHelper.java create mode 100644 src/MAndApps/BasicApp.java create mode 100644 src/MAndApps/Button.java create mode 100644 src/MAndApps/ButtonListener.java create mode 100644 src/MAndApps/Engine.java create mode 100644 src/MAndApps/ImageCreator.java create mode 100644 src/MAndApps/LogItem.java create mode 100644 src/MAndApps/Pointer.java create mode 100644 src/MAndApps/Variable.java create mode 100644 src/MAndApps/VariableNotFoundException.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fb565a5 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..3692a8c --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + MAndEngine + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7341ab1 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/bin/MAndApps/AppHelper.class b/bin/MAndApps/AppHelper.class new file mode 100644 index 0000000000000000000000000000000000000000..59aa296ffc3aa71f92f4c5d8b60070021f213cc6 GIT binary patch literal 2650 zcmah~T~iZR7=8{3SqKX#0`e6LwP+I5Sg49Xv3x1f@KHjsLai=g#l^6RyNQbZys+bK zr!&3quD$Zcn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hn+^+~blINi1@e42*CW+>0gLw|OXX5cD~hqfUm> zD+SyP1yM@zW}|Z5tqsZ(n<}Sq(N#W37^Gp9o*S-nX}X^JW`m8XJR7PTKq)NPt__Rf zO4>JjddNDmrm;P|g3JvRH{QA?L?drVy1$ELY#t}ES|$QabDbeAPP2ukv4cfv;cc#k znsJ3Cl0Y;$MaThN0?)rF7Ue~3zNMG=zxq=DN%~);{}lZv>EAB!|Iz>Y7x>tT?vwuj D*zz%s literal 0 HcmV?d00001 diff --git a/bin/MAndApps/BasicApp.class b/bin/MAndApps/BasicApp.class new file mode 100644 index 0000000000000000000000000000000000000000..b33fe2c18e5910505183daa87aa5e405b50be49a GIT binary patch literal 518 zcmYjOO-}+b5S=RWy$Xnk$`62xo9K}fiWs6q1IB~5vP`hBbV=LAz)$nw5Aa7Br)7y= z`ld5)-@bYM{`vd@fNN-EV2?q0(2a{_${y()bU!zO#kn7Kl5<5V<2~ z$@hyeA(^S}EW5==O5{fHEf6qbODZ_JpN)yM!-oY-tAc6}<$2M}Z$e8f@?x$U4j=m`|{fU=chw iKZGNPr3A}Rara}WIy`}z!&9g`JhMoDJg0LHE`9;#BX@fM literal 0 HcmV?d00001 diff --git a/bin/MAndApps/Button.class b/bin/MAndApps/Button.class new file mode 100644 index 0000000000000000000000000000000000000000..6f314ea4d1498ff092dbb3481e872789b9be0880 GIT binary patch literal 5292 zcmd5<+kX`08Ga_&olQ1l2qA+)5{ie`WQo#(pf*AXn*<^uiGYDXD@=AL*@ex{x(C2o zwY7?^R$H;PBzVAjNNb=4WCLoomA1CE)r7SU!2!Cc$13i4 zK8F?tbRe0w2Md#9c6OIFmZHqY0VigqMyza7*4}0fW%t-hW}t1aNYd}}1b4Lc`yq`w zDJR?6&%dj^@9%FP2~%~4fp*-Y;gU1oO}SOi_))WU%APqywda4oKr*+v7)+}S1rbuPnZ1BN^6F>sAL>oZUf zJ%p_qTFR(O3aSXt@o}4JQy2?l3+@&pm~g#~!D$~6HQNn@P$RP;gBGa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W40j!vT(VMf-? z;EYfNPBDKKB#TKhg}MmSMUp4|qiH;(@;rlr@C8p{gMT=MW+mEGq9dahaC_hY@i2p} zKG8IR!TeL~T9Kfi!Yaj7=gDpLNvF`@Sx^&UO4mg^Q$y7=X!O+AG}O-^*bsW6NK2@( zllvR^>6~c7gHDVvl#ExaYnx`gfG$R8Gb0>j%zBuyK4xVLXIs(F{{h_1*T6R1he0GU zgs)>5-^4w5iWoSFU2KRWjQeh!!ye3$@@?$JhuDWdVn06Nd+IO5$v+U+YGM2LTnl?> zc!>H}qOSdhrj91FDKNlX$>$1Frb*ta_$B4zVLZZbDJQ#VyOa}?KHdHj7P(Q4Gpd2p z)u(yjy4I-fa)PcU36F!ky(wQk@2*=FL_NhVp~P>{E2W{jgV&o^T|3S^JUWNR^~R?z z;k(;cbF-#4 zg;%1QzzyM8h?P;sA%6P!xk9*A91-3mIr}LdCFBW3pQ%dYP74C%9o_;(Q@NvvS`qY# zN>uZpv#65qn%zoAOKN*24`LW{O9PMvxo6;mdW}Ztxz8XURZvbm< zeFZJet!D7Rt7vL51FxW--=@xGa9&MWs$K=J^3n1dHsEy>@CJc0s#5`xAl0dWR8jDSviN;+S9oShiSKG=jqb^s-^HNl7*|T*URBAGfJBU$Ls=`YyOH$|7BuQ&Qb0s_vPu;S!sj+m!C4 zq2h)VJ!=l{H2$*jgE{>AEVn8j$ZuDOSyUGDJN(`gvznubky<$+y{wY?y$a@FnfVX+ r$Yb6}YI#!YkyU){E%f38dU07vke>qbVlTamb+&40fEtUXX#Ds;gya7i literal 0 HcmV?d00001 diff --git a/bin/MAndApps/ButtonListener.class b/bin/MAndApps/ButtonListener.class new file mode 100644 index 0000000000000000000000000000000000000000..e30ff24489f701d735399a88dc2dce1c3521b70c GIT binary patch literal 159 zcmX^0Z`VEs1_omWPId++Mh0TVH5tEew()z-ugL0ouNaVd4Fb+>A5UE4mF*Y|wyX{Fz}|H;g-wEiCaX6~K4ob@~B zo_pcBZy$aPz)|wK4@H9Vw)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LQ?t!o3yYb*Tj-;7+r375^O8M%4`HuXU}-p~oXIGp{ej9j-()|2tl;dmy*+)&{U zRaKZ3p^R*}NOo3j-1&AdBCT8yx3bGdvZ?iWvZtK14dI8srqOp7DRoqA|atzw3JA(vCH<#_~|#(&5>iEx-kb5AEE z>M@*cr8E#0vj~f3!eS1Nhlsd8O-`_4~v`k=z;2XDeK_xD2!dQnoi_^nBzwM4at`e+pox!Fvj_8nALwePZCWkBPiWgS-*&=*(_T<8F?(975p}~ z&L@EjEKfHLjgTkgm)t3Oy~+p!@^TJ+N9lV08KQ|=e(M>K*Yd<%xz_W44cy4++hB<*KfgY~WtFU_ z1WKZu2XH~1zdMnQ4C7lEzPDN;uK&tK^R@c#4S6$5ZVp>zQBKFa#j6CH_jsGwo!lm7 zggZ#?&H_ctbBdPJR(~KNkw5-_3Exe^_mJ?t-$D3;9N~ZHga-;p?CJzpwhzCXMBjIi z_~^SyxRtmI-MvZiagM}^S<@FYG^XVZ?#AB3^xxJ3X^L~kE+(p6g+AGn6l>=_NIgzc c+x{u3BKedMD3U+PpV{iG?_c=R_?frt@4*U2$N&HU literal 0 HcmV?d00001 diff --git a/bin/MAndApps/ImageCreator.class b/bin/MAndApps/ImageCreator.class new file mode 100644 index 0000000000000000000000000000000000000000..a19db156d1e439706563a7f4f3cb3cc6d9e868e7 GIT binary patch literal 5947 zcmai2dvw#)9sk_?@^0EDO@Afn0}v(@gq2ndwpIG%(Fs&q(@`)8j0Klg`!%$@CQXXoq;o!#f&Uz&s(H9fiad%ySI z@B4An-+lhh6#zHleH%;y`sS8cUrQn}QqwUU90<21!@*QMX@gn7y+3#$SQ8D#25LHc z_lH9%0qZT1SR}PpK&xK1UBKKH?+ZJj!Qp}hR)OM8kyv=k=x}d1xh>cm4GWZPiid*H z?ZIS3uG2_!YA`Y)FmF>{=8Xcrkd(uaC?1U`cSKTyTjG%s61=gxqhphjEO;u7&}I2rC!BpPk-2vlY+^jmu~UH=0~%mN%sxc0~G8g94U= z#w^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dUlG4fsYDfV7PanWaR zad}YVQ_0Hpe^EBWhksG-Exx$an_1qPH_vpH|9CbC?975eg0wY%9;dt5TKa{afwOuV m?=9gs{svdM&*oQD+bUCy$w@6bxiA0Ub%l_LRDPq*|Mvf1x77sz literal 0 HcmV?d00001 diff --git a/bin/MAndApps/LogItem.class b/bin/MAndApps/LogItem.class new file mode 100644 index 0000000000000000000000000000000000000000..ba36531a65e05655570c481900db345384a9807e GIT binary patch literal 946 zcmZuu!A=uV6g{sqZDE)Sot9ckQBc$}DAl;cm^4OAlOhWYiL4yju?!ui%`kv|ic9xy zOspm@`~W}7c<$>&8g(&!=iPVDIrpCa{Pq0@fX8^0M@C^`w-xnTqtRKjGwin$|1=Mi z)f4Z+YldFbZ|)tP_}xUo41>46f@%|X+B?q`vR)WmNa;|)2#0+Ir*p;IPvRizZ!6@U z1W}MYRj4%neQs|YQ198W=UXtaV8cd{YK@J9StyijSeO&EXk!Mmg09=hBPVFdMix1R z`A!h|FV9bp{P>l36mlY`GwgcdffomIPm5-99GuD9-y3sA#RoG9x&wv6e&TfpyWS|J z+b}zx1IinTQUdMn32K1+C)ZzBFac~ z`ec~;WW2hATol-Ujkf{>z2=!@RpWhU1!Jl->Fm71tP}`dL$J{Hi4f{o;f<2G!7indjFch1iDGJe$ZmOCc3*!%)qF!Mmw;d8BWA?9EY=2X z0f(j{Xz{j4vl=bL(w<19maD8#w8r8ZZlykbQibeLx%>fzO`cAD?jGE2f_aGJ1`iF0N0Fo=rUzn!4-Z EZ&($Uf&c&j literal 0 HcmV?d00001 diff --git a/bin/MAndApps/Pointer.class b/bin/MAndApps/Pointer.class new file mode 100644 index 0000000000000000000000000000000000000000..4e5d0e2ad6277b8460bef33dfbeb01978f0b458a GIT binary patch literal 666 zcmZWm%TB^j5IwgKptS-b58uXJi-|1UDIr0FD|{pn_ANAc3AUsZ6aPvRjfo3Cz>hM{ zEd>Kz^xl~>bLPys{rUa+25^q!G$e-nZPObxCzEOI!RKD+25BgSj_hZe3}3N literal 0 HcmV?d00001 diff --git a/bin/MAndApps/Variable$1.class b/bin/MAndApps/Variable$1.class new file mode 100644 index 0000000000000000000000000000000000000000..886277763b6b96811df4506e5dcf2e7058593f04 GIT binary patch literal 597 zcmZuuT}#725S(kOY2#^QYwNdG=|inxErJM&Afg~t1(m*E)1ys^7s)05FF{d!@CW## z#JyTktbt?iW_M<1H}4;>Zvb|%ZX?A|I6qRIqq{p@Z;8kk?LbxR>)PsSX>oAEtdFq=nC%?OGnI({^6XgY=_Eq;>#=Wq^v5GR$wTxRLNQhCa zHh=bY9Y<8UZ^q$gO3COr5L!!(G7WCg83S`&Ge7;F6rC&_LMQ09M{k2Twaq8++B2pe z1~t6na$}2)Fi0cqtU2I zjAmb|VkK3na*1FmC?{522vn>-*ll_uO-r=AVE6_zS>JeCLNpLved! za;Pz#wrYBfOw1UJn||bJC^~J788vYud9tQ+@U$7VHTcGi_^7EN6q!BiwllHh$$AZe z;aJ@4GVD_t{IYG1Wi%|3UCUY9Oj@y2l9!qqyIYPow;kfPAsUY*WA+{m-ipdz4SD-g zLv+1Z!_ueCH;u;PLuMw3LKN!=LD!Jqpp*kBrN73muI9#`#vqnpnIB8%fbTwM*=9n= za;%`%Nt0N{G;FGvA4BDQk$7CC<5{exu8~fg$sr9}|Cg?dxjulk8nmNgX}yjOC}-$) z%Arj|X~hCw3qXK6g2)e`g7l0T84-nb6o_bx23>L%i47i&rZQ##)fx)SEXzS&-6kw; z*HE_r)cH})mkd<)ikY1{b}7K5t=Gx@;z%rMc8n$l%}kHfic~`?YQ(d(;|fb6^Qx*o z2rr6*s6&GvESQ`EbJ)=FB3KQ6Rb`#SPbJAI!ukd15^DEKz>ONp76`bqSJ>O9BOvUx zFdNk(*ssHnd{Bs|DH@V$ z&r2E!65<<9WujcQ0UlVkv_ZFRL`T|WzoN~2IE{YG2Y-LpG`@3)JP^JA=mMV zRKuq{byJWyk{qgBgY4TNi?_+JoB7`OAL%DI}fS_6X|OcIQ!y;WtkS%v97%Q1o_~R=HkvHy{J|;Dc7KkI<;~Nsx^RT zpi^%V-_n$6Tx+LM*gu7$P|0JIO=4we4Ih(O_YfOHn;)Wb8d`s-Dzr7U**k@rgW*Z+ zp!7a9J$R1KCG-v~!wOFLHCT&ktfzbfYAF?8)kIZ+=lRAlhwYActsHp@(|C9aFN6ic z18jVZ-BWm}%JKgQP4ndn+!jIE%*O*%X79Gr&Vf4La^K%r9Nzi}2l?K97c0v0?#vMs zgqQnxD)7Aueyt*-mT-1s73b;!>_G>b(Tx^PfmR&Fem405#L$KW4wAMA`=&#Mx5o(q zT`D|a9Iv>fj^hw_9(oy9$&o~j(`FC-bf6Ni^3;c3N>{@B1jmu@hvr9}^D8@`$VaaD z>2MfB4OhvRFZ>%0-s8rh-$`QM4Bb)?4jv7CXmphiQz~edg{v6-G!FMqW1ycL9i77Q zNes@WGem^I3EnqQ3KL5)tZXlF^k-sS#v9_>BlFz#@(Vc?FZDER^6%6%M*0c2bqa|{ zm0M>5-^rTyPk1Mh>|??+cM*ti9lcLe0qkIE#@qz0=Q|K5tOR#yf;z*R%J7awVB=)! zoC3I(_vzXNSc=s+kJo8UQu_wpvBjMm# zcF{&$rKro=fqz%17?j2W|NBlV}g?SOW=7z!yZ*` z6H;?mg$sVVUA*7ZrBuL%TzJ#C-d{C^n*#5%4nA&gy%*8$Q3a~!v$=9`{z#lZp$tEB zCj3h5_c#^qb6!1EICrsdXnqD~sf)9Wv*`}LAea>-QX0fd9Zyc~SZ*hnJ5IGPX9{~K zF*sepc{Q7@AQgefjO2IaRI(wRA^nM>0KUR8N@NUfoH4+GF>AnSs}ZFvrabssJ-@-X MT;-cSz?DD$0cUk~asU7T literal 0 HcmV?d00001 diff --git a/bin/MAndApps/VariableNotFoundException.class b/bin/MAndApps/VariableNotFoundException.class new file mode 100644 index 0000000000000000000000000000000000000000..48f41fcc65c73ac4333847e313689153073c68ee GIT binary patch literal 440 zcmah_yH3ME5S+8~!WaTcY7`Jff&?xogODObDkn`)`ip&-L*~x1&xp^03W-@@%2+AG9$HWqQ=m@ z=Z`!{xk`ec21DaQDrqhm+`(|cP`lEx@Ze(0M;#4@b|{sYl@Cji-&k#iPN*ZER=d{4 znz@q&!*TfkF(U>q5oRiif+wWc8w|tEX>*fHm5f^0r%lz8zS5?DYb_CXuFE_U6KQWb zs3!hcKC_ZI1R0~h0vvjgA;KnQ0Yyf!e)5Xe%c|`W+BOxjP3W)RK6WT$*hQPrl20kx YIk&U-Ou@m1+WJLxN#dK@Sxt4n07JQ7RR910 literal 0 HcmV?d00001 diff --git a/src/MAndApps/AppHelper.java b/src/MAndApps/AppHelper.java new file mode 100644 index 0000000..4db6ba1 --- /dev/null +++ b/src/MAndApps/AppHelper.java @@ -0,0 +1,117 @@ +package MAndApps; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.Scanner; + +/** + * also a bit of an app helper class thing + * well... i renamed it so, now it just is an app helper class thing. + * @author Marcus + * + */ +public class AppHelper implements Runnable{ + + private static String[] namesLookupTable; + private static String[] classNamesLookupTable; + + private BasicApp[] apps; + private boolean done = false; + private int progress = 0; + private int TOTAL_PROGRESS = 1; + + private String[] classes; + + public AppHelper(String[] classes) { + this.classes = classes; + } + + public void run() { + ArrayList apps = new ArrayList(); + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + + try{ + + + for(int i = 0; i < classes.length; i ++) { + String str = classes[i]; + + Class _class = classLoader.loadClass(str); + Object obj = _class.newInstance(); + + //if it actually is one of us, repeatedly say one of us... + //one of us... + //one of us... + if(obj instanceof BasicApp) { + apps.add((BasicApp)(obj)); + } + progress++; + } + + this.apps = new BasicApp[apps.size()]; + + for(int i = 0; i < this.apps.length; i ++) { + this.apps[i] = apps.get(i); + } + + classNamesLookupTable = new String[this.apps.length]; + namesLookupTable = new String[this.apps.length]; + for(int i = 0; i < this.apps.length; i ++) { + + classNamesLookupTable[i] = classes[i]; + namesLookupTable[i] = this.apps[i].getTitle(); + + } + //progress = 1; + done = true; + }catch(Exception e) { + + e.printStackTrace(); + + System.exit(1); + } + } + + public BasicApp[] getApps(){ + return apps; + } + + public boolean getDone(){ + return done; + } + + public double getProgress(){ + return (double)progress/TOTAL_PROGRESS; + } + + public static int getIDbyClass(String className) { + for(int i = 0; i < namesLookupTable.length; i ++) { + if(namesLookupTable[i].equalsIgnoreCase(className)){ + + return i; + + } + } + return -1; + } + + /** + * iterative method, probs shouldn't call this during a + * tick or something. like do it in a thread during a splash screen + * or something. + * @param appName + * @return + */ + public static int getIDbyName(String appName) { + for(int i = 0; i < namesLookupTable.length; i ++) { + if(namesLookupTable[i].equals(appName)){ + + return i; + + } + } + return -1; + } +} diff --git a/src/MAndApps/BasicApp.java b/src/MAndApps/BasicApp.java new file mode 100644 index 0000000..d740bf8 --- /dev/null +++ b/src/MAndApps/BasicApp.java @@ -0,0 +1,95 @@ +package MAndApps; + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import javax.imageio.ImageIO; + +/** + * constructor should initialize nothing it shouldn't have to + * because it will be initialized before the main menu is displayed. + * and before the main menu is displayed some variables and such may give + * weird values as they are all changing. + * preferably, everything should be initialized in the initialize method.

+ * please do not implement a game loop in any of these methods. + * the tick and render take care of that. + */ +public abstract interface BasicApp { + + /** + * will only get called when setting the window dimension. + * otherwise, is stored in main temporarily. (avoiding + * creating 30+ objects per second...) + */ + public abstract Dimension getResolution(); + + /** + * the proper place to do initialization + * note: THIS WILL BE CALLED MULTIPLE TIMES. + * SO KEEP TRACK OF THAT. + * if you want you app to work with multitasking + * make sure to deal with this correctly. + */ + public abstract void initialize (); + + /** + * resume from a pause, called after initialization + */ + public abstract void resumeApp (); + + /** + * do anything that needs to be done to put the app on pause for a moment. + * only called when exiting and switching to another app. + */ + public abstract void pauseApp(); + + /** + * method for applying any ticking logic + */ + public abstract void tick(); + + /** + * to render things to a canvas + * @param g + */ + public abstract void render(Graphics2D g); + + public abstract void keyPressed(KeyEvent e); + public abstract void keyReleased(KeyEvent e); + + /** + * return the title of the app to be displayed in the + * top of the screen and on the home menu. + */ + public abstract String getTitle(); + + /** + * color of outline of app title border. + * @return + */ + public abstract Color getColor(); + + /** + * the framerate that this should be run at. + * @return + */ + public abstract int getFramerate(); + + /** + * should this window be resizable + * @return + */ + public abstract boolean getResizable(); + + /** + * answers the question if this app should be displayed in the menu + * useful for apps like ... the menu. or maybe you want to + * link your app to another, you can do that too. just + * make sure they're both installed! + * @return + */ + public abstract boolean visibleInMenu(); +} \ No newline at end of file diff --git a/src/MAndApps/Button.java b/src/MAndApps/Button.java new file mode 100644 index 0000000..a15abd2 --- /dev/null +++ b/src/MAndApps/Button.java @@ -0,0 +1,195 @@ +package MAndApps; + + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.BufferedImage; + +import static MAndApps.Engine.mouseX; +import static MAndApps.Engine.mouseY; +import static MAndApps.Engine.mouse; + +public class Button { + private int clickLevel = 0; + private Image normal, hover, down; + private int x, y, width, height; + private int clicks = 0; + private int leftPadding, bottomPadding; + private String text; + private static final int DEPTH_ON_CLICK = 7; + private double depth = DEPTH_ON_CLICK, desiredDepth = DEPTH_ON_CLICK; + private int ID; + private boolean active; + + private static final int shadowOffset = 10; + private static boolean debug = false; + + public static void setDebug(boolean debug) { + Button.debug = debug; + } + + public Button(int id, Color c, int x, int y, int width, int height, String text, int leftPadding, int bottomPadding) { + this(id, c, x, y, width, height, text, leftPadding, bottomPadding, true); + } + + public Button(int id, Color c, int x, int y, int width, int height, String text, int leftPadding, int bottomPadding, boolean active) { + + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + normal = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); + hover = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); + down = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); + + normal = ImageCreator.createImageCloud(width, height, c); + hover = ImageCreator.createImageCloud(width, height, c.brighter()); + down = ImageCreator.createImageCloud(width, height, c.darker()); + + this.text = text; + this.leftPadding = leftPadding; + this.bottomPadding = bottomPadding; + + this.ID = id; + + this.active = active; + } + + public void poll() { + + if (active) { + // figure out the new click level of the button and add a click if + // we clicked it + if (clickLevel == 0) { + if (inBoundingBox(mouseX, mouseY) && !mouse) { + clickLevel = 1; + } + } else if (clickLevel == 1) { + if (inBoundingBox(mouseX, mouseY) && mouse) { + clickLevel = 2; + } else { + if (!inBoundingBox(mouseX, mouseY)) { + clickLevel = 0; + } + } + } else if (clickLevel == 2) { + if (inBoundingBox(mouseX, mouseY) && !mouse) { + clickLevel = 1; + clicks++; + + } else if (!inBoundingBox(mouseX, mouseY)) { + clickLevel = 3; + } + } else if (clickLevel == 3) { + if (!mouse) { + clickLevel = 0; + } else { + if (inBoundingBox(mouseX, mouseY)) { + clickLevel = 2; + } + } + } + }else{ + clickLevel = 4; + } + // uh... UIFM + desiredDepth = clickLevel == 1 ? 0 : clickLevel == 2 ? DEPTH_ON_CLICK * 2 : DEPTH_ON_CLICK; + depth += ((desiredDepth - depth) / 4d); + } + + public boolean hasNextClick() { + if (clicks > 0) { + clicks--; + return true; + } else + return false; + } + + public void render(Graphics2D g) { + + // draw shadow + + // set color to black + g.setColor(Color.BLACK); + + // set alpha for draw + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f); + g.setComposite(composite); + + // draw + g.fillRect(x + shadowOffset - (int)((depth - 10)/2d), y + shadowOffset, width, height); + + // reset alpha + composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f); + g.setComposite(composite); + + // depending on the click level, draw the corresponding representative + // image + // tightened that up a bit by making the image an in line if + g.drawImage((clickLevel == 1 ? hover : (clickLevel == 2 || clickLevel == 4) ? down : normal), x + (int) (depth - DEPTH_ON_CLICK), y + (int) (depth - DEPTH_ON_CLICK), null); + + // where to put the text + // edit: + // okay seriously this makes no sense. + // FIX! i don't know what to fix though, its THAT borked. + // edit: + // FIXED! FUCK IT! I REMOVED IT ALL! + + // see that code ^^^^^^^ + // no? + // good. + // so i decided to bring it back... xD im not quite sure + // what was here but... text is going here now so :P + g.setColor(Color.BLACK); + g.drawString(text, x + leftPadding + (int) (depth - DEPTH_ON_CLICK), y - bottomPadding + height + (int) (depth - DEPTH_ON_CLICK)); + + // because depth is complicated, thats why. + if (debug) { + // render the bounding box... + g.setColor(Color.RED); + int x = this.x + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int y = this.y + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int width = this.width - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int height = this.height - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + g.drawRect(x, y, width, height); + } + + } + + private boolean inBoundingBox(int mouseX, int mouseY) { + int x = this.x + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int y = this.y + (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int width = this.width - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + int height = this.height - (depth < DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0) + (depth > DEPTH_ON_CLICK ? (int) (depth - DEPTH_ON_CLICK) : 0); + return (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height); + } + + public void updatePosition(int x, int y) { + this.x = x; + this.y = y; + } + + public void move(int dx, int dy) { + x += dx; + y += dy; + } + + public void resetButtonState() { + clickLevel = 0; + } + + public String getNameID() { + return text.toUpperCase().replace(" ", ""); + } + + public int getID() { + return ID; + } + + public void changeName(String name) { + this.text = name; + } +} diff --git a/src/MAndApps/ButtonListener.java b/src/MAndApps/ButtonListener.java new file mode 100644 index 0000000..2e82146 --- /dev/null +++ b/src/MAndApps/ButtonListener.java @@ -0,0 +1,7 @@ +package MAndApps; + + + +public interface ButtonListener { + public abstract void click(String name, int id); +} diff --git a/src/MAndApps/Engine.java b/src/MAndApps/Engine.java new file mode 100644 index 0000000..885bd21 --- /dev/null +++ b/src/MAndApps/Engine.java @@ -0,0 +1,449 @@ +package MAndApps; + +import java.awt.*; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.awt.image.BufferedImage; +import java.util.Stack; + +import javax.swing.*; + +public class Engine extends Canvas implements KeyListener, MouseMotionListener, + MouseListener { + + /** + * to track the x and y + */ + public static int mouseX = 0, mouseY = 0; + + /** + * if the mouse is down + */ + public static boolean mouse = false; + + /** + * some number that we use in stuff to animate. move 1/8 the distance when + * animating. + */ + public static final int ANIMATION_CONSTANT = 8; + + /** + * object thing that will initialize our apps for us, then give us an array! + */ + private static AppHelper appInitializer; + + /** + * AER WE SUPER SPEEDING?!?!? + */ + private static boolean overclock = false; + + /** + * current framerate and time required to sleep to achieve that framerate. + */ + private static int frameSync = 50, sleepTime = 1000 / frameSync; + + /** + * variables to track the fps, DON'T WORRY ABOUT IT, PAST YOU HAS YOU + * COVERED. + */ + private static int framesInCurrentSecond = 0, FPS = 0; + + /** + * more framerate stuff, again, chill. + */ + private static long nextSecond = System.currentTimeMillis() + 1000, + startTime = 0; + + /** + * if our current framerate is below our expected. its not directly + * calculated that way though. in all reality its calculated by if the + * dynamic thread sleep tries to sleep negative or not. + */ + private static boolean lag = false; + + /** + * this helps debugging, but we keep it private because well, it makes no + * sense. BUT IT WORKS SO WHATEVER. + */ + private static Stack log = new Stack(); + + /** + * current width and height. again, don't worry about it so much. PAST YOU, + * COVERED. also stores current app ID in array. THIS IS WHY MENU GOES FIRST + * IN CFG. + */ + private static int WIDTH = 800, HEIGHT = 600, app = 0; + + /** + * this bit is important. its the array of apps that we reference later on. + */ + public static BasicApp[] apps; + + /** + * our window object, probs important. + */ + private static JFrame frame; + + /** + * basic running condition. don't mess. don't mess. don't mess with the best + * cause the best don't mess. don't fool, don't fool. don't fool with the + * cool cause the cool don't fool don't bite my apple don't shake my tree. + * im an eagle don't mess with me! WORD! AND RESPECT! + */ + private static boolean running = false; + + /** + * FOR PROGRESS BAR DURING THE ERRORING PART OF DRAWING! seriously need to + * make that so if a game crashes it doesn't look like its reloading. + */ + private static double progress = 1; + + /** + * These are fonts. because STANDARDIZATION! + * worked good for oil, WHY NOT ME? + */ + public static final Font largerFont = new Font("Ubuntu", Font.BOLD, 20); + public static final Font defaultFont = new Font("Ubuntu", Font.BOLD, 11); + + /** + * a place to put your keys. current state. GET IT? tough crowd. ever feel + * like the compiler just... ignores my puns? + */ + public static boolean[] keys; + + /** + * SOMETHING NEW I JUST DID NOW GUISE! + */ + private static Image buffer; + private static Graphics2D g2; + + /** + * the main Main object but staticed so we can like use it from that static + * context. its not final because its static but don't change it. + */ + private static Engine staticMain; + + /** + * SRSLY CALL DYS ONCE. DAS IT. ALL YOU GET. ONE SHOT. + */ + public Engine(String[] classes, boolean showLoading) { + + //frame.setVisible(true); + + // set static object + staticMain = this; + + // initialize keys + keys = new boolean[512]; + + // set up window + frame = new JFrame(); + setSize(WIDTH, HEIGHT); + frame.add(this); + frame.pack(); + frame.setLocationRelativeTo(null); + addKeyListener(this); + requestFocus(); + + if(showLoading) frame.setVisible(true); + + //make a new thread of the appinitializer thing + //and like... make it do things. + appInitializer = new AppHelper(classes); + Thread thread = new Thread(appInitializer); + thread.start(); + + + + //we need to make a frame and such first + //more on that later + createBuffer(); + + + //while its faffing about, RENDER THINGS AND MAKE A LOADY THING + while(!appInitializer.getDone() || !(progress >= 0.999)){ + try{ + Thread.sleep(17); + }catch(Exception e){ + } + //this is the later part referred to by a few lines back + repaint(); + progress += (appInitializer.getProgress() - progress)/ANIMATION_CONSTANT; + } + + //we done now, gather the loot. + apps = appInitializer.getApps(); + + switchApps(0); + + } + + public void run() { + + + // REALLY???? + running = true; + + + + frame.setVisible(true); + + + // now we do stuff. + while (running) { + // FPS STUFF WORRY NOT, ITS ALL GOOD. MOVE ALONG. + startTime = System.currentTimeMillis(); + if (System.currentTimeMillis() > nextSecond) { + nextSecond += 1000; + FPS = framesInCurrentSecond; + framesInCurrentSecond = 0; + } + framesInCurrentSecond++; + + // tick stuff + tick(); + // paint the same stuff + repaint(); + + // FRAMERATE OVERCLOCKING AND SUCH, MOVE ALONG. + try { + if (!overclock) + Thread.sleep((long) Math.floor(sleepTime + - (System.currentTimeMillis() - startTime))); + else + Thread.sleep(0); + lag = false; + } catch (Exception e) { + lag = true; + } + } + } + + /** + * makes a buffer and stuff, called with new windows and things. MOVE ALONG + */ + private static void createBuffer() { + buffer = (Image) (new BufferedImage(WIDTH, HEIGHT, + BufferedImage.TRANSLUCENT)); + g2 = (Graphics2D) buffer.getGraphics(); + } + + // later make this NOT initialize something new every go... + // PROBABLY A GOOD IDEA PAST MARCUS, IMMA DO THAT NOW! + // ~present Marcus + // thank you my minions ~Future Marcus + public void update(Graphics g) { + // Graphics g2 = buffer.getGraphics(); + paint(g2); + g.drawImage(buffer, 0, 0, null); + } + + /** + * THIS THING, SWITCHES APPS N STUFF! WOO! + * + * @param i + * @return + */ + public static boolean switchApps(int i) { + try { + log("pausing " + apps[app].getTitle()); + apps[app].pauseApp(); + app = i; + log("initializing " + apps[app].getTitle()); + apps[app].initialize(); + log("resuming " + apps[app].getTitle()); + apps[app].resumeApp(); + log("setting window properties"); + setWindowProperties(apps[app]); + log("Started up " + apps[app].getTitle()); + + frame.pack(); + + // because we now use the ONE buffer system... yeah + // lets do something about thaaaaaaaaat... + createBuffer(); + + return true; + + } catch (ArrayIndexOutOfBoundsException e) { + e.printStackTrace(); + return false; + } + } + + /** + * sets the window properties for a given app + * + * @param app + */ + private static void setWindowProperties(BasicApp app) { + setWindowProperties(app.getResolution(), app.getFramerate(), + app.getResizable()); + } + + /** + * sets the window properties without an app having to be specified. + * + * @param dimension + * @param fps + * @param resizable + */ + private static void setWindowProperties(Dimension dimension, int fps, + boolean resizable) { + + staticMain.setSize(dimension); + frame.setResizable(true); + frame.pack(); + frame.setLocationRelativeTo(null); + WIDTH = dimension.width; + HEIGHT = dimension.height; + setFramerate(fps); + frame.setResizable(resizable); + + } + + public void paint(Graphics g) {// oh..... + + Graphics2D g2d = (Graphics2D) g; + + render(g2d); + + } + + private static void render(Graphics2D g) { + + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + g.setFont(defaultFont); + + try { + // set default graphics shit + g.setFont(defaultFont); + g.setColor(Color.WHITE); + + // try and do the normal thing + apps[app].render(g); + + // aaaaand back to us! + g.setFont(defaultFont); + g.setColor(Color.WHITE); + + // show fps if debug level high enough + g.drawString("FPS: " + FPS, 20, 20); + if (overclock) + g.drawString("Overclocking!", 20, 35); + g.setColor(Color.RED); + if (lag) + g.fillOval(10, 10, 10, 10); + + g.setColor(Color.WHITE); + if (!(log.size() == 0)) + for (int i = log.size() - 1; i >= 0; i--) + log.elementAt(i).render(g, WIDTH - 200, + HEIGHT - 10 - (i * 12)); + } catch (Exception e) { + g.setFont(largerFont); + g.setColor(Color.BLACK); + g.fillRect(0, 0, WIDTH, HEIGHT); + g.setColor(Color.GREEN); + g.fillRect(100, 300, (int) (progress * 600), 20); + g.setColor(Color.RED); + g.drawRect(100, 300, 600, 20); + g.setColor(Color.BLUE); + g.drawString("Loading", WIDTH / 2 - 40, HEIGHT / 2 - 200); + + } + + } + + private void tick() { + apps[app].tick(); + for (int i = 0; i < log.size(); i++) + log.elementAt(i).tick(); + + int i = 0; + while (i < log.size()) { + if (!log.elementAt(i).getAlive()) + log.remove(i); + else + i++; + } + + while (log.size() > 10) { + log.pop(); + } + } + + public static void log(String s) { + log.insertElementAt(new LogItem(s, 100), 0); + } + + @Override + public void keyPressed(KeyEvent e) { + apps[app].keyPressed(e); + if (e.getKeyCode() == KeyEvent.VK_O) { + overclock = !overclock; + } + keys[e.getKeyCode()] = true; + } + + @Override + public void keyReleased(KeyEvent e) { + apps[app].keyReleased(e); + keys[e.getKeyCode()] = false; + } + + @Override + public void keyTyped(KeyEvent arg0) { + } + + public static void exit() { + frame.dispose(); + System.exit(0); + } + + private static void setFramerate(int fps) { + frameSync = fps; + sleepTime = 1000 / frameSync; + } + + @Override + public void mouseDragged(MouseEvent e) { + mouseX = e.getX(); + mouseY = e.getY(); + } + + @Override + public void mouseMoved(MouseEvent e) { + mouseX = e.getX(); + mouseY = e.getY(); + } + + @Override + public void mouseClicked(MouseEvent arg0) { + } + + @Override + public void mouseEntered(MouseEvent arg0) { + } + + @Override + public void mouseExited(MouseEvent arg0) { + } + + @Override + public void mousePressed(MouseEvent arg0) { + mouse = true; + } + + @Override + public void mouseReleased(MouseEvent arg0) { + mouse = false; + } +} \ No newline at end of file diff --git a/src/MAndApps/ImageCreator.java b/src/MAndApps/ImageCreator.java new file mode 100644 index 0000000..c07be57 --- /dev/null +++ b/src/MAndApps/ImageCreator.java @@ -0,0 +1,171 @@ +package MAndApps; + + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.io.IOException; + +public class ImageCreator { + public static BufferedImage creatImageColorWithNoise(int width, int height, Color c, int variationIterations) { + BufferedImage image = (new BufferedImage(width, height, BufferedImage.TRANSLUCENT)); + Graphics graphics = image.getGraphics(); + final int variant = variationIterations; + for (int i = 0; i < image.getWidth(null); i++) { + for (int j = 0; j < image.getHeight(null); j++) { + + double r = c.getRed(); + double g = c.getGreen(); + double b = c.getBlue(); + + for (int k = 0; k < variant; k++) { + r *= 0.9d; + g *= 0.9d; + b *= 0.9d; + + r += (int) (Math.random() * 25); + g += (int) (Math.random() * 25); + b += (int) (Math.random() * 25); + } + + Color color = new Color((int) r, (int) g, (int) b); + graphics.setColor(color); + graphics.fillRect(i, j, 1, 1); + } + } + return image; + } + + public static BufferedImage creatImageWithStripes(int width, int height, Color c) { + return creatImageWithStripes(width, height, c, c.darker()); + } + + public static BufferedImage creatImageWithStripes(int width, int height, Color c, Color c2) { + BufferedImage image = (new BufferedImage(width, height, BufferedImage.TRANSLUCENT)); + Graphics graphics = image.getGraphics(); + for (int i = 0; i < image.getWidth(null); i++) { + for (int j = 0; j < image.getHeight(null); j++) { + + boolean b = Math.floor(((i + j) / 2d)) % 2 != 0; + + graphics.setColor(b ? c : c2); + graphics.fillRect(i, j, 1, 1); + } + } + return image; + } + + public static BufferedImage getScaledImage(BufferedImage image, int width, int height) throws IOException { + int imageWidth = image.getWidth(); + int imageHeight = image.getHeight(); + + double scaleX = (double) width / imageWidth; + double scaleY = (double) height / imageHeight; + AffineTransform scaleTransform = AffineTransform.getScaleInstance(scaleX, scaleY); + AffineTransformOp bilinearScaleOp = new AffineTransformOp(scaleTransform, AffineTransformOp.TYPE_BILINEAR); + + return bilinearScaleOp.filter(image, new BufferedImage(width, height, image.getType())); + } + + public static BufferedImage getScaledImage(BufferedImage image, double scale) throws IOException { + int imageWidth = image.getWidth(); + int imageHeight = image.getHeight(); + + double scaleX = scale; + double scaleY = scale; + AffineTransform scaleTransform = AffineTransform.getScaleInstance(scaleX, scaleY); + AffineTransformOp bilinearScaleOp = new AffineTransformOp(scaleTransform, AffineTransformOp.TYPE_BILINEAR); + + return bilinearScaleOp.filter(image, new BufferedImage((int) (imageWidth * scale), (int) (imageHeight * scale), image.getType())); + } + + public static BufferedImage createImageCloud(int width, int height, Color color) { + return createImageCloud(width, height, 0xFF000000 | (color.getRed() << 16) | (color.getGreen() << 8) | (color.getBlue() << 0)); + } + + public static BufferedImage createImageCloud(int width, int height, int color) { + return createImageCloud(width, height, 0x000000FF&(color>>16), 0x000000FF&(color>>8), 0x000000FF&(color)); + } + + public static BufferedImage createImageCloud(int width, int height, int r, int g, int b) { + return createImageCloud(width, height, r/255d, g/255d, b/255d); + } + + public static BufferedImage createImageCloud(int width, int height, double Rx, double Gx, double Bx) { + // two to the \/ power = datasize... + double power = width > height ? width : height; + power *= 2; + power = (int) (log(2, power) + .5); + //not my code hell if i know how it works + final int DATA_SIZE = (int) Math.pow(2, power) + 1; + final double SEED = 1000.0; + double[][] data = new double[DATA_SIZE][DATA_SIZE]; + data[0][0] = data[0][DATA_SIZE - 1] = data[DATA_SIZE - 1][0] = data[DATA_SIZE - 1][DATA_SIZE - 1] = SEED; + double h = 500.0; + for (int sideLength = DATA_SIZE - 1; sideLength >= 2; sideLength /= 2, h /= 2.0) { + int halfSide = sideLength / 2; + for (int x = 0; x < DATA_SIZE - 1; x += sideLength) { + for (int y = 0; y < DATA_SIZE - 1; y += sideLength) { + double avg = data[x][y] + + data[x + sideLength][y] + + data[x][y + sideLength] + + data[x + sideLength][y + sideLength]; + avg /= 4.0; + data[x + halfSide][y + halfSide] = avg + (Math.random() * 2 * h) - h; + } + } + for (int x = 0; x < DATA_SIZE - 1; x += halfSide) { + for (int y = (x + halfSide) % sideLength; y < DATA_SIZE - 1; y += sideLength) { + double avg = data[(x - halfSide + DATA_SIZE) % DATA_SIZE][y] + + data[(x + halfSide) % DATA_SIZE][y] + + data[x][(y + halfSide) % DATA_SIZE] + + data[x][(y - halfSide + DATA_SIZE) % DATA_SIZE]; + avg /= 4.0; + avg = avg + (Math.random() * 2 * h) - h; + data[x][y] = avg; + if (x == 0) + data[DATA_SIZE - 1][y] = avg; + if (y == 0) + data[x][DATA_SIZE - 1] = avg; + } + } + } + //end wtf code + BufferedImage img = new BufferedImage(DATA_SIZE, DATA_SIZE, BufferedImage.TYPE_4BYTE_ABGR); + double min = SEED; + double max = SEED; + for (int i = 0; i < DATA_SIZE; i++) { + for (int j = 0; j < DATA_SIZE; j++) { + if (data[i][j] < min) + min = data[i][j]; + if (data[i][j] > max) + max = data[i][j]; + } + } + for (int i = 0; i < DATA_SIZE; i++) { + for (int j = 0; j < DATA_SIZE; j++) { + img.setRGB(i, j, (0xFF000000) | ((int) (((data[i][j] - min) / (max - min)) * 255) << 16) | ((int) (((data[i][j] - min) / (max - min)) * 255) << 8) | ((int) (((data[i][j] - min) / (max - min)) * 255))); + } + } + for (int i = 0; i < DATA_SIZE; i++) { + for (int j = 0; j < DATA_SIZE; j++) { + int r = (int) ((double) ((img.getRGB(i, j) >> 16) & 0x000000FF) * Rx); + int g = (int) ((double) ((img.getRGB(i, j) >> 8) & 0x000000FF) * Gx); + int b = (int) ((double) ((img.getRGB(i, j) >> 0) & 0x000000FF) * Bx); + img.setRGB(i, j, 0xFF000000 | (r << 16) | (g << 8) | (b << 0)); + } + } + + BufferedImage _return = new BufferedImage(width, height, BufferedImage.TRANSLUCENT); + _return.getGraphics().drawImage(img, 0 - (img.getWidth() / 8), 0 - (img.getHeight() / 8), null); + return _return; + + } + + private static double log(double b, double x) { + return Math.log(x) / Math.log(b); + } +} diff --git a/src/MAndApps/LogItem.java b/src/MAndApps/LogItem.java new file mode 100644 index 0000000..464c8fd --- /dev/null +++ b/src/MAndApps/LogItem.java @@ -0,0 +1,38 @@ +package MAndApps; + +import java.awt.Graphics; + +public class LogItem { + private int life, LIFE; + private boolean alive; + private String log; + public LogItem(String s, int life){ + log = s; + alive = true; + LIFE = life; + this.life = 0; + // each instance of the word life, + //is one of three different variable :P + //confused? + //this.life is the current life counter + //LIFE is the max counter before it dies + //life is the number passed in to set as + //the LIFE or max life + //confused now? + } + + public void tick(){ + life++; + if(life >= LIFE){ + alive = false; + } + } + + public void render(Graphics g, int x, int y){ + if (alive)g.drawString(log, x, y); + } + + public boolean getAlive() { + return alive; + } +} diff --git a/src/MAndApps/Pointer.java b/src/MAndApps/Pointer.java new file mode 100644 index 0000000..cf59058 --- /dev/null +++ b/src/MAndApps/Pointer.java @@ -0,0 +1,12 @@ +package MAndApps; + +public class Pointer { + private volatile E object; + public Pointer(E e){ + object = e; + } + + public E getObject(){ + return object; + } +} \ No newline at end of file diff --git a/src/MAndApps/Variable.java b/src/MAndApps/Variable.java new file mode 100644 index 0000000..f9d51b4 --- /dev/null +++ b/src/MAndApps/Variable.java @@ -0,0 +1,186 @@ +package MAndApps; + + +import java.io.File; +import java.io.IOException; +import java.util.Formatter; +import java.util.Scanner; + +/** + * to note, will not work on Mac yet. + * + * edit: WILL WORK ON MAC MOTHER FUCKERS + * + * edit: idek if this will work on macs because app data... + * + * @author Marcus + * + */ +public class Variable { + private String value; + private String filePath; + private String fileDir; + private static String fileExtension; + private static String BASE_DIR = "" + System.getenv("APPDATA") + "\\"; + + static { + // first the default value is set. this is used + // only to get the real value. + fileExtension = "var"; + // make a new variable, for the extension + // do not force it to be var. + Variable var = new Variable("MAndLib\\core", "extension", "var", false); + // grab its value and reset the extension. + fileExtension = var.getValue(); + } + + /** + * dir - where the variable file is stored. - enter things like "hjkl\\asdf" + * + * name - simple, name of variable file + * + * value - value to try and set the file to. though if it already has a + * value, it won't do anything + * + * force - if true, value will always be set to the value given, regardless + * of if the value is already there. + * + * @param dir + * @param name + * @param value + * @param force + */ + + public Variable(String dir, String name, String value, boolean force) { + + + fileDir = BASE_DIR + dir; + filePath = BASE_DIR + dir + "\\" + name + "." + fileExtension; + // try and load value from file, if null, screw it. + + + String str = getValueFromFile(); + + // if we could not load a value from the file + // AKA didnt fucking exist. + // ORRRRRRR if you were an ass, and forced + // the value. + if (str == null) { + this.value = value; + saveValue(); + } else if (force) { + this.value = value; + saveValue(); + // else we can load the value from the file + } else { + this.value = str; + } + } + + /** + * return the class variable for the value. + * shouldn't have to load it again because we + * always change the value locally first before we save. + * @return + */ + public String getValue() { + return value; + } + + /** + * set the value in the local class, then open a thread for saving it + * + * @param value + */ + public void setValue(String value) { + this.value = value; + new Thread(new Runnable() { + public void run() { + saveValue(); + } + }).start(); + } + + /** + * deletes and recreates the file with the new value + */ + private void saveValue() { + deleteFile(); + createFile(); + try { + // Q&D formatter to write value to current filepath. + Formatter f = new Formatter(filePath); + f.format("" + value); + f.close(); + } catch (Exception e) { + // if(weArriveHere){ + // we.are("fucked"); + // } + e.printStackTrace(); + } + } + + /** + * for refreshing the file + */ + private void deleteFile() { + File f = new File(filePath); + f.delete(); + } + + /** + * creates empty file at the correct path. + */ + private void createFile() { + //make the directory because god knows, java can't do that for us + //when we say we want a new file in an unknown folder noooooo.... + //jackass java + File f = new File(fileDir); + f.mkdirs(); + + //no onto the file itself. create the object + f = new File(filePath); + try { + //hopefully make the file... + f.createNewFile(); + } catch (IOException e) { + // if(weArriveHere){ + // we.are("fucked"); + // } + e.printStackTrace(); + } + } + + /** + * grab the value from the file, if nothing is there, null. + * + * @return + */ + private String getValueFromFile() { + try { + //create the file... we don't want to do anyth stupid checking because if its + //not perfect, we honestly don't care, just return null and reset the variable + File f = new File(filePath); + + //open a scanner on the file + Scanner s = new Scanner(f); + + //get the assumed value + String str = s.nextLine(); + + //close the file because for some reason if you don't + //you end up dividing by zero... + s.close(); + + //gimme dat string + return str; + } catch (Exception e) { + //dunno, don't care, reset. + return null; + } + } + + public static void setBaseDir(String dir) { + BASE_DIR = dir; + } +} diff --git a/src/MAndApps/VariableNotFoundException.java b/src/MAndApps/VariableNotFoundException.java new file mode 100644 index 0000000..80a59cb --- /dev/null +++ b/src/MAndApps/VariableNotFoundException.java @@ -0,0 +1,10 @@ +package MAndApps; + + + +public class VariableNotFoundException extends Exception { + @Override + public String getMessage() { + return "Variable not found"; + } +}