Debian Codegraph @

README.upgrade

raw
1 This document describes how to port your game from an old ClanLib version to a new one.
2
3 Upgrading from 0.7.8 to 1.0.0
4 =============================
5
6 1. CL_InputEvent changes
7 ------------------------
8 CL_InputEvent::right/left_alt/shift/ctrl got removed,
9 use this to check if they are pressed instead:
10
11 CL_Keyboard::get_keycode(CL_KEY_LSHIFT) // (CL_KEY_LCONTROL, CL_KEY_RCONTROL, etc)
12
13 2. CL_Surface changes
14 ---------------------
15 The CL_Surface_DrawParams got turned into references
16 (they were pointers before):
17
18 void draw(
19 const CL_Surface_DrawParams1& params1,
20 CL_GraphicContext *context = 0);
21 void draw(
22 const CL_Surface_DrawParams2& params2,
23 CL_GraphicContext *context = 0);
24
25 3. CL_PixelBuffer changes
26 -------------------------
27 CL_PixelBuffer is a ref_counted class, thus its no longer needed
28 to manully keep track of the ownership, so all calls which took
29 CL_PixelBuffer* have been changed to use CL_PixelBuffer instead:
30
31 CL_Surface(CL_PixelBuffer*, bool delete_provider);
32
33 was changed to
34
35 CL_Surface(CL_PixelBuffer);
36
37 4. sig_key_dblclk() is gone
38 ---------------------------
39 If you need it, you have to emulate it now yourself via
40 sig_key_down() and CL_System::get_time().
41
42 5. CL_InputDevice::keyid_to_string(const std::string &str)
43 ---------------------------------------------------------------------
44 We renamed a function here to more sense what it actually does:
45
46 int CL_InputDevice::keyid_to_string(const std::string &str) const;
47
48 is now called
49
50 int CL_InputDevice::string_to_keyid(const std::string &str) const;
51
52 6. ClanGUI clipping and translation changes
53 ------------------
54 For performance reasons, GUI components do no longer automatically
55 add translation and clipping to the drawing area. If you have a
56 CL_Component and use sig_paint(), you can get the absolute screen
57 coordinates by calling:
58
59 CL_Rectf rect = component->get_screen_rect();
60
61 If you want to have a clipping section around your component use:
62
63 component->set_clipping(true);
64
65 7. ClanGUI CL_Window buttons
66 ----------------------------
67 If you want to hook into the close buttons of windows, use
68 CL_Window::sig_close_button_clicked() instead of sig_close().
69 Also have a look at the GUIWindow example to see how you define
70 which buttons go on the titlebar.
71
72
73 Upgrading from 0.7.7 to 0.7.8
74 =============================
75
76 1. Canvas changes
77 -----------------
78
79 Instead of using surface.get_gc() to get a surface canvas, you now create a CL_Canvas object.
80 Example:
81
82 CL_Surface surface_foo("foo.png");
83 CL_Surface surface_bar("bar.png");
84 CL_Canvas canvas(surface_foo);
85 surface_bar.draw(5, 5, canvas.get_gc());
86
87 Check the new Canvas example, and the API reference for more information.
88
89 2. Surface changes
90 ------------------
91
92 The Hint parameter to surface construction was removed.
93
94 3. Module initializations
95 -------------------------
96
97 To initialize ClanLib modules, you call CL_SetupCore::init(), CL_SetupDisplay::init(), etc
98 for each module. ::deinit() to de-initialize them.
99
100 This can cause problems, since in some cases objects on the stack are deleted after the
101 deinit of ClanLib modules.
102
103 So, we have added some new initialization classes to help remedy this problem.
104
105 CL_SetupCore::init(); -> CL_SetupCore setup_core;
106 CL_SetupDisplay::init(); -> CL_SetupDisplay setup_display;
107 CL_SetupNetwork::init(); -> CL_SetupNetwork setup_network;
108
109 etc, for all modules. There is no deinit in this new case.
110
111 If you have problems with crashes on shutdown, try to use this alternative initialization.
112
113 4. TargaProvider changes
114 ------------------------
115
116 The internal format of images provided by the Targa loader changed. Make sure you don't
117 make any assumptions of the formats returned by the image providers. Check the format
118 using get_format(), and its functions get_red/green/blue/alpha_mask().
119
120
121 Upgrading from 0.7.6 to 0.7.7
122 =============================
123
124 1. OpenGL state changes
125 -----------------------
126
127 Instead of begin_3d() / end_3d(), we now have a new method of synchronizing the OpenGL
128 state between ClanLib and your own custom OpenGL code. Please read the new OpenGL
129 Overview on how to use this new class.
130
131 2. CL_Component signal changes
132 ------------------------------
133
134 sig_get_minimum_size / sig_get_maximum_size / sig_get_preferred_size
135
136 These signals in CL_Component changed from CL_Point to CL_Size, so if you have a custom
137 theme make sure you change the signal function to
138
139 void ...::on_get_preferred_size(CL_Size &size)
140
141 Note that CL_Size has width and height, compared to CL_Points x and y.
142
143 3. CL_Window construction changes
144 ---------------------------------
145
146 Previously, a CL_Window would always make itself a root component in the GUI hierarchy,
147 no matter what parent component you specificed in its constructor.
148
149 We've changed this behaviour to make it use the parent you give in its constructor.
150 This way a CL_Window behaves the same as all other components, and also makes it possible
151 to create MDI apps.
152
153 To make sure your windows are root components, use get_gui_manager() as the parent.
154 In most cases this is probably what you already do, or the parent IS the root component,
155 so any changes will normally not be required.
156
157
158 Upgrading from 0.7.5 to 0.7.6
159 =============================
160
161 No changes needed.
162
163
164 Upgrading from 0.7.4 to 0.7.5
165 =============================
166
167 1. ClanGUI changes
168 ------------------
169
170 1a. XML used for GUI
171
172 To complete our transition away from proprietary formats, we have now moved the last
173 part over to XML - the GUI definition files.
174
175 GUI definition example of the old format:
176
177 window my_window
178 {
179 x = 10;
180 y = 10;
181 width = 600;
182 height = 400;
183 title = "My Window";
184
185 button my_button
186 {
187 text = "My Button";
188 x = 25;
189 y = 130;
190 width = 100;
191 height = 20;
192 }
193 }
194
195 The same defintion in the new format:
196
197 <components>
198 <window name="my_window" x="10" y="10" width="600" height="400" title="My Window">
199 <components>
200 <button name="my_button" x="25" y="130" width="100" height="20" text="My Button" />
201 </components>
202 </window>
203 </components>
204
205 Since we now use both XML for the resources and gui definition, you can now put them both
206 into the same XML file if you want. Make sure you read the GUI XML Overview for more info
207 about the GUI resource format.
208
209 1b. CL_ComponentManager
210
211 We changed the constructors of this class to make less used parameters use default values.
212 Check the reference, it should be plain to see what should be done.
213
214 1c. CL_ListBox
215
216 ListBox now uses pointers internally, so the insert_item(CL_ListItem) function was changed,
217 and minor others. If you have a custom theme, you'll notice that get_items() now return
218 std::vector<CL_ListItem *> instead of std::vector<CL_ListItem>.
219
220
221 Upgrading from 0.7.3 to 0.7.4
222 =============================
223
224 No API changes.
225
226
227 Upgrading from 0.7.2 to 0.7.3
228 =============================
229
230 1. XML used for resources
231 -------------------------
232
233 We threw away our proprietary resource format, and now use XML instead. The changes
234 are mostly cosmetic, but using XML gives us and the user a lot more freedom and
235 flexibility in creating resource-types.
236
237 Resource example of the old format:
238
239 my_surface = my_surface.tga (type=surface);
240 my_integer = 80 (type = integer);
241 my_sample = beep.wav (type = sample);
242
243 section my_fonts
244 {
245 font_glyph =
246 (
247 type = sprite,
248 image1 = my_font.tga,
249 image1_method = alpha
250 );
251
252 font =
253 (
254 type = font,
255 glyphs = my_fonts/font_glyph,
256 spacelen = 4,
257 letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
258 );
259 }
260
261 The same resources in the new format:
262
263 <resources>
264 <surface name="my_surface" file="my_surface.tga" />
265 <integer name="my_integer" value="80" />
266 <sample name="my_sample" file="beep.wav" />
267
268 <section name="my_fonts">
269 <sprite name="font_glyph">
270 <image file="my_font.tga"><alpha /></image>
271 </sprite>
272
273 <font name="font">
274 <bitmap glyphs="my_fonts/font_glyph" spacelen="4" letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ" />
275 </font>
276 </section>
277 </resources>
278
279 Read the brand new overviews explaining all the resource options!
280
281
282 2. Sound must use soundoutput object
283 ------------------------------------
284
285 If you are using sound in your application, you must create a
286 CL_SoundOutput object first. CL_SoundOutput is the interface
287 to a sound output device. It is used to control the main mixer
288 volume and other global settings.
289
290 Example:
291 CL_SetupCore::init();
292 CL_SetupSound::init();
293 CL_SetupVorbis::init();
294
295 CL_SoundOutput sound_output(44100);
296
297
298 3. CL_Texture was replaced with CL_OpenGLSurface
299 ------------------------------------------------
300
301 Example 1 of its usage:
302 CL_OpenGLSurface surface("texture.jpg");
303 gc->begin_3d();
304 surface.bind();
305 renderCoolOpenGLStuff();
306 gc->end_3d();
307
308 Example 2:
309 CL_Surface surface("texture.jpg");
310 CL_OpenGLSurface surface_gl = surface;
311 gc->begin_3d();
312 surface_gl.bind();
313 renderCoolOpenGLStuff();
314 gc->end_3d();
315
316
317 3. Custom resources
318 -------------------
319
320 Custom resources was changed slightly, check the ResourcesCustom for an example
321 how its done now.
322
323 Note that most users will prolly be happy with the direct-dom approach to
324 custom resources used in the example Resources.
325
326
327 Upgrading from 0.7.0/1 to 0.7.2
328 ===============================
329
330 1. String API changed
331 ---------------------
332
333 The CL_String class was modified to be a helper-class only. You don't construct
334 a CL_String anymore as an object, instead you use the standard std::string.
335
336 It might look like this is more work to use now, but it was done so we can use
337 one string construct all over ClanLib, and not mix std::string and CL_String
338 like we did before.
339
340 Using CL_String::format instead of CL_String << also has its advantages, for
341 example in localization of your game.
342
343 Examples:
344
345 - CL_String str("ClanLib");
346
347 -> must be replaced with ->
348
349 std::string str("ClanLib");
350
351 - CL_String str(integer);
352
353 -> must be replaced with ->
354
355 std::string str = CL_String::from_int(integer);
356
357 - CL_String str(10);
358 int i = str.to_int();
359
360 -> must be replaced with ->
361
362 std::string str = CL_String::from_int(10);
363 int i = CL_String::to_int(str);
364
365 - CL_String str; CL_String text("text"); int number = 10;
366 str << "Example string with " << text << ", " << number << ", " << "yo" << " and " << 23 "!";
367
368 -> must be replaced with ->
369
370 std::string str; std::string text("text"); int number = 10;
371 str = CL_String::format("Example string with %1, %2, %3 and %4 !", text, number, "yo", 23);
372
373 - CL_String str("my_string_resource", resourcemanager);
374
375 -> must be replaced with ->
376
377 std::string str = CL_String::load(""my_string_resource", resourcemanager);
378
379
380 2. GUI
381 ------
382
383 The GUI was cleaned up alot in this release. Also, we made themeing alot
384 more flexible.
385
386 2a. Default theme was removed
387
388 It was replaced with the Boring and the Silver theme.
389 Replace CL_StyleManager_Default with either CL_StyleManager_Boring
390 or CL_StyleManager_Silver.
391
392 The Boring theme is the old Default theme, but with some features removed
393 (like button-bitmaps). The Silver theme is a completely new theme, which
394 support everything in the old Default theme, and more.
395
396 Resources for the themes was moved from Documentation/Examples/GUIThemeDefault
397 to Resources/GUIStyleSilver and Resources/GUIStyleBoring.
398
399 2b. Modal GUI components
400
401 Modal component creation was changed. It is now more logical.
402
403 How it was done earlier:
404 CL_Component comp(..., NULL, style);
405 comp.run(gui);
406
407 How its done now:
408 CL_Component comp(..., gui);
409 comp.run();
410
411 We've removed the need to create separate GUIManagers, so don't do that anymore.
412
413 2c. GUI Themeing
414
415 CL_Component::attach_style() was replaced with CL_Component::set_style(), so
416 you need to update your styleManager to reflect this.
417
418 2d. CL_Button surface setting
419
420 The surface handling was moved from CL_Button to CL_Button_Silver, so you
421 need to replace:
422
423 CL_Button b(pos, text, surface_up, surface_down, surface_disabled, surface_highlight)
424
425 with
426
427 CL_Button b(pos, text);
428 CL_Button_Silver *b_style = (CL_Button_Silver *) b->get_style();
429 b_style->set_surface_up(surface_up);
430 b_style->set_surface_down(surface_down);
431 b_style->set_surface_disabled(surface_disabled);
432 b_style->set_surface_highlighted(surface_highlighted);
433
434 Note that the Boring style no longer support bitmapped buttons.
435
436 2e. GUI.scr themes
437
438 In CL_CheckBox and CL_RadioButton, the resource name was changed from sur_ to surface_.
439 For example, in CL_CheckBox:
440
441 Old syntax:
442 sur_checked = checkbox/checked.tga (type=surface);
443 sur_unchecked = checkbox/unchecked.tga (type=surface);
444 sur_checked_disabled = checkbox/checked_disabled.tga (type=surface);
445 sur_unchecked_disabled = checkbox/unchecked_disabled.tga (type=surface);
446
447 New syntax:
448 surface_checked = checkbox/checked.tga (type=surface);
449 surface_unchecked = checkbox/unchecked.tga (type=surface);
450 surface_checked_disabled = checkbox/checked_disabled.tga (type=surface);
451 surface_unchecked_disabled = checkbox/unchecked_disabled.tga (type=surface);
452
453 This is for both Boring and Silver theme.
454
455 2f. CL_ListBox::max_visible_items
456
457 Set/get max visible items was removed. You have to calculate the size of the listbox
458 yourself. This might be reimplemented in the future, though.
459
460 2g. CL_Window::set_client_size
461
462 This function was removed. It might be reimplemented in the future, though.
463
464
465 3. begin_2d()/end_2d -> begin_3d()/end_3d()
466 -------------------------------------------
467
468 Remove any begin_2d() calls, they were replaced with the invert called
469 begin_3d() - which you call if you need to do something OpenGL specific.
470
471
472
473 Upgrading from 0.6.0 to 0.7.0
474 =============================
475
476 1. Network API has been rewritten
477 ---------------------------------
478
479 ClanLib 0.7.0 now includes the former-known ClanNet2 - replacing the previous
480 network API. Some API changes, but the overall structure should be relative
481 easy to understand if you have worked with the previous network API.
482
483 2. New Display API
484 ------------------
485
486 ClanDisplay2 is now included in 0.7.0 - replacing the previous ClanDisplay from
487 0.6.x. Many API changes, but looking in the reference you shouldn't have too
488 much trouble adapting to the new API. More powerful, more streamlined, more flexible.
489
490 3. Default GUI theme was separated from clanGUI
491 -----------------------------------------------
492
493 You now need to link with clanGUIStyle in addition to clanGUI to use the default theme.
494
495 Also, you need to include this:
496 #include <ClanLib/guistyle.h>
497
498 If you only use a custom theme, you don't need to link with these new libs, nor
499 include the guistyle.h file.
500
501 4. Minor GUI API adjustments
502 ----------------------------
503
504 CL_Signal_v2<CL_InputDevice *, const CL_Key &> &CL_Component::sig_input_down()
505 CL_Signal_v2<CL_InputDevice *, const CL_Key &> &CL_Component::sig_input_up()
506
507 were changed to:
508
509 CL_Signal_v1<const CL_Key &> &CL_Component::sig_input_down()
510 CL_Signal_v1<const CL_Key &> &CL_Component::sig_input_up()
511
512 Use key.device to get hold of the inputdevice instead.
513
514 5. New CL_String class
515 ----------------------
516 The string class was replaced with a new, more powerful one. Should be pretty easy
517 to upgrade though.
518
519 5. CL_Rect changes
520 ------------------
521 The x1, y1, x2, y2 variables in CL_Rect was replaced with left, top, right, bottom.
522
523
524 Upgrading from 0.5.4 to 0.6.0
525 =============================
526
527 1. Signals have been made consistent all over ClanLib
528 -----------------------------------------------------
529 In a few cases you need to add a parenthesis to a signal.
530
531 Example:
532
533 CL_Timer timer;
534
535 // ClanLib 0.5.x:
536 sig_timer.connect(...)
537
538 // ClanLib 0.6.0:
539 sig_timer().connect(...)
540
541
542 The affected signals are as follows:
543
544 CL_Timer::sig_timer
545 CL_Input::sig_button_press
546 CL_Input::sig_button_release
547 CL_Input::sig_mouse_move
548 CL_Mouse::sig_move
549 CL_Mouse::sig_button_press
550 CL_Mouse::sig_button_release
551
552 2. Input signals were changed in clanGUI
553 ----------------------------------------
554
555 CL_Component::sig_key_up(CL_Component *comp, CL_InputDevice *device, const CL_Key &key)
556 CL_Component::sig_key_down(CL_Component *comp, CL_InputDevice *device, const CL_Key &key)
557 CL_Component::sig_mouse_move(CL_Component *comp, int x, int y);
558
559 were changed to:
560
561 CL_Component::sig_key_up(const CL_Key &key)
562 CL_Component::sig_key_down(const CL_Key &key)
563 CL_Component::sig_mouse_move(int x, int y);
564
565 Also, the following signals were added:
566
567 CL_Component::sig_input_up(CL_InputDevice *device, const CL_Key &key)
568 CL_Component::sig_input_down(CL_InputDevice *device, const CL_Key &key)
569
570 sig_key_up/down used to include both mouse and keyboard events, but now sig_key_up/down is
571 ONLY keyboard, and the newly added sig_input_up/down is ANY inputdevice (mouse, keyboard,
572 joystick, etc). So, if you want the old behaviour, hook into the sig_input instead of sig_key signals.
573
574 Remember, you can always use CL_InputDevice::get_type() to check which inputdevice the
575 sig_input_up/down got its event from (returns CL_InputDevice::type_mouse, type_joystick,
576 type_keyboard).
577
578
579 Upgrading from 0.5.2 to 0.5.3
580 =============================
581
582 1. Default videomode has been set to windowed, and not fullscreen as previously.
583
584 To override default, you specify fullscreen-mode like this:
585 CL_Display::set_videomode(640, 480, 16, true);
586 or, window-mode:
587 CL_Display::set_videomode(640, 480, 16, false);
588
589
590 Upgrading from 0.5.1 to 0.5.2
591 =============================
592
593 1. Resource pathhandling is changed
594 -----------------------------------
595 Now all resources are loaded with path from the location of the resource file, and
596 not the location of the executable as before.
597
598 So, for example, if you have this structure:
599 data/
600 data/images/
601 data/images/surface.tga
602 data/images.scr
603
604 Previously, the images.scr would look like this:
605 surface = data/images/surface.tga (type = surface);
606
607 Now, it must be changed into:
608 surface = images/surface.tga (type = surface);
609 without the first data/, as the resourcefile itself is in the data directory.
610
611
612 2. Signal connection API changed
613 --------------------------------
614
615 Earlier you had to use CL_CreateSlot when connecting to a signal:
616
617 CL_Slot slot = sig_something.connect(CL_CreateSlot(this, &MyApp::on_signal));
618
619 It has been modified to this shorter method instead:
620
621 CL_Slot slot = sig_something.connect(this, &MyApp::on_signal);
622
623 Just remove CL_CreateSlot from your code, and you're set.
624
625
626 Also, we added a handy CL_SlotContainer. If you find it awkward storing all those
627 CL_Slot objects, you can do use this instead:
628
629 CL_SlotContainer slots; // Put this where you earlier stored your CL_Slot objects. Don't make it local!
630
631 ...
632
633 slots.connect(sig_something, this, &MyApp::on_signal);
634 slots.connect(sig_something2, this, &MyApp::on_signal2);
635 slots.connect(sig_something_else, this, &MyApp::on_signal_else);
636
637
638 3. GUI Themeing
639 ---------------
640
641 If you have created your own StyleManager, you need to remove the
642 CL_ComponentOptions &options
643 from the
644 void CL_StyleManager::connect_styles(..) function.
645
646 For example:
647
648 void CL_StyleManager_OpenGL::connect_styles(
649 const std::string &type,
650 CL_Component *owner)
651
652 Also, remove the ComponentOptions from all the components. Check
653 the GUIGL example for more specific details.
654
655
656 -------------------------------------------------------------------------------
657
658
659 Upgrading from 0.5.0 to 0.5.1
660 =============================
661
662 1. CL_Input::sig_mouse_move
663 ---------------------------
664 This signal was moved into the CL_Mouse class, and is now called
665
666 CL_Mouse::sig_move(int x, int y);
667
668
669
670 2. ClanGUI
671 ----------
672 Sorry, but this module is so rapidly changing these days, so
673 its no use updating this document regarding that.
674
675
676 -------------------------------------------------------------------------------
677
678
679 Upgrading from 0.4.x to 0.5.0
680 =============================
681
682 1. Multithreaded on Windows
683 2. Separated modules (Sound, Display, Network & Application)
684 3. Init/Deinit modules
685 4. Debug console
686 5. Datafile invocation
687 6. Event Chains
688 7. Input/OutputSource
689 8. Resources
690 9. Network
691
692
693 1. Multithreaded on Windows
694 ---------------------------
695 ClanLib now uses multithreaded libraries on Windows, and you need to upgrade your
696 libraries (zlib, libpng etc) - see http://clanlib.org/download/foreign-win32.html
697 and download the needed libraries there.
698
699 Also, you need to change your own application to use multithreaded libraries:
700
701 1. Select Project->Settings...
702 2. Select the 'C/C++' tab, and then Category 'Code Generation'
703 3a. For Release version, change the 'Use run-time library' to Multithreaded.
704 3b. For Debug version, change the 'Use run-time library' to Debug Multithreaded.
705
706
707 2. Separated modules (Sound, Display, Network & Application)
708 ------------------------------------------------------------
709 Sound, Display, Network, Application was separated from clanCore, and you need to do
710 some changes to the initialization and library including in your game.
711
712 ClanApplication
713 ---------------
714 ClanCore was separated from the CL_ClanApplication initializing, and therefore you need
715 to link with both clanCore and clanApp if you want to use the "standard" way of
716 initializing ClanLib (the easy way).
717
718 Windows:
719 Add clanApp.lib (release) or clanAppd.lib (debug) to your project settings.
720
721 Linux:
722 Add -lclanApp to your Makefile.
723
724 You also need to add this: #include <ClanLib/application.h>
725
726 If you want to initialize ClanLib yourself (for example if you want to use ClanNetwork
727 without anything else from ClanLib), you do not link with ClanApplication,
728 and do a manual initialization.
729
730 ClanDisplay
731 -----------
732 ClanDisplay was separated from ClanCore, and therefore you need to link with both clanCore
733 and clanDisplay.
734
735 Windows:
736 Add clanDisplay.lib (release) or clanDisplayd.lib (debug) to your project settings.
737
738 Linux:
739 Add -lclanDisplay to your Makefile.
740
741 Codewise, you need to replace
742 CL_SetupCore::init_display();
743 CL_SetupCore::deinit_display();
744 with
745 CL_SetupDisplay::init();
746 CL_SetupDisplay::deinit();
747
748 You also need to add this: #include <ClanLib/display.h>
749
750 ClanSound
751 ---------
752 ClanSound was separated from ClanCore, and therefore you need to link with both clanCore
753 and clanSound IF you want to use sound in your game.
754
755 Windows:
756 Add clanSound.lib (release) or clanSoundd.lib (debug) to your project settings.
757
758 Linux:
759 Add -lclanSound to your Makefile.
760
761 Codewise, you need to replace
762
763 CL_SetupCore::init_sound();
764 CL_SetupCore::deinit_sound();
765 with
766 CL_SetupSound::init();
767 CL_SetupSound::deinit();
768
769 You also need to add this: #include <ClanLib/sound.h>
770
771 ClanNetwork
772 -----------
773 ClanNetwork was separated from ClanCore, and therefore you need to link with both clanCore
774 and clanNetwork IF you want to use network in your game.
775
776 Windows:
777 Add clanNetwork.lib (release) or clanNetworkd.lib (debug) to your project settings.
778
779 Linux:
780 Add -lclanNetwork to your Makefile.
781
782 Codewise, you need to replace
783
784 CL_SetupCore::init_network();
785 CL_SetupCore::deinit_network();
786 with
787 CL_SetupNetwork::init();
788 CL_SetupNetwork::deinit();
789
790 You also need to add this: #include <ClanLib/network.h>
791
792
793 3. Init/Deinit modules
794 ----------------------
795 The CL_ClanApplication no longer uses the init_modules() and deinit_modules()
796 functions. Move the initialization into your main() instead, and remove these
797 functions. Or, add functions calling init_modules() and deinit_modules() from
798 your main().
799
800
801 4. Debug console
802 ----------------
803 The debug window under Windows is no longer enabled by default. If you want a
804 console window (for std::cout and printf), add this code:
805 (at the beginning of CL_Application::main for example)
806
807 CL_ConsoleWindow console("My console");
808 console.redirect_stdio();
809
810
811 5. Datafile invocation
812 ----------------------
813 Datafile support is no longer enabled by default. To support the feature with
814 "app -datafile ..." add something like the following code to your main():
815 (You can of course improve this to use filenames from the command line as well)
816
817 ... CL_SetupCore::init();
818 ... CL_SetupGL::init();
819
820 if (argv[1] == "-datafile") {
821 CL_DatafileCompiler::write("my_file.scr", "my_file.dat");
822 return;
823 }
824
825 ... CL_SetupCore::init_display();
826 ... CL_Display::set_videomode(640, 480, 16 false);
827
828
829 Lines starting with ... are just to show where you could put the code.
830
831
832 6. Event Chains
833 ---------------
834 Event chains has been removed, and replaced with a signal-system.
835 So, if any of your classes inherit the following classes, read on to find out
836 how to upgrade your app to the signal system:
837 CL_Event_ButtonRelease
838 CL_Event_ButtonPress
839 CL_Event_WindowResize
840 CL_Event_MouseMove
841 CL_Event_MouseEnter
842 CL_Event_MouseExit
843
844 1. Remove these inherited classes from your classes.
845
846 2. Replace the lines:
847 CL_Input::chain_button_press.push_back( this );
848 ...
849 CL_Input::chain_button_press.remove( this );
850
851 with
852
853 CL_Slot slot; // Put this is a non-local location (like your class-header)
854 ...
855 slot = CL_Input::sig_button_press.connect(CL_CreateSlot(this, &MyClass::on_button_press));
856
857 This just shows the buttonpress event, the others are similar. Refer to the
858 reference for correct API.
859
860
861 7. Input/OutputSource
862 ---------------------
863 This change is represented in all CL_InputSource* and CL_OutputSource* classes.
864
865 The read_bool() function was renamed to read_bool8().
866 The write_bool() function was renamed to write_bool8().
867
868
869 8. Resources
870 ------------
871 The resource API has changed a little bit.
872
873 First, the construction of the CL_ResourceManager is uses a standard constructor instead
874 of the previous ::create() method.
875
876 Replace
877 CL_ResourceManager *resource = CL_ResourceManager::create(...);
878 with
879 CL_ResourceManager *resource = new CL_ResourceManager(...);
880 or
881 CL_ResourceManager resource(...);
882
883 Second, if you use custom resources, go read the new Documentation/Overview about
884 resources. It is now much easier to create custom resources, but it uses a different method
885 than earlier.
886
887 Third, the classes CL_Res_Integer, CL_Res_Boolean and CL_Res_String was replaced with
888 CL_Integer, CL_Boolean and CL_String.
889
890 Instead of previously doing:
891 int my_integer = CL_Res_Integer::load("resource_name", resource_manager);
892 you now do:
893 int my_integer = CL_Integer("resource_name", resource_manager);
894
895
896 9. Network
897 ----------
898 CL_NetGame was renamed to CL_NetSession, as it is now possible to use ClanNetwork
899 in other than games; ClanNetwork is no longer dependent on the rest of ClanLib.
900
901 Various other stuff was altered in ClanNetwork, but the specifics we cannot recall.
902 If you have any additions, please send mail to the mailing-lists.
903