• Welcome to Dark Bit Factory & Gravity.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - SilentWorld

#1
Updated the code with some variations and improvements. I have also included a new version which does bi-directional distortion using two buffers. It's still not perfect, but I'm trying to make a good base to start a project from. The original gameloop is by EternalWindows. I have noticed that the bi-directional version causes CPU usage to increase. Also, it could just be my eyes, but does the animation look smooth enough? It would be great if someone could look at it and let me know what I can do to make it better / cleaner. I hope to create a DIB version once I get this one polished.
#2
Quote from: va!n on July 28, 2021What about using WAV buffers and some code like the player of a very basic sofware synth (mixing multiply samples) - and using waveOutOpen() API for output?

Thanks for the suggestion. I looked into it, but there aren't many examples I could find, and my usage here is in a very simple context. It looks to be easier for me to extract the WAV files from the exe as temp data and use MCISendString to play them. Ideally all the data should be loaded from the executable.
#3
As the title says, is there any way at all to do this using the default Win32 API? I know that PlaySound is ancient and can't do sound mixing. I am currently using it just to play looping background music which works perfectly. I have read a little about DirectSound, but that has been deprecated for a long time and is even lower level than PlaySound. Basically, I need something lightweight that can be statically linked to play WAVs. I have read in a couple of places that using MCISendString allows multiple sounds to be played, but the code is always in VB.

Link: https://social.msdn.microsoft.com/Forums/en-US/6082e245-d38e-4ba0-a6ff-445186d7ca74/play-parallel-sounds?forum=vblanguage

#4
So I finally got it working using GDI, without resorting to DIBs (which are very frustrating btw) :)
This code can distort the image vertically or horizontally. Not sure how to do bi-directional distortion with this yet, but I'll figure it out eventually.
Apologies for the messy code, it's just for testing. Improvements are welcome!
#5
No problem :)

I haven't used DIB at all before so I will need to reference either Petzold or Feng Yuan's book. Correct me if I'm wrong, but the main advantage of using them is that one has direct access to pixels in a DC? In the Freebasic code, this appears to be taken care of. My initial idea, was to load a normal bitmap and make it into a "tilesheet" in memory and iterate over each image in it. This would no doubt be too slow, even if the effect is only going to be used once.
#6
Quote from: va!n on October 25, 2020
Could you add an compiled version (exe) please? ;)

Sure! I've attached all the executables for each variation, along with their source code. Again this would not have been possible without help, but  I have learned a few things. Of course, the real challenge will be to make this work in pure GDI. Feel free to suggest improvements to this code :)
#7
Hi guys. Thanks for your suggestions! I have been working on some variations of the effect using some FreeBasic source and a with a little help. The math is a clearer to me now too :)  Here is the code loosely modified from the original written by Dr_Davenstein. I might be wrong, but the win32 equivalents of PSET, PUT and GET would be SrcCopy, BitBlt, and SelectObject. Sorry for the late reply, I was getting a 403 error for a long time which prevented me.


#Include "fbgfx.bi"
Screenres 340,120,32,,

Dim As Integer x, y
Dim As Ubyte Ptr buf  = imagecreate(239,44)
Dim As Ubyte Ptr buf2  = imagecreate(239,44)
Bload "blogo.bmp", buf
Color &HFFFFFF, &HFF00FF
Dim As double Ang
Dim As double Ang_x
Dim As double Amplitude
Dim As Integer period
Dim As double frequency
Dim As double delta

Amplitude = 5.0
period = 60
frequency = 1.0
delta = 0.01

Do
    screensync
    ScreenLock
    cls
   
    Ang+= 6.282 * frequency * delta
    Ang_x = Ang
   
    For x = 0 To 238
        Ang_x+=(6.282/period)
        Get buf, (x,0)-(x,43), buf2
         
        Put(x+10,(Amplitude*sin(Ang_x))+30), Buf2, pset
    Next                           
   
    ScreenUnlock
    sleep delta * 1000
   
Loop Until Multikey(FB.SC_ESCAPE)

imageDestroy(buf)
imageDestroy(buf2)
#8
The wobble effect is one of my all-time favourites. It is simple but always nice and hypnotic to look at. I am using C and plain GDI for my projects and want to learn how to apply this effect to a bitmap. From my basic understanding, each column or row of pixels moves using sine modulation. I've heard that this probably isn't the best way to do it, but I'm admittedly terrible at math. My programming ability is that of a beginner, however I've been hacking around with the GDI and managed to learn a thing or two. Any help is appreciated!
#9
Hi all. I've finally decided to join up here! I've been interested in demos/ intros for a long time and even dabbled in Windows programming a little. I love all the oldschool stuff for the Amiga, Atari ST and MS DOS. While my skills are rudimentary at best, I certainly hope I will be able to learn a lot more as time goes on, and eventually share something worthwhile.