Jump to content

madflame991

Active Members
  • Posts

    97
  • Joined

  • Last visited

About madflame991

  • Birthday 02/22/1990

Profile Information

  • Location
    Bucharest

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

madflame991's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. I can't use GuiCtrlSetStyle AND GuiCtrlSetBkColor for the same button. One will cancel the others effect. Any suggestions? I'm assuming it's a strange bug, I did a search and found this article, but with 0 replies and I reposted here because it was in the wrong forum... Oh, and if it's one of those unfixable bugs, is there any workaround? GUICreate('GUI',120,50) GUICtrlCreateButton('Button',10,10,100,30) GUICtrlSetBkColor(-1,0x004653) GUICtrlSetStyle(-1,0x2100) GUISetState() While 1 Sleep(1000) WEnd
  2. Hi! I'm back! Here's what I've been cooking in the last month This is the official description: "Coin is a freeware assembly-like scripting language designed for educational purposes. The main feature of Coin is its configurable interpreter which acts more like an emulator. With the help of the interpreter the user can specify how many clock cycles does it take for every instruction to be executed. The user can also specify how many registers and how much memory is available and how large the stack is. This level of customization is ideal for algorithmic problems. The challenge the programmer is faced is to conceive an efficient algorithm for a specific strange machine (e.g. one without arithmetic instructions, one with only 4 registers)." Just take a moment and think of the possibilities. I know there are some assembly enthusiasts here (btw, thx trancexx for that asm request from last summer) "Provide an efficient algorithm for problem X when running on: + machines which lack basic operations (e.g. inc, dec, add, sub) + machines which have no more than 2 registers, no RAM and a stack" Some language specifications: + registers are autoinitilialised by the interpreter (borrowed this idea from dear AutoIt) + there are no gotos or labels! I think this is the only assembly like language without gotos; obviously gotos are replaced by if/while statements + there are plenty of useful instructions like: min, max, fread (FileRead with 3 parameters reads n values from the input file and stores them in memory beginning with the desired address), swapr (SwapRegister does something like $tmp = $a, $a = $b, $b = $tmp), mcopy (MemoryCopy... you know), rand + both =,<> and ==,!= are supported + do leave blank spaces between values and relations (e.g. if a < b ); if a=b is a big nono You will find a complete documentation in the archives Sourcecode and binaries are released on Sourceforge http://sourceforge.net/projects/commandinterpre/ Compile the interpreter first... Suggestions, bug reports, problem proposals, any kind of feedback are welcomed
  3. I agree. It would eventually slow down the arithmetic evaluator.
  4. Try this: MsgBox(0,'',-27^(1/3)) It should return -3...
  5. 1. Even if I would translate the values inside the arrays... how would I get the value of a specific $map[$x][$y]? I did not see any examples of that 2. It would be easier/more useful for me to learn how to write 2 loops and a dll call than to use C (I never actually programmed under C before) It took me so much to reply because I tried to optimize it another way (I'm in the process of learning GDI+ as well) The loops were for refreshing a map (from a game I'm making); I think this should be useful for others who want to redraw a tile-based map so I'll post what I've managed to do, rename the topic and ask for help again Cheers!
  6. Research What I'm trying to achieve: Refresh a tile-based map fast. I'm in the process of making a game, one that has it's environment composed out of tiles, like Zelda or any SNES game like it. When the player reaches the edges of the screen the next screen appears and he is cast on the opposite margin - logic, right? The Problem is that refreshing a 12x22 tiles takes some time and the process should be as fast as possible. That's why I've researched a bit into GDI+ (no, I don't want to use prospeed, sdl, or any other external thingie since it takes some time to learn them and I don't want to rewrite the whole thing again) First example: Straight forward but a bit slow since it reads all the tiles from the hard drive $win = GUICreate('',100,100) $pic = GUICtrlCreatePic('1.bmp',30,30,48,48) GUISetState() $t = TimerInit() For $i = 1 To 3000 GUICtrlSetImage($pic,Mod($i,4)&'.bmp') Next MsgBox(0,'',TimerDiff($t)) Second example: Faster, is the anything else even faster? #include <GUIConstantsEx.au3> #include <GDIPlus.au3> #include <WinAPI.au3> Dim $hImage[4], $hbmp[4], $aBmp $hGui = GUICreate('',100,100) $Pic = GUICtrlCreatePic('',20,20,48,48) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW, $hGui) _GDIPlus_Startup() $hWnd = GUICtrlGetHandle($pic) For $i = 0 To 3 $hImage[$i] = _GDIPlus_BitmapCreateFromFile($i&'.bmp') $hbmp[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage[$i]) Next $dll = DllOpen("user32.dll") $t = TimerInit() For $i = 1 To 3000 $aBmp = DllCall($dll, "hwnd", "SendMessage", "hwnd", $hWnd, "int", 0x0172, "int", 0, "int", $hbmp[Mod($i,4)]) If $aBmp[0] <> 0 Then _WinAPI_DeleteObject($aBmp[0]) Next MsgBox(0,'',TimerDiff($t)) DllClose($dll) For $i = 0 To 3 _GDIPlus_ImageDispose($hImage[$i]) _WinAPI_DeleteObject($hbmp[$i]) Next _GDIPlus_Shutdown() Third attempt: #include <GuiConstantsEx.au3> #include <GDIPlus.au3> Dim $hGUI, $hWnd, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout $hGUI = GUICreate("GDI+", 400, 300) $hWnd = WinGetHandle("GDI+") WinSetTrans($hgui, "", 255) ;two times faster without this GUISetState() _GDIPlus_Startup () Dim $hImage[2] $hImage[0] = _GDIPlus_BitmapCreateFromFile('0.bmp') $hImage[1] = _GDIPlus_BitmapCreateFromFile('1.bmp') $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hWnd) $t = TimerInit() GUISetState(@SW_DISABLE,$hgui) For $i = 1 To 3000 _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage[Mod($i,2)], 0, 0, 48, 48) Next GUISetState(@SW_ENABLE,$hgui) MsgBox(0,'',TimerDiff($t)) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown()Images are HERE - their names shoud be: 0.bmp; 1.bmp; 2.bmp; 3.bmp And now I'm asking you: What should be the fastest way to do this? Initial request: I read from the Example Scripts forum (trancexx's topics) how much magic you can do with some assembly in tight loops. I even understood part of the code, but not enough to make something actually work and that's why I'm asking for help. I need this bit of code to be transformed into asm and, if you can, please insert some explanations. I have the SwapEndian function; you don't have to add it. For $i = 1 To $tabdim[0] For $j = 1 To $tabdim[1] DllCall($dll, "hwnd", "SendMessage", "hwnd", $hWnd[$i][$j], "int", 0x0172, "int", 0, "int", $hbmp[$map[$i][$j]-1000]) Next Nextthx! EDIT: 10 < $tabdim[0],$tabdim[1] < 40 ... so it only occupies one byte (dunno if that's important)
  7. Hi, I really really like what you've done here - it's easier to use than prospeed >_< I'd like to ask you 2 questions: 1. What is the difference between: $SpriteTexture1 = _A2DCreateTexture("texture1.dds") $SpriteTexture2 = _A2DCreateTexture("texture2.dds") $Sprite1 = _A2DCreateSprite() $Sprite2 = _A2DCreateSprite() _A2DSpriteBegin($Sprite1) _A2DDrawSprite($Sprite1, 300, 400, $SpriteTexture1, 0xFFFFFFFF, $Rotation, 60, 50, 300, 98) _A2DSpriteEnd($Sprite1) _A2DSpriteBegin($Sprite2) _A2DDrawSprite($Sprite2, 300, 400, $SpriteTexture2, 0xFFFFFFFF, $Rotation, 60, 50, 300, 98) _A2DSpriteEnd($Sprite2) and $SpriteTexture1 = _A2DCreateTexture("texture1.dds") $SpriteTexture2 = _A2DCreateTexture("texture2.dds") $Sprite = _A2DCreateSprite() _A2DSpriteBegin($Sprite) _A2DDrawSprite($Sprite, 300, 400, $SpriteTexture1, 0xFFFFFFFF, $Rotation, 60, 50, 300, 98) _A2DDrawSprite($Sprite, 300, 400, $SpriteTexture2, 0xFFFFFFFF, $Rotation, 60, 50, 300, 98) _A2DSpriteEnd($Sprite) I saw that you can create only one sprite and draw whatever texture you need with it but this doesn't seem right to me... 2. I can build and distribute free games with this library... right??? EDIT: 3. I initialized a fullscreen dx device and switched to another app using alt-tab. How do I resurrect the fullscreen-device-window? It won't work by simply maximizing the window... Cheers!
  8. It's from Startrek... It was the vulcans motto. I think it was first said by Spock in the first series ever produced. Regarding your SDL library... YOU DID A GREAT JOB! I have been waiting for this since I joined the forums back in 2006 and saw on the first page of Autoit's website "Feaures: bla bla bla... you can make games calling the SDL library... bla bla bla". I think they erased that part when, in jan 2008, I actually asked for an example here Keep up the good work! I'll most likely want someday to make a game. Thx!
  9. found the rest of the values (I think they should be included in WindowsConstants.au3 or somewhere) AW_HIDE := 0x10000 AW_ACTIVATE := 0x20000 AW_CENTER := 0x10 AW_BLEND := 0x80000 AW_SLIDE := 0x40000 AW_HOR_POSITIVE := 0x1 AW_HOR_NEGATIVE := 0x2 AW_VER_POSITIVE := 0x4 AW_VER_NEGATIVE := 0x8 EDIT: ...how do I fade out a window? I didn't find a constant for that
  10. I knew this had to be in some dll... Thx a lot
  11. " The ByRef keyword is optional and means: (1) the parameter must a variable " - from the byref keyword in the help file That doesn't sound right and I think "...and it means" would be more appropiate (dunno for sure cause I'm not a native speaker) Where do I post typos? I'm sure I saw many more, and I'll probably find them again... I don't want to report them as bugs cause they're not... (Evidently I searched "where to post typos" and "byref typo" before posting)
  12. I like your attitude! Next time be smart... It's "You are here" or "You're here" not "Your here"...
  13. U rule! It's just what I've been asking for. Thx alot!
  14. ok... I added some sourcecode in the first post, it kinda reflects what I'm trying to achieve. Where should I use GUICtrlCreateDummy? (I feel noobish) oh... I'm not using this because of a game, I just can't draw using the mouse and I figured there are many like me, and why not create a script for the incapacitated...
  15. I wanna make a semitransparent layered on top window that will basically be an image. This is useful for anyone to draw in paint & co from a reference picture. I just want the gui to ignore the mouse clicks, or pass them behind it. thx
×
×
  • Create New...