Welcome, Guest. Please login or register. Did you miss your activation email?

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.

Topics - Mills

Pages: [1]
C / Compile CSFML for Linux and windows 98
« on: February 25, 2020, 11:52:19 pm »
I tried to compile CSFML in Linux and I had no luck. Also the last compiled csfml for linux was outdated and did not work (there are a lot of posts about this, so I'll just forget about it).

Is it possible to compile a csfml program for Linux (libs and executable) from a windows system using gcc?.

I also read sfml is compatible with all windows versions, (including windows 95-98). So I wanted to test if the program is optimized and it works on slow old systems with opengl 1.1.

I tried windows 98 inside an emulator called Pcem, and windows complains about dll's being too modern. So I want to know if I could also compile the exe and dll's for old systems using gcc.

My current computer is running windows 10 x64, and I'm using the 32 bit version of csfml.


Audio / Disable audio filters
« on: February 05, 2020, 05:47:39 pm »
I didn't  find anything related to this in the forums.

I am programming some kind of "fantasy computer"in CSFML just for fun, similar to pico-8 (and things like that).

I nearly got it working, and it uses tiny wave samples with very low quality (1000Hz). I want the sound to be even more "retro" disabling the filters.

Is it possible to disable the fefault filters used by openal wave player?


Graphics / CSFML: access image / texture pixels
« on: January 21, 2020, 07:48:03 pm »
Is there any way to access the pixels of images and textures in CSFML without using setPixel, getPixel or sfImage_getPixelsPtr ?

Can I access the sfImage struct to get the pixels in CSFML or do I have to use the C++ SFML?

I'm asking this because sfImage_copyImage is not working the way I wanted.

For example I want to copy a "tile" (8x8 pixels) from a big image to a smaller one.

The following code should take the first 8x8 tile, (from 0,0 to 8,8 of the big image) and paste it to the top part of the small image.

Code: [Select]
sfImage_copyImage(Small_Image,Big_Image, 0, 0, (const sfIntRect){0, 0, 8, 8}, 0);

In my case, this just pastes the big image on top of the small one, ignoring the pixels that don't fit on the small image like a photoshop paste  :'(.

Maybe I'm using the sfImage_copyImage the wrong way?


EDIT: I really don't know why... But it worked inside a loop
Code: [Select]
int x = 0;int y = 0;int i = 0;
for (y = 0; y < 128; y+= 8){
for (x = 0; x < 128; x+= 8){
sfImage_copyImage(Tileset,New_Tileset, 0, i, (const sfIntRect){x, y, 8, 8}, 0);
i+= 8;

It loads all tiles correctly from a 128x128 image.

(I'm sorry I should have posted this in the graphics section).

General / wait for vsync custom function
« on: January 19, 2020, 02:05:09 pm »

I'm using CSFML, and I created a c code in the main thread, which draws a sprite to a window and uses sfRenderWindow_setFramerateLimit(60).
The sprite x and y positions are taken from two global variables (SPR_X and SPR_Y).

Don't ask why I'm doing the following :P... but I created a thread which only modifies the sprite position by changing SPR_X and SPR_Y variables. The problem is, how do I sync the thread to the vsync of the main one, so that the sprite moves at 60 fps?

I used usleep(1000000/60) and it works, but you surely know what happens next... Sometimes the positions are changed in the middle of a frame, and you can see screen tearing.

Then I tried using sfRenderWindow_display() again inside the thread function. But that resulted in a black screen. So I think I must use a custom sfRenderWindow_display():

Code: [Select]
void custom_windowdisplay()
    // Display the backbuffer on screen
    //if (setActive()) m_context->display(); don't do this again!!

    // Limit the framerate if needed
    if (m_frameTimeLimit != Time::Zero)
        sleep(m_frameTimeLimit - m_clock.getElapsedTime());
        //m_clock.restart(); //don't restart the clock again!!

I can convert that to CSFML, But I need to get the same clock used internally for the original sfRenderWindow_display(), and also get the m_frameTimeLimit value.

How do I get the clock and the m_frameTimeLimit?.

Is there any other way to do it? I read about "mutex", but that was way complex for me to understand, and I did not make it work.


Pages: [1]