Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [C - SDL & FMOD] OoT2D Style Text "Engine"  (Read 5632 times)

0 Members and 1 Guest are viewing this topic.
[C - SDL & FMOD] OoT2D Style Text "Engine"
« on: April 02, 2012, 12:06:27 pm »
  • Credits to BaB
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Posts: 807
Hai,

As I am making my way through a C learning tutorial, I have decided to try and make a functional OoT2D Style Text engine. It works rather well, and is really easy to use.

Features
  • Loading text from external text file : "en.txt" for English, "fr.txt" for French.
  • Auto-checking the number of lines to display, and positioning them correctly. As in if there's only one line to display, it will be written in the middle of the text box and not at the top.
  • Needs a UTF-8 encoded text file to support wide characters (for internationalization). Currently the supported alphabet is the following one :
  • Colors : Red, Blue and Green are supported. See "How to use" to write colored-text.
  • OoT2D style text box, sounds and behavior. Press and hold the space bar to have the text displayed faster ("A" key in OoT). Press the "C" key to skip to the end of the text ("B" key in OoT).

How to use
To trigger the several text dialogs already written in both text files :
  • T - Displays the test dialog, shows the functionality of the "engine". (P for the French version)
  • U, I and O - Parts 1, 2 and 3 of the Navi dialog at the beginning of OoT. (J, K and L for the French version)

Feel free to modify the corresponding text dialogs to test the engine. Just follow these simple rules :
  • Lines should be around 24 characters long.
  • Always input a RETURN at the end of a line.
  • If you wish to create a separation in a single dialog, input ']'. At this point, the engine will display the 'next' blue triangle at the bottom of the text box. (Press SPACE to continue reading)
  • DO NOT change the label of a dialog, as the engine looks for that label to display the text. Just change the text contained between { and }. Make sure there is a RETURN between { and the beginning of the text.
  • Coloring your text is easy, just wrap your text with the proper color code character :
    $Red$, @Blue@ and #Green#. You can embed various colors, but do not forget to close the wrapping in the correct order. Example : @Begin with blue, $red comes in #with a bit of green#, back to red$ and ending with blue.@

It's easy, just copy the examples provided.

About the code
First of all, variables, functions and macros are all in French, deal with it  :P
I am learning C, thus I need to use a C compatible library. The tutorial I am using to learn C uses SDL and FMOD, making the "engine" fully portable (see below for Mac and Windows binaries).
The code is rather noobish, I do not check at all if the functions work well and if the pointers have been initialized properly... However I am rather satisfied with the text displaying function :
Code: C
  1. ecrire("dialog.navi",lttp,ecran,FRENCH, &finish);
It needs the label of the dialog, the alphabet you are using, the general surface of your game (a.k.a screen surface), language, and the finish boolean which will trigger the closing text box sound.

I am not considering this a real engine for various reasons :
First of all, comments are close to nonexistent in the source code, and I guess you will have trouble properly understanding it.
It is not fully functional, as I cannot have an animation behind the text box, I do not yet know how to handle that. For the time being, every time the text box is loaded (every time you press SPACE), it refills the screen with the green color and draws the text box on top of that.
It wouldn't fit in a real game project, certainly things would be coded in a completely different way (resources loading procedure for instance, that would be something completely different).

However it was fun to code and I thought I would share it with you. Plus, with this you could display the entire OoT text dump if that's any fun to you...

Credits
HelpTheWretched : for the sounds, Legend of Zelda sound effects by HelpTheWretched.
Kousou Games for the font : Kousou Games font rip.


For some odd reasons, the Mac version behaves better than the Windows version. Meaning it really feels like OoT. Sorry for the long post...
« Last Edit: April 08, 2012, 03:55:05 pm by AleX_XelA »
Logged

thestig

Re: [C - SDL & FMOD] OoT2D Style Text "Engine"
« Reply #1 on: April 02, 2012, 12:30:30 pm »
Needs moar http://zfgc.com/index.php/resources/ :D..

Anyways. I think this is good stuff here. What a great way to learn, C too by writing a text engine based around Zelda.
Quote
For some odd reasons, the Mac version behaves better than the Windows version.
Are you using SDL as the renderer, or are you just using it to create a rendering context and have OpenGL as your back-end? The differences probably lie somewhere there. I'm happy to see that you've decided to make this open source. :) And it's cool that you've managed to support two platforms while LEARNING C!

By the way, fix your links. They're broken. As far as your code goes, I managed to download it and glance over it.. it's pretty cool so far, for a learning exercise. :)
OoT2D Style Engine - Mac (Intel 10.5 and above, 2.31 MB)
OoT2D Style Engine - Windows (1.05 MB)

^^ Fixed URLs for great justice! I'll edit your post, and fix them if you don't mind. ;p
Logged
Re: [C - SDL & FMOD] OoT2D Style Text "Engine"
« Reply #2 on: April 02, 2012, 02:51:31 pm »
  • Credits to BaB
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Posts: 807
Nope I am only using SDL and SDL_image to display the graphics.
Well I like learning but it's more fun coding something you enjoy playing with.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.246 seconds with 45 queries.

anything