MCode Tutorial (Compiled Code in AHK)
Re: MCode Tutorial (Compiled Code in AHK)
Maybe you should also advert to the possibility of using C.
"Nothing is quieter than a loaded gun." - Heinrich Heine
Re: MCode Tutorial (Compiled Code in AHK)
Yes, right.
"Nothing is quieter than a loaded gun." - Heinrich Heine
Re: MCode Tutorial (Compiled Code in AHK)
This is a great tutorial. Thanks Nnnik.
I wonder how many people in the AHK community have moderate to deep assembly knowledge. There is yet a lot to be achieved with it. Comercial security and a true compiler are long awaited news.
My knowledge may be on the moderate level, though i've mostly studied concepts and debugged code. Not that much coding done by myself atm.
I wonder how many people in the AHK community have moderate to deep assembly knowledge. There is yet a lot to be achieved with it. Comercial security and a true compiler are long awaited news.
My knowledge may be on the moderate level, though i've mostly studied concepts and debugged code. Not that much coding done by myself atm.
"What is suitable automation? Whatever saves your day for the greater matters."
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Archmage Gray - A fantasy shooter game fully coded in AutoHotkey
Barcoder - Create QR Codes and other Barcodes using only Autohotkey !!
Archmage Gray - A fantasy shooter game fully coded in AutoHotkey
Re: MCode Tutorial (Compiled Code in AHK)
Thanks for this great Tutorial and translating it into german and posting it twice also!
"Nothing is quieter than a loaded gun." - Heinrich Heine
Re: MCode Tutorial (Compiled Code in AHK)
Thanks back.
But there is still a part that's missing.
Bentschi said he also had some problems with something similar.
But there is still a part that's missing.
Bentschi said he also had some problems with something similar.
Recommends AHK Studio
Re: MCode Tutorial (Compiled Code in AHK)
Finally found out what the problem was.
Now I'm working on some additional stuff again.
Now I'm working on some additional stuff again.
Recommends AHK Studio
Re: MCode Tutorial (Compiled Code in AHK)
Also feel free to share any MCode function you've created here.
I might need some good examples for further chapters.
Recommends AHK Studio
Re: MCode Tutorial (Compiled Code in AHK)
How about perlin noise?
Good example:
GLuint tex = renderCloud(512, 512, 75, 0.5);
This is the best perlin noise function i've found on the net.
Maybe you want to change the code into GDI/GDI+
Also try to change the octaves variable to 3 (makes a nice effect)
Code: Select all
double findnoise2(double x, double y)
{
int n = (int)x+(int)y*57;
n = (n<<13)^n;
int nn = (n*(n*n*60493+19990303)+1376312589)&0x7fffffff;
return 1.0-((double)nn/1073741824.0);
}
double interpolate(double a, double b, double x)
{
double ft = x * 3.1415927;
double f = (1.0-cos(ft))* 0.5;
return a*(1.0-f)+b*f;
}
double noise(double x, double y)
{
double floorx = (double)((int)x);
double floory = (double)((int)y);
double s,t,u,v;
s = findnoise2(floorx, floory);
t = findnoise2(floorx+1, floory);
u = findnoise2(floorx, floory+1);
v = findnoise2(floorx+1, floory+1);
double int1 = interpolate(s, t, x-floorx);
double int2 = interpolate(u, v, x-floorx);
return interpolate(int1, int2, y-floory);
}
GLuint renderCloud(int w, int h, double zoom, double p)
{
int octaves = 2;
GLuint tex = 0;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
unsigned char *pixels = (unsigned char *)malloc(w*h*sizeof(unsigned char));
for(int y=0; y<h; y++)
{
for(int x=0; x<w; x++)
{
double getnoise = 0;
for(int a=0; a<octaves-1; a++)
{
double frequency = pow(2, a);
double amplitude = pow(p, a);
getnoise += noise(((double)x)*frequency/zoom, ((double)y)/zoom*frequency)*amplitude;
}
int color = (int)((getnoise*128.0)+128.0);
if(color>255)
color = 255;
if(color<0)
color = 0;
pixels[(h*y)+x] = color;
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
return tex;
}
GLuint tex = renderCloud(512, 512, 75, 0.5);
This is the best perlin noise function i've found on the net.
Maybe you want to change the code into GDI/GDI+
Also try to change the octaves variable to 3 (makes a nice effect)
Re: MCode Tutorial (Compiled Code in AHK)
Thanks that's exactly what I'm searching for.
But float/double to int conversion wont work unless you add the /Qifist option with the compiler.
I already suggested to use it.
But float/double to int conversion wont work unless you add the /Qifist option with the compiler.
I already suggested to use it.
Recommends AHK Studio
Re: MCode Tutorial (Compiled Code in AHK)
I'll PM you a new version of the generator...
Re: MCode Tutorial (Compiled Code in AHK)
I've done some tests on the newer version on the generator, and QIfist works fine.
QIfist is now also in the older version until the new version comes.
QIfist is now also in the older version until the new version comes.
Re: MCode Tutorial (Compiled Code in AHK)
First off, a great example of using machine code to extend AHK's functionality is this long-integer library http://www.autohotkey.com/board/topic/1 ... c-library/
Second off, why not actually call it what it is: machine code? You say MCode *everywhere*, but never actually explain it stands for machine code.
Second off, why not actually call it what it is: machine code? You say MCode *everywhere*, but never actually explain it stands for machine code.
Re: MCode Tutorial (Compiled Code in AHK)
maybe could host the generator also??? because i still dont get how to do it with GCC
also, you wrote "beispiele", nicht alle leute hier sprechen deutsch
also, you wrote "beispiele", nicht alle leute hier sprechen deutsch
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Re: MCode Tutorial (Compiled Code in AHK)
Well I didn't manage to make Visual C++ compile 64 bit code.
But I can make the GCC thing once im finished with my finals next week.
But I can make the GCC thing once im finished with my finals next week.
Recommends AHK Studio
Re: MCode Tutorial (Compiled Code in AHK)
For reference : Information on converting C functions to machine code using Microsoft's free Visual C++ Express compilers
http://www.autohotkey.com/board/topic/1 ... ntry161667
http://www.autohotkey.com/board/topic/1 ... ntry161667
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Re: MCode Tutorial (Compiled Code in AHK)
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Who is online
Users browsing this forum: No registered users and 40 guests