Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


munching squares

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Binaries
View previous topic :: View next topic  
Author Message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5804

PostPosted: Sat Feb 20, 2010 3:48 am    Post subject: munching squares Reply with quote

fun with effects
http://www.mediafire.com/?qdqknmnfndq

edit: and a newer one, now with color.
http://www.mediafire.com/?kdyi45jixvz



idea stolen from
http://www.nihilogic.dk/labs/pocket_full_of_canvas/#presets/munchingsquares.js


surprisingly simple actually, looks great imo.
http://mathworld.wolfram.com/MunchingSquares.html


Code:
for n
   for y
      for x
         if((x ^ y) < n)
            color = whatever
         else
            color = whatever
         drawpixel
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5804

PostPosted: Wed Feb 24, 2010 10:53 pm    Post subject: Reply with quote

here is this abortion of code if anyone is interested in case someone wants to use it for whatever.

try not to shit yourself.

Code:
#define DIB_RGB(r,g,b)((COLORREF)(((BYTE)(b)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(r))<<16)))

#include <Windows.h>

int __cdecl main         (void);
int __cdecl mainCRTStartup   (void)   { return main(); }

int __cdecl main(void)
{
   //////////////////////////////////////////////////////////////////////////
   HDC         hdc,
            hdcMem;
   HBITMAP      dib,
            hbmOld;
   BITMAPINFO   bi;
   DWORD*      bits;
   //////////////////////////////////////////////////////////////////////////
   int SCREEN_HEIGHT   = 512;
   int SCREEN_WIDTH   = 512;
   int W_SIZE         = (512 - 1);
   int SCRBUF_SIZE      = (SCREEN_WIDTH * SCREEN_HEIGHT) * 4;
   //////////////////////////////////////////////////////////////////////////
   memset(&bi, 0, sizeof(bi));
   bi.bmiHeader.biSize     = sizeof(BITMAPINFO);
   bi.bmiHeader.biWidth    = SCREEN_WIDTH;
   bi.bmiHeader.biHeight   = -SCREEN_HEIGHT; //top down
   bi.bmiHeader.biPlanes   = 1;
   bi.bmiHeader.biBitCount = 32;

   hdc      = GetDC(NULL);
   hdcMem   = CreateCompatibleDC(hdc);
   dib      = CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
   hbmOld   = (HBITMAP)SelectObject(hdcMem, dib);

   while(!GetAsyncKeyState(VK_ESCAPE))
   {   
      COLORREF c;
      int x, y, n;

      for(n = 0; n < W_SIZE; n++) //number of "munches"
      {
         for(y = 0; y < W_SIZE; y++)
         {
            for(x = 0; x < W_SIZE; x++)
            {
               DWORD* dst = bits + (y * SCREEN_WIDTH + x);
                                       //play with the comparison for fun results
               if((x ^ y) < n)               //the divide is for 512, meh
                  c = DIB_RGB((n / 2) ^ 255, (y / 2) ^ 255, (x / 2) ^ 255);   //xor to 'reverse' the values 0 ^ 255 = 255... so
               else                     //start at bright colors rather than 0 / black
                  c = 0x00000000;            //x, y, and n all increase at different intervals
               *dst = c;                  //handy for a nice gradient effect
            }                           //be sure to keep colors in 255 range... might have to divide
         }

         BitBlt(hdc, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, hdcMem, 0, 0, SRCCOPY);
         memset(bits, 0, SCRBUF_SIZE);
         Sleep(20);   //1000 / x = fps, 50 is smooth and light on cpu
      }            //performance is almost directly proportional to number of pixels
   }               //keep resolution low if speed is an issue

   SelectObject(hdcMem, hbmOld);
   DeleteObject(dib);
   ReleaseDC(NULL, hdc);   
   DeleteDC(hdcMem);
   return 0;
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming -> Binaries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites