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.


Messages - Saud

Pages: [1]
1
Thanx for replying.
Yeh ive tested Arabic characters on laptop keyboard and it works fine, and i even built my own mini keyboard in my mini game using sfml sprites and it worked.

but the problem here is with the virtual keyboard that pops up in mobile phone when you need to write something, sf::Event::Textentered doesnt seem to spot some characters pressed in the virtual keyboard, its like they are never pressed.

The erase to left button in mobile phone does what backspace button do in the pc keyboard but with a different unicode id. this link shows info on erase to lift button.
https://www.fileformat.info/info/unicode/char/232b/index.htm

Note: i use sf::Keyboard::setVirtualKeyboardVisible(true) to let the mobile keyboard pops up in Android mobile phone.

2
General / need help with virtual keyboard and the erase to left character
« on: December 14, 2019, 10:09:53 pm »
Hello,
Ive been searching lately for a solution, i havnt found yet, for a problem using Textentered event and android virtual keyboard.

The std::string doesnt seem to recieve over 128 unicode characters, specially arabic letters and the erase to the lift button (U+232B).

I tried using wstring and fonts that support these characters, i even tried using sf::String and convert it to wide string, but the problem persist.

Here is my code, last edited, showing only whats related to my issue:


// after enabling the virtual keyboard

wstring str0;
sf::Text txt0;

if (event.type == sf::Event::TextEntered)
{
                               
        if (str0.size()<=15) str0+=event.text.unicode;
        if (event.text.unicode==L'\n')
        {
                str0.erase(str0.size()-1, 1);
                                       
                                       
                                       
        }
        if (event.text.unicode==L'\u232B')
        {
                                       
                str0.erase(str0.size()-2, 2);
                                       
                                       
        }
                               
        txt0.setString(str0);
                               
                               
}


 

this code works with English letters and the enter button in the virtual keyboard, but it doesnt work with arabic nor the erase to the left character.

Note: im testing this only on Android, using a HUAWEI device with Android 8 OS.

3
General / Re: Image not showing in apk
« on: December 05, 2018, 03:32:04 pm »
How are you loading the image, i.e. can you show some code?

This issue haunted me for days, i almost tried everything possible to try to solve this problem,
except one thing i havent tried, which is change the APK name every time i export it to mobile.

what i used to do is, every time i want to export a new APK, i delete the one exported before with uninstalling its app, and then export it again to the device with the same name.
and that was the problem and changing APK name was the solution.
its like if you want to add a new image to your app, APK name should be different than the previous name.

Thanks for your reply, and sorry for the false alarm.

4
General / Image not showing in apk
« on: December 05, 2018, 12:29:56 am »
Hi,

I have downloaded a background from the web, its a royalty free .jpg image.

I used it in my project and it worked fine in SDL plugin run test,
but when i make an APK file and install the APK on my phone this particular image does not show.

can you tell me what might be the problem?
is it an SFML issue or maybe the image itself or the APK does not show certain images?

note:
i tried many royalty free background images, the same problem persist.
i tried converting them to many formats like png, jpg, psd and bmp, the same problem persist.
i use a resources folder and attach it to the APK so the games directory would be that folder.
other images work fine using the same code as the one with the issue.

5
Graphics / Re: getDesktopMode().width&height gets wrong tablet screen size
« on: November 25, 2018, 01:27:21 pm »
Pixel coordinates and scene coordinates are two different things. Use RenderWindow::mapPixelToCoords and mapCoordsToPixel to convert from one to another.

Thank you,
I used
window.mapPixelToCoords(sf::Touch::getPosition(0, window))
and it worked, thnx again  :)

6
Graphics / Re: getDesktopMode().width&height gets wrong tablet screen size
« on: November 24, 2018, 02:23:31 pm »
Hey.
Do you pass your window as a second argument to sf::Touch::getPosition?


I make the renderwindow in main and then pass it to game levels functions as the only parameter,
then in the function, in while (window is open) loop, first thing there is to store sf::Touch::getPosition().x&y in local variables, then use these variables in sprite.getGlobalBounds().contains() .

edit:
and yep i use the renderwindow as a second argument in sf::Touch::getPosition

7
Graphics / getDesktopMode().width&height gets wrong tablet screen size
« on: November 23, 2018, 09:56:51 pm »
Hello,

I'm making a mini game for learning purposes, and recently i started testing the game on my Huawei android tablet with 1920, 1200 resolution.

when i use sf::VideoMode::getDesktopMode().height it returns 1133height and 1920width but the tablets height resolution is 1200.

The big issue is when i keep using 1133 as height of my sf::RenderWindow the sprites getGlobalBounds get messed up, its like when i touch point(200, 200) the tablet reads it as point(200, 266).

Is it possible to read exact screen resolution? or to change how the app read touch position?


note:
when putting the tablet to portrait mode, sf::VideoMode::getDesktopMode().height will be 1920-66 and width 1200.

8
General / Re: how to load image files by order
« on: November 10, 2018, 04:37:19 pm »
You can then implement a state machine (loading_state, game_state etc).
Thank you for pointing me to what seems the right direction, threads is the thing i need. State machines it seems i should check it out, Thank you again  :)
and sorry if my post is too newbie to be posted in this forums.

9
General / how to load image files by order
« on: November 09, 2018, 02:17:09 pm »
Hi  :), I'm a beginner programmer in general, and im new to SFML, I find SFML great so far :D.
I have an issue which is sfml seems to load images at the same time(mayb im wrong), what i want to do is to load an image from file and then display it, then after that, i want to load all images of my game
int main()
{
//RenderWindow window
sf::Image imgLS; // image loading screen

imgLS.loadFromFile("loadingScreen.png");

//setting up texture and sprite // sprLS

window.clear();
window.draw(sprLS);
window.display();

sf::Image img1, img2, ... imgn;
img1.loadFromFile("img1.png");
img2.loadFromFile("img2.png");
.
.
.
imgn.loadFromFile("imgn.png");


startFunction(); //function that uses n images displaying them

/*
while window is open stuff, with event
*/




}
 

its like a loading screen is shown while other images are being loaded, when all game images are loaded, function startFunction() starts.

OUTPUT:
black screen untill startFunction() starts;

QUESTION:
is it possible to load an image, display it and then load other images while displaying it?

Pages: [1]
anything