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

Pages: [1]
1
SFML projects / Re: Simple Kana Editor
« on: June 15, 2015, 10:43:11 pm »
Because a proper input method plugin:
1. Hooks into apps and changes latin letters into kana as you type.
2. Has kanji support.
3. Has new katakana sounds support.
4. Is (probably) available in the repos.
5. Is extremely configurable.

That's not bashing on this program, just answering "why not that one".

I wish I had known before I started :(

2
After some trial and error, turns out that I'm an idiot and just needed to recompile SFML on those machines. Oops!

(Also, thank you for producing SFML!)

3
What about sf::String::toUtf8()? :P

I've encountered situations where that doesn't work. Namely, two separate Windows machines that had different versions of standard string libraries. There's also an Ubuntu-based distro that comes with a version of the libraries that behaved differently.

I don't know what causes it, but the solution above seems to work everywhere. :/

4
SFML projects / Re: Simple Kana Editor
« on: June 15, 2015, 01:38:53 am »
[...] honestly I don't see much use for now :-\

I guess you're right. At least it was fun to make, I suppose.

5
This helped me a lot, and it could be useful to someone. I've adapted the solution proposed on another forum post (here's a link).

Here's the solution I used:
// Takes sf::String (UTF-32) and returns std::string (UTF-8)
std::string to_std_string(const sf::String& original)
{
    // The final UTF-8 string
    std::string str;
    // Worst case scenario: 4 bytes per codepoint
    str.resize(original.getSize() * 4);
    std::string::iterator last = sf::Utf<32>::toUtf8( original.getData(),
        original.getData() + original.getSize(), str.begin() );
    str.resize(last - str.begin());
    return str;
}

This will take any sf::String containing unicode codepoint and pass it to a std::string that can be used to output to anywhere. You can even use this std::string for filenames.

NOTE: I've tested this with the main Linux distros (Debian, OpenSUSE, Arch, Fedora, etc.) and Windows XP/Vista/7. The behavior appears to be consistent, but it may not be that way for all machines.

You can set a unicode character by using its codepoint:
// Codepoint in decimal
sf::Uint32 unicode_char = 12354;
// Append unicode char to an sf::String
sf::String unicode_string += unicode_char;

This will create the character '0x3042' (or '12354' in decimal) which is the hiragana character 'あ'. For reference, here's a list of unicode characters along with their codepoint.

6
SFML projects / Simple Kana Editor
« on: June 13, 2015, 11:27:56 pm »
This is a (very simple) editor for katakana and hiragana. You can type in standard romaji (english representations of kana characters) and it will "translate" what you type on the fly.


More information is available at the Github repo, where you can download and build the project for yourself. You'll find instructions for building it on Windows and Linux. The code is freely available, so you're free to fork it or modify it any way you want.

There's no OSX build yet. I'm not familiar with OSX, but if you'd like, you can contribute by forking it and adding some _APPLE_ macros to get it to compile on OSX. You're not only free to do so, but it would be greatly appreciated! The only platform specific sources are main.cpp, savewindow.cpp, main.hpp, and savewindow.hpp (and potentially defines.h).

NOTE: This code does not follow any coding standard. A lot of it is sloppy. I know better now, but it's a nightmare to fix (Sorry!). Future projects will not be so sloppy.

I don't know how much more info to provide, but you can ask me any questions you might have. You can also try contacting me by email through Github.

Links:
- Github project page
- Download sources

EDIT: Fixed image.

7
System / Re: Unable to free memory when using toAnsiString()
« on: October 07, 2013, 02:59:06 am »
How (il)legal is this contraption?

Haha, I know. I'm using Microsoft's Windows SDK, which includes raw compilers.

What do you mean by "dividers"? Slashes?

Yes. Although I'm probably just being an idiot with the path shenanigans.

Thanks for the help, guys. I'm setting up SFML from scratch, hope that helps.

8
System / Re: Unable to free memory when using toAnsiString()
« on: October 07, 2013, 02:29:19 am »
Thanks anyways for the help.

I don't really have an IDE, just the compiler executables, so compiling from the command prompt is all I can do.
I'll try what you suggested, and if that doesn't work, I'll try using the latest unofficial build.

9
System / Re: Unable to free memory when using toAnsiString()
« on: October 07, 2013, 01:43:35 am »
It's very bizarre. I'm getting "No error" from strerror(errno).

I did a little bit of testing and found that including "std::string tempout = filepath.toAnsiString();" causes the program to crash on exit even if I don't use tempout after that line.

EDIT: As soon as I remove "std::string tempout = filepath.toAnsiString();", the program exits smoothly. In all cases, OUTPUT.txt is always created with "Output" as text, even when the program crashes.

10
System / Re: Unable to free memory when using toAnsiString()
« on: October 07, 2013, 12:56:03 am »
The purpose is not to create a directory. The path already exists. (Just replace my example path with an existing directory)

EDIT: I really think my problem has something to do with using dividers in toAnsiString().

11
System / Re: Unable to free memory when using toAnsiString()
« on: October 07, 2013, 12:05:00 am »
The folder needs to exist and it needs to be accessible by the program (i.e. no administrator privileges). Writing only the file name "OUTPUT.txt" (no path) works fine. The crash only happens when a path is specified.

Having close() after the output doesn't seem to make a difference.

12
System / Unable to free memory when using toAnsiString()
« on: October 06, 2013, 09:57:35 pm »
I'm having an issue when using toAnsiString() in conjunction with std::ofstream. The function runs fine until it returns, in which case it crashes.

Here's the minimal code:

#include <SFML/System.hpp>
#include <fstream>
#include <string>

int main()
{
        // You could replace OUTPUT/OUTPUT.txt with your existing home directory
        sf::String filepath = "OUTPUT/OUTPUT.txt";
       
        // I suspect this is what is causing problems
        std::string tempout = filepath.toAnsiString();
       
        std::ofstream fileoutput ( tempout.c_str() );
       
        if (fileoutput.is_open())
        {
                fileoutput << "Output";
        }
}

The text file is created and contains "Output", but the program crashes on exit.

Here is the setup I'm using:

OS: Wndows 7 (64-bit)
Graphics device: Intgrated Intel graphics
SFML: v2.1 standard release (dynamically linked)
Compiler: Visual C/C++ 2010 (32-bit) -- compiled directly from the command prompt

I've also run the code in WinDbg. I get this when main() returns:

1   HEAP[minimal.exe]: Invalid address specified to RtlFreeHeap( 00550000, 005A3808 )
2   (d28.1070): WOW64 breakpoint - code 4000001f (first chance)
3   First chance exceptions are reported before any exception handling.
4   This exception may be expected and handled.
5   ntdll32!RtlpBreakPointHeap+0x23:
6   77950574 cc              int     3


Any help is appreciated.

Pages: [1]
anything