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 - santiaboy

Pages: 1 2 3 [4] 5 6 ... 8
46
Window / [SOLVED, USE THOR]"Pretty" way to remap keys
« on: November 17, 2013, 11:24:15 pm »
Hey there!

I am still working on my platformer (this week I'll update my project thread!) and wanted to add the option of key remapping. I thought about having some

Keyboard::Key jump
Keyboard::Key moveRight
//...

Then, I'll do Keyboad::isKeyPressed(jump). Then, when the user wants to remap it's just something like this

//..
jump = Keyboard::Escape
//..
or
//..
jump = Event::KeyEvent::code
//..

However, I'm having trouble "drawing" on screen which key represents what. Thing is, for the A-Z is simple. The Key code for A is 0, B is 1 and so on. So, I just add 65 (ascii code) and I'll have the correct letter. However, if the user presses any NUM key, or a slash, I have issues showing that on screen. I just don't know how to translate the key code to the ascii code, unless it's a big switch case (or a bunch of if/else if/else).

EDIT: 2 seconds after I posted it, I stumbled upon this: There is an event called "TextEntered" which gives you the unicode value of the character. http://www.sfml-dev.org/documentation/2.1/structsf_1_1Event_1_1TextEvent.php

So, now I am trying to use both "TextEntered" and KeyPressed to use it, and I think that will do.

47
General / Re: [Linux] Are there any needed libraries to run a SFML program?
« on: September 20, 2013, 07:15:28 pm »
There is no difference between the libraries you need during development (which strictly speaking consists of compiling and linking) and those you need during execution of the binary. Execution of the binary will invoke the executable linker/loader provided by the operating system to complete the final link stage if your application is using dynamic linking.

Thanks! Marked as solved.

48
General / Re: [Linux] Are there any needed libraries to run a SFML program?
« on: September 19, 2013, 10:05:36 pm »
Just to be clear, I am not asking to compile in Linux. I can already do that.

I want to release my program, and I want to know if somebody else needs any additional libs (apart from the sfml ones)

49
Hey guys, it's me again ;D

First of all, I'm linking dinamically. I know that in Windows you have to provide .dlls, so anyone can run the program. Now, on Linux, I provide the SFML libs with the program, but I want to know if the user would need something else. Maybe instaling libglew or something like that.

Cheers!

50
General / Re: AW: [Linux] 32 bit version, using 64 bit linux
« on: September 16, 2013, 09:25:04 pm »
Are there many people still using 32 bit Linux?

I have NO idea. I just wanted to reach to as many people as possible. I'll see if I can make it work with the -m32 and the correct library dependencies. Otherwise: NOT COMPATIBLE WITH 32 BIT LINUX.

Thanks for the answers!

51
General / [Linux] 32 bit version, using 64 bit linux
« on: September 16, 2013, 05:25:37 am »
Hey guys, I've realized that as I have 64 bit Linux, I am using the 64bit version of SFML. I was wondering, the game compiled in 64 bits, it won't run on 32 bit computers right?

I know that in windows you choose which platform you want to compile for, not which OS version you have. However, I do not know if it's the same way in Linux.

I want to reach the most people as possible, so I would like that the game runs nicely in every version (32 and 64)

52
General / Re: Unable to compile SFML 2.1 on Linux
« on: September 15, 2013, 01:17:57 am »
Hey! This are the ones I used, and it worked fine.

Quote
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libx11-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libglew1.5-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libsndfile1-dev
sudo apt-get install libopenal-dev

I used this tutorial (it's for 2.0, but you can use it as a guide for 2.1) http://sfmlcoder.wordpress.com/2011/08/16/building-sfml-2-0-with-make-for-gcc/ and I have it working

53
General / Crediting SFML
« on: September 13, 2013, 05:23:53 am »
Hey guys, I'm trying to get my game on Ubuntu Software Center, and I wanted to know how's the correct way to credit SFML. I read that it's not necessary, but I want to do it.

Also, should I list it as an engine? (It appears on Desura, SFML an engine)

CHeers!

54
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 25, 2013, 02:56:56 am »
if (want_to_read_story){

As I said before, I'm a beginner at programming. This was my first (relatively) big project, and I wanted to use accents. I did some research and stumbled upon wstrings, which (in windows) were the thing I wanted. Then when I tried to port it to linux, where wstrings didn't behaved the way I thought they would. There's when I stumbled upon (googling) loads of "use std::wstring for windows, and std::string for linux". Those answers, however, didn't take into consideration SFML, and were for console std::cout.

I know some things may seem obvious to you, but a year ago, I couldn't even print something on screen. I am learning c++ at my own pace, while at the same time doing Computer Science (let me tell you, intel asm is not a bed of roses). My next move is: make a good video, compile it to run on ubuntu 32 and 64 bits, licence it (I'm thinking MIT licence) and upload it to Ubuntu Software Center. If you see my code you will probably see things that can be better (using quadtrees to optimize for example), but I am proud of what I made.

}

Story aside, there wasn't a bug. You can see FRex's code or check the github revision for a solution.

55
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 24, 2013, 10:18:58 pm »
The latest revision adds a sf::String::fromUtf8 function.
sfml 2.1? cool, I should update then

Quote
By the way, assuming an UTF-8 encoding on Linux is not 100% safe; although it is the default, I guess it can be changed.

I made the .txt and selected UTF-8 as the encoding, so I know it's utf-8

56
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 21, 2013, 06:47:47 pm »
 @Nexus, thanks, I'll look into c++11 when I have the chance!

@Frex, I tried it in Ubuntu 12.04 LTs (Linux 64 bits). I used the g++ compiler, using the console (build-essentials one). Thanks again!

57
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 21, 2013, 05:54:55 pm »
Ah, thanks! Is there a reason to use auto and not use for example std::string::const_iterator? I mean, I know it's that type, why would I use auto and not the explicit type? Is it to make it "prettier" to the person programming?

If there's a chance of not being portable, I prefer to use the explicit type.

I am asuming code::blocks uses c++0x as a default, because the "auto" gave me some errors and warnings.
I don't get your reasoning. The errors are rather an indication that Code::Blocks does not use C++11 as default.

Just specify -std=c++0x and you're fine.

I messed up there..again. I meant I am not using c++11 as a default.

58
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 21, 2013, 05:25:38 pm »
I'm sorry, as you can see I'm still a beginner.

I am using code::blocks 12.11 mingw, which includes the GCC compiler and GDB debugger from TDM-GCC (version 4.7.1, 32 bit). Is this enough info?

I never specified either -std=c++0x or -std=c++11. I am asuming code::blocks uses c++0x as a default, because the "auto" gave me some errors and warnings. I can post them if you like.

59
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 21, 2013, 05:35:05 am »
Upon further research, I did not know what happens on the string classes. I thought that the characters that didn't appear on std::cout << str just weren't there. My bad.

@FRex, is that code c++11? I mean because of the "auto". I couldn't even compile it on Windows 32 bits. (Haven't tried it in Linux) In order for it to work, I did this:


sf::String sf32FromStd8(const std::string& str)
    {
        sf::String ret;
        sf::Uint32 c;
        std::string::const_iterator it=str.begin();
        while(it!=str.end())
        {
            it=sf::Utf8::decode(it,str.end(),c,0u);
            if(c!=0u) ret+=c;
        }
        return ret;
    }

 

It worked on a small example, and it is almost working on my project (I don't know why, there's a line of text that's giving me trouble.) I will try it on linux as soon as I can, and will post results. Thanks both of you! :)

60
System / Re: [Linux] using sf::String makes the accents disapear
« on: August 20, 2013, 03:20:29 am »
Quote
Quote
Weird thing is, the purpose of the std::string in linux are the std::wstring in windows.
That sentence didn't make any sense.
I meant that can you use string in linux for the accents (á, é, etc) and you CAN'T use wstring.
In windows, is the other way around, string doesn't cut it, wstring does.

Quote
Quote
@FRex, thanks! I'm going to try it and hopefully it will work :)
Try it and get back with results, I'd like to know if it doesn't work on some Linux too, since I'm using it for myself and it's supposedly 100% crossplatform. ;D

Couldn't  try it yet, I will post results!

Pages: 1 2 3 [4] 5 6 ... 8