gosu 0.7.19 → 0.7.20
Sign up to get free protection for your applications and to get access to all the features.
- data/Gosu/Input.hpp +12 -8
- data/Gosu/Math.hpp +13 -0
- data/Gosu/TextInput.hpp +5 -0
- data/Gosu/Version.hpp +2 -2
- data/GosuImpl/Graphics/TextUnix.cpp +253 -0
- data/GosuImpl/InputMac.mm +4 -4
- data/GosuImpl/InputWin.cpp +4 -4
- data/GosuImpl/InputX.cpp +15 -15
- data/GosuImpl/Math.cpp +28 -4
- data/GosuImpl/RubyGosu.swg +14 -3
- data/GosuImpl/RubyGosuStub.mm +8 -15
- data/GosuImpl/RubyGosu_wrap.cxx +113 -6
- data/GosuImpl/TextInputMac.mm +10 -1
- data/GosuImpl/TextInputWin.cpp +10 -0
- data/GosuImpl/TextInputX.cpp +10 -0
- data/GosuImpl/WindowMac.mm +15 -4
- data/GosuImpl/WindowWin.cpp +16 -7
- data/examples/TextInput.rb +15 -0
- data/lib/gosu.rb +5 -8
- data/linux/extconf.rb +34 -9
- metadata +13 -272
- data/GosuImpl/Graphics/TextPangoFT.cpp +0 -186
- data/Rakefile +0 -314
- data/examples/TextInput.cpp +0 -192
- data/examples/Tutorial.cpp +0 -215
- data/linux/Makefile.in +0 -99
- data/linux/configure +0 -5850
- data/linux/configure.ac +0 -110
- data/reference/cpp/_audio_8hpp-source.html +0 -178
- data/reference/cpp/_audio_8hpp.html +0 -100
- data/reference/cpp/_audio_8hpp_source.html +0 -170
- data/reference/cpp/_auto_link_8hpp-source.html +0 -85
- data/reference/cpp/_auto_link_8hpp.html +0 -84
- data/reference/cpp/_auto_link_8hpp_source.html +0 -85
- data/reference/cpp/_bitmap_8hpp-source.html +0 -131
- data/reference/cpp/_bitmap_8hpp.html +0 -114
- data/reference/cpp/_bitmap_8hpp_source.html +0 -131
- data/reference/cpp/_buttons_mac_8hpp-source.html +0 -206
- data/reference/cpp/_buttons_mac_8hpp.html +0 -240
- data/reference/cpp/_buttons_mac_8hpp_source.html +0 -206
- data/reference/cpp/_color_8hpp-source.html +0 -216
- data/reference/cpp/_color_8hpp.html +0 -130
- data/reference/cpp/_color_8hpp_source.html +0 -232
- data/reference/cpp/_directories_8hpp-source.html +0 -89
- data/reference/cpp/_directories_8hpp.html +0 -103
- data/reference/cpp/_directories_8hpp_source.html +0 -89
- data/reference/cpp/_font_8hpp-source.html +0 -116
- data/reference/cpp/_font_8hpp.html +0 -94
- data/reference/cpp/_font_8hpp_source.html +0 -116
- data/reference/cpp/_fwd_8hpp-source.html +0 -99
- data/reference/cpp/_fwd_8hpp.html +0 -90
- data/reference/cpp/_fwd_8hpp_source.html +0 -99
- data/reference/cpp/_gosu_8hpp-source.html +0 -97
- data/reference/cpp/_gosu_8hpp.html +0 -84
- data/reference/cpp/_gosu_8hpp_source.html +0 -97
- data/reference/cpp/_graphics_8hpp-source.html +0 -135
- data/reference/cpp/_graphics_8hpp.html +0 -101
- data/reference/cpp/_graphics_8hpp_source.html +0 -144
- data/reference/cpp/_graphics_base_8hpp-source.html +0 -116
- data/reference/cpp/_graphics_base_8hpp.html +0 -128
- data/reference/cpp/_graphics_base_8hpp_source.html +0 -117
- data/reference/cpp/_i_o_8hpp-source.html +0 -302
- data/reference/cpp/_i_o_8hpp.html +0 -129
- data/reference/cpp/_i_o_8hpp_source.html +0 -295
- data/reference/cpp/_image_8hpp-source.html +0 -173
- data/reference/cpp/_image_8hpp.html +0 -103
- data/reference/cpp/_image_8hpp_source.html +0 -176
- data/reference/cpp/_image_data_8hpp-source.html +0 -109
- data/reference/cpp/_image_data_8hpp.html +0 -97
- data/reference/cpp/_image_data_8hpp_source.html +0 -109
- data/reference/cpp/_input_8hpp-source.html +0 -183
- data/reference/cpp/_input_8hpp.html +0 -109
- data/reference/cpp/_input_8hpp_source.html +0 -183
- data/reference/cpp/_math_8hpp-source.html +0 -157
- data/reference/cpp/_math_8hpp.html +0 -152
- data/reference/cpp/_math_8hpp_source.html +0 -157
- data/reference/cpp/_platform_8hpp-source.html +0 -134
- data/reference/cpp/_platform_8hpp.html +0 -162
- data/reference/cpp/_platform_8hpp_source.html +0 -134
- data/reference/cpp/_rot_flip_8hpp-source.html +0 -185
- data/reference/cpp/_rot_flip_8hpp.html +0 -130
- data/reference/cpp/_rot_flip_8hpp_source.html +0 -185
- data/reference/cpp/_sockets_8hpp-source.html +0 -175
- data/reference/cpp/_sockets_8hpp.html +0 -124
- data/reference/cpp/_sockets_8hpp_source.html +0 -175
- data/reference/cpp/_text_8hpp-source.html +0 -103
- data/reference/cpp/_text_8hpp.html +0 -106
- data/reference/cpp/_text_8hpp_source.html +0 -103
- data/reference/cpp/_text_input_8hpp-source.html +0 -111
- data/reference/cpp/_text_input_8hpp.html +0 -94
- data/reference/cpp/_text_input_8hpp_source.html +0 -116
- data/reference/cpp/_timing_8hpp-source.html +0 -83
- data/reference/cpp/_timing_8hpp.html +0 -97
- data/reference/cpp/_timing_8hpp_source.html +0 -83
- data/reference/cpp/_utility_8hpp-source.html +0 -90
- data/reference/cpp/_utility_8hpp.html +0 -103
- data/reference/cpp/_utility_8hpp_source.html +0 -90
- data/reference/cpp/_version_8hpp-source.html +0 -78
- data/reference/cpp/_version_8hpp.html +0 -154
- data/reference/cpp/_version_8hpp_source.html +0 -78
- data/reference/cpp/_win_utility_8hpp-source.html +0 -126
- data/reference/cpp/_win_utility_8hpp.html +0 -128
- data/reference/cpp/_win_utility_8hpp_source.html +0 -126
- data/reference/cpp/_window_8hpp-source.html +0 -158
- data/reference/cpp/_window_8hpp.html +0 -94
- data/reference/cpp/_window_8hpp_source.html +0 -159
- data/reference/cpp/annotated.html +0 -98
- data/reference/cpp/class_gosu_1_1_audio-members.html +0 -76
- data/reference/cpp/class_gosu_1_1_audio.html +0 -155
- data/reference/cpp/class_gosu_1_1_bitmap-members.html +0 -86
- data/reference/cpp/class_gosu_1_1_bitmap.html +0 -506
- data/reference/cpp/class_gosu_1_1_buffer-members.html +0 -85
- data/reference/cpp/class_gosu_1_1_buffer.html +0 -341
- data/reference/cpp/class_gosu_1_1_buffer.png +0 -0
- data/reference/cpp/class_gosu_1_1_button-members.html +0 -77
- data/reference/cpp/class_gosu_1_1_button.html +0 -198
- data/reference/cpp/class_gosu_1_1_color-members.html +0 -108
- data/reference/cpp/class_gosu_1_1_color.html +0 -972
- data/reference/cpp/class_gosu_1_1_comm_socket-members.html +0 -91
- data/reference/cpp/class_gosu_1_1_comm_socket.html +0 -506
- data/reference/cpp/class_gosu_1_1_file-members.html +0 -82
- data/reference/cpp/class_gosu_1_1_file.html +0 -276
- data/reference/cpp/class_gosu_1_1_file.png +0 -0
- data/reference/cpp/class_gosu_1_1_font-members.html +0 -82
- data/reference/cpp/class_gosu_1_1_font.html +0 -506
- data/reference/cpp/class_gosu_1_1_graphics-members.html +0 -93
- data/reference/cpp/class_gosu_1_1_graphics.html +0 -817
- data/reference/cpp/class_gosu_1_1_image-members.html +0 -87
- data/reference/cpp/class_gosu_1_1_image.html +0 -797
- data/reference/cpp/class_gosu_1_1_image_data-members.html +0 -78
- data/reference/cpp/class_gosu_1_1_image_data.html +0 -282
- data/reference/cpp/class_gosu_1_1_input-members.html +0 -86
- data/reference/cpp/class_gosu_1_1_input.html +0 -418
- data/reference/cpp/class_gosu_1_1_listener_socket-members.html +0 -79
- data/reference/cpp/class_gosu_1_1_listener_socket.html +0 -222
- data/reference/cpp/class_gosu_1_1_message_socket-members.html +0 -81
- data/reference/cpp/class_gosu_1_1_message_socket.html +0 -306
- data/reference/cpp/class_gosu_1_1_reader-members.html +0 -81
- data/reference/cpp/class_gosu_1_1_reader.html +0 -323
- data/reference/cpp/class_gosu_1_1_resource-members.html +0 -80
- data/reference/cpp/class_gosu_1_1_resource.html +0 -306
- data/reference/cpp/class_gosu_1_1_resource.png +0 -0
- data/reference/cpp/class_gosu_1_1_rot_flip-members.html +0 -84
- data/reference/cpp/class_gosu_1_1_rot_flip.html +0 -352
- data/reference/cpp/class_gosu_1_1_sample-members.html +0 -80
- data/reference/cpp/class_gosu_1_1_sample.html +0 -324
- data/reference/cpp/class_gosu_1_1_sample_instance-members.html +0 -82
- data/reference/cpp/class_gosu_1_1_sample_instance.html +0 -318
- data/reference/cpp/class_gosu_1_1_song-members.html +0 -90
- data/reference/cpp/class_gosu_1_1_song.html +0 -493
- data/reference/cpp/class_gosu_1_1_text_input-members.html +0 -80
- data/reference/cpp/class_gosu_1_1_text_input.html +0 -255
- data/reference/cpp/class_gosu_1_1_window-members.html +0 -91
- data/reference/cpp/class_gosu_1_1_window.html +0 -534
- data/reference/cpp/class_gosu_1_1_writer-members.html +0 -80
- data/reference/cpp/class_gosu_1_1_writer.html +0 -293
- data/reference/cpp/classes.html +0 -86
- data/reference/cpp/closed.gif +0 -0
- data/reference/cpp/cpp.css +0 -155
- data/reference/cpp/doxygen.png +0 -0
- data/reference/cpp/files.html +0 -99
- data/reference/cpp/functions.html +0 -128
- data/reference/cpp/functions_0x62.html +0 -144
- data/reference/cpp/functions_0x63.html +0 -143
- data/reference/cpp/functions_0x64.html +0 -143
- data/reference/cpp/functions_0x65.html +0 -122
- data/reference/cpp/functions_0x66.html +0 -144
- data/reference/cpp/functions_0x67.html +0 -136
- data/reference/cpp/functions_0x68.html +0 -122
- data/reference/cpp/functions_0x69.html +0 -124
- data/reference/cpp/functions_0x6b.html +0 -116
- data/reference/cpp/functions_0x6c.html +0 -118
- data/reference/cpp/functions_0x6d.html +0 -126
- data/reference/cpp/functions_0x6e.html +0 -121
- data/reference/cpp/functions_0x6f.html +0 -127
- data/reference/cpp/functions_0x70.html +0 -137
- data/reference/cpp/functions_0x72.html +0 -157
- data/reference/cpp/functions_0x73.html +0 -180
- data/reference/cpp/functions_0x74.html +0 -128
- data/reference/cpp/functions_0x75.html +0 -123
- data/reference/cpp/functions_0x76.html +0 -118
- data/reference/cpp/functions_0x77.html +0 -132
- data/reference/cpp/functions_0x78.html +0 -116
- data/reference/cpp/functions_0x79.html +0 -118
- data/reference/cpp/functions_0x7e.html +0 -142
- data/reference/cpp/functions_enum.html +0 -88
- data/reference/cpp/functions_eval.html +0 -90
- data/reference/cpp/functions_func.html +0 -124
- data/reference/cpp/functions_func_0x62.html +0 -136
- data/reference/cpp/functions_func_0x63.html +0 -137
- data/reference/cpp/functions_func_0x64.html +0 -141
- data/reference/cpp/functions_func_0x65.html +0 -120
- data/reference/cpp/functions_func_0x66.html +0 -140
- data/reference/cpp/functions_func_0x67.html +0 -130
- data/reference/cpp/functions_func_0x68.html +0 -120
- data/reference/cpp/functions_func_0x69.html +0 -120
- data/reference/cpp/functions_func_0x6b.html +0 -114
- data/reference/cpp/functions_func_0x6c.html +0 -114
- data/reference/cpp/functions_func_0x6d.html +0 -124
- data/reference/cpp/functions_func_0x6e.html +0 -117
- data/reference/cpp/functions_func_0x6f.html +0 -114
- data/reference/cpp/functions_func_0x70.html +0 -135
- data/reference/cpp/functions_func_0x72.html +0 -151
- data/reference/cpp/functions_func_0x73.html +0 -174
- data/reference/cpp/functions_func_0x74.html +0 -120
- data/reference/cpp/functions_func_0x75.html +0 -121
- data/reference/cpp/functions_func_0x76.html +0 -116
- data/reference/cpp/functions_func_0x77.html +0 -128
- data/reference/cpp/functions_func_0x7e.html +0 -140
- data/reference/cpp/functions_type.html +0 -88
- data/reference/cpp/functions_vars.html +0 -135
- data/reference/cpp/globals.html +0 -95
- data/reference/cpp/globals_defs.html +0 -95
- data/reference/cpp/hierarchy.html +0 -100
- data/reference/cpp/index.html +0 -67
- data/reference/cpp/namespace_gosu.html +0 -3311
- data/reference/cpp/namespace_gosu_1_1_colors.html +0 -287
- data/reference/cpp/namespace_gosu_1_1_win.html +0 -354
- data/reference/cpp/namespacemembers.html +0 -139
- data/reference/cpp/namespacemembers_0x62.html +0 -143
- data/reference/cpp/namespacemembers_0x63.html +0 -125
- data/reference/cpp/namespacemembers_0x64.html +0 -121
- data/reference/cpp/namespacemembers_0x66.html +0 -129
- data/reference/cpp/namespacemembers_0x67.html +0 -163
- data/reference/cpp/namespacemembers_0x68.html +0 -113
- data/reference/cpp/namespacemembers_0x69.html +0 -117
- data/reference/cpp/namespacemembers_0x6b.html +0 -289
- data/reference/cpp/namespacemembers_0x6c.html +0 -119
- data/reference/cpp/namespacemembers_0x6d.html +0 -131
- data/reference/cpp/namespacemembers_0x6e.html +0 -127
- data/reference/cpp/namespacemembers_0x6f.html +0 -121
- data/reference/cpp/namespacemembers_0x70.html +0 -115
- data/reference/cpp/namespacemembers_0x71.html +0 -113
- data/reference/cpp/namespacemembers_0x72.html +0 -165
- data/reference/cpp/namespacemembers_0x73.html +0 -135
- data/reference/cpp/namespacemembers_0x74.html +0 -129
- data/reference/cpp/namespacemembers_0x75.html +0 -117
- data/reference/cpp/namespacemembers_0x77.html +0 -117
- data/reference/cpp/namespacemembers_0x79.html +0 -113
- data/reference/cpp/namespacemembers_0x7a.html +0 -115
- data/reference/cpp/namespacemembers_enum.html +0 -103
- data/reference/cpp/namespacemembers_eval.html +0 -445
- data/reference/cpp/namespacemembers_func.html +0 -269
- data/reference/cpp/namespacemembers_type.html +0 -93
- data/reference/cpp/namespacemembers_vars.html +0 -117
- data/reference/cpp/namespaces.html +0 -76
- data/reference/cpp/open.gif +0 -0
- data/reference/cpp/struct_gosu_1_1_g_l_tex_info-members.html +0 -78
- data/reference/cpp/struct_gosu_1_1_g_l_tex_info.html +0 -186
- data/reference/cpp/struct_gosu_1_1_touch-members.html +0 -76
- data/reference/cpp/struct_gosu_1_1_touch.html +0 -154
- data/reference/cpp/tab_b.gif +0 -0
- data/reference/cpp/tab_l.gif +0 -0
- data/reference/cpp/tab_r.gif +0 -0
- data/reference/cpp/tabs.css +0 -105
- data/reference/rdoc/classes/Gosu.html +0 -1546
- data/reference/rdoc/classes/Gosu/Color.html +0 -660
- data/reference/rdoc/classes/Gosu/Font.html +0 -545
- data/reference/rdoc/classes/Gosu/GLTexInfo.html +0 -412
- data/reference/rdoc/classes/Gosu/Image.html +0 -706
- data/reference/rdoc/classes/Gosu/Sample.html +0 -476
- data/reference/rdoc/classes/Gosu/SampleInstance.html +0 -523
- data/reference/rdoc/classes/Gosu/Song.html +0 -568
- data/reference/rdoc/classes/Gosu/TextInput.html +0 -444
- data/reference/rdoc/classes/Gosu/Window.html +0 -911
- data/reference/rdoc/classes/Numeric.html +0 -479
- data/reference/rdoc/created.rid +0 -1
- data/reference/rdoc/files/COPYING_txt.html +0 -391
- data/reference/rdoc/files/README_txt.html +0 -387
- data/reference/rdoc/files/reference/Deployment on OS X_rdoc.html +0 -381
- data/reference/rdoc/files/reference/Deployment on Windows_rdoc.html +0 -385
- data/reference/rdoc/files/reference/Drawing with Colors_rdoc.html +0 -363
- data/reference/rdoc/files/reference/Order of Corners_rdoc.html +0 -358
- data/reference/rdoc/files/reference/Tileability_rdoc.html +0 -374
- data/reference/rdoc/files/reference/Z Ordering_rdoc.html +0 -361
- data/reference/rdoc/files/reference/gosu_rb.html +0 -348
- data/reference/rdoc/fr_class_index.html +0 -12
- data/reference/rdoc/fr_file_index.html +0 -10
- data/reference/rdoc/fr_method_index.html +0 -66
- data/reference/rdoc/index.html +0 -1
- data/reference/rdoc/rdoc-style.css +0 -320
@@ -1,157 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Gosu C++ Reference</title>
|
4
|
-
<link rel="stylesheet" href="cpp.css" type="text/css" charset="utf-8">
|
5
|
-
</head>
|
6
|
-
<body>
|
7
|
-
<div class="everything">
|
8
|
-
<!-- Generated by Doxygen 1.5.8 -->
|
9
|
-
<script type="text/javascript">
|
10
|
-
<!--
|
11
|
-
function changeDisplayState (e){
|
12
|
-
var num=this.id.replace(/[^[0-9]/g,'');
|
13
|
-
var button=this.firstChild;
|
14
|
-
var sectionDiv=document.getElementById('dynsection'+num);
|
15
|
-
if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
|
16
|
-
sectionDiv.style.display='block';
|
17
|
-
button.src='open.gif';
|
18
|
-
}else{
|
19
|
-
sectionDiv.style.display='none';
|
20
|
-
button.src='closed.gif';
|
21
|
-
}
|
22
|
-
}
|
23
|
-
function initDynSections(){
|
24
|
-
var divs=document.getElementsByTagName('div');
|
25
|
-
var sectionCounter=1;
|
26
|
-
for(var i=0;i<divs.length-1;i++){
|
27
|
-
if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
|
28
|
-
var header=divs[i];
|
29
|
-
var section=divs[i+1];
|
30
|
-
var button=header.firstChild;
|
31
|
-
if (button!='IMG'){
|
32
|
-
divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
|
33
|
-
button=document.createElement('img');
|
34
|
-
divs[i].insertBefore(button,divs[i].firstChild);
|
35
|
-
}
|
36
|
-
header.style.cursor='pointer';
|
37
|
-
header.onclick=changeDisplayState;
|
38
|
-
header.id='dynheader'+sectionCounter;
|
39
|
-
button.src='closed.gif';
|
40
|
-
section.id='dynsection'+sectionCounter;
|
41
|
-
section.style.display='none';
|
42
|
-
section.style.marginLeft='14px';
|
43
|
-
sectionCounter++;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
window.onload = initDynSections;
|
48
|
-
-->
|
49
|
-
</script>
|
50
|
-
<div class="navigation" id="top">
|
51
|
-
<div class="tabs">
|
52
|
-
<ul>
|
53
|
-
<li><a href="index.html"><span>Main Page</span></a></li>
|
54
|
-
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
55
|
-
<li><a href="annotated.html"><span>Classes</span></a></li>
|
56
|
-
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
57
|
-
</ul>
|
58
|
-
</div>
|
59
|
-
<div class="tabs">
|
60
|
-
<ul>
|
61
|
-
<li><a href="files.html"><span>File List</span></a></li>
|
62
|
-
<li><a href="globals.html"><span>File Members</span></a></li>
|
63
|
-
</ul>
|
64
|
-
</div>
|
65
|
-
<h1>Math.hpp</h1><a href="_math_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
|
66
|
-
<a name="l00002"></a>00002
|
67
|
-
<a name="l00003"></a>00003
|
68
|
-
<a name="l00004"></a>00004 <span class="preprocessor">#ifndef GOSU_MATH_HPP</span>
|
69
|
-
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#define GOSU_MATH_HPP</span>
|
70
|
-
<a name="l00006"></a>00006 <span class="preprocessor"></span>
|
71
|
-
<a name="l00007"></a>00007 <span class="keyword">namespace </span>Gosu
|
72
|
-
<a name="l00008"></a>00008 {
|
73
|
-
<a name="l00010"></a><a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01">00010</a> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> = 3.1415926536;
|
74
|
-
<a name="l00011"></a>00011
|
75
|
-
<a name="l00014"></a><a class="code" href="namespace_gosu.html#dc5f4941f3a17c6c5233d6c7a628cc68">00014</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespace_gosu.html#dc5f4941f3a17c6c5233d6c7a628cc68" title="Truncates the fractional part of a real value.">trunc</a>(<span class="keywordtype">double</span> value)
|
76
|
-
<a name="l00015"></a>00015 {
|
77
|
-
<a name="l00016"></a>00016 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value);
|
78
|
-
<a name="l00017"></a>00017 }
|
79
|
-
<a name="l00018"></a>00018
|
80
|
-
<a name="l00020"></a><a class="code" href="namespace_gosu.html#496868cf52cf159cf98a00888c4fbc1c">00020</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespace_gosu.html#496868cf52cf159cf98a00888c4fbc1c" title="Rounds a real value towards the next integer.">round</a>(<span class="keywordtype">double</span> value)
|
81
|
-
<a name="l00021"></a>00021 {
|
82
|
-
<a name="l00022"></a>00022 <span class="keywordflow">if</span> (value >= 0)
|
83
|
-
<a name="l00023"></a>00023 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value + 0.5);
|
84
|
-
<a name="l00024"></a>00024 <span class="keywordflow">else</span>
|
85
|
-
<a name="l00025"></a>00025 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value - 0.5);
|
86
|
-
<a name="l00026"></a>00026 }
|
87
|
-
<a name="l00027"></a>00027
|
88
|
-
<a name="l00030"></a>00030 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#6c855080566f7f1b1967c90805249dda" title="Returns a real value between min (inclusive) and max (exclusive).">random</a>(<span class="keywordtype">double</span> min, <span class="keywordtype">double</span> max);
|
89
|
-
<a name="l00031"></a>00031
|
90
|
-
<a name="l00033"></a><a class="code" href="namespace_gosu.html#2f8e80b399a0c5ba42667f22e7f2ba2f">00033</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#2f8e80b399a0c5ba42667f22e7f2ba2f" title="Translates between Gosu&#39;s angle system and radians.">gosuToRadians</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
91
|
-
<a name="l00034"></a>00034 {
|
92
|
-
<a name="l00035"></a>00035 <span class="keywordflow">return</span> (angle - 90) * <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> / 180;
|
93
|
-
<a name="l00036"></a>00036 }
|
94
|
-
<a name="l00038"></a><a class="code" href="namespace_gosu.html#a853d9351f1568d0a949b2b7717e1e6a">00038</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#a853d9351f1568d0a949b2b7717e1e6a" title="Translates between Gosu&#39;s angle system and radians.">radiansToGosu</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
95
|
-
<a name="l00039"></a>00039 {
|
96
|
-
<a name="l00040"></a>00040 <span class="keywordflow">return</span> angle * 180 / <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> + 90;
|
97
|
-
<a name="l00041"></a>00041 }
|
98
|
-
<a name="l00042"></a>00042
|
99
|
-
<a name="l00045"></a><a class="code" href="namespace_gosu.html#9bc4301aa5fa2c2a49e81550fcb1896f">00045</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#9bc4301aa5fa2c2a49e81550fcb1896f" title="Translates between Gosu&#39;s angle scaling and radians, i.e.">gosuToRadianScale</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
100
|
-
<a name="l00046"></a>00046 {
|
101
|
-
<a name="l00047"></a>00047 <span class="keywordflow">return</span> angle * <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> / 180;
|
102
|
-
<a name="l00048"></a>00048 }
|
103
|
-
<a name="l00051"></a><a class="code" href="namespace_gosu.html#00bce97df13e74be6f27e4a1befe2ea4">00051</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#00bce97df13e74be6f27e4a1befe2ea4" title="Translates between Gosu&#39;s angle scaling and radians, i.e.">radiansScaleToGosu</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
104
|
-
<a name="l00052"></a>00052 {
|
105
|
-
<a name="l00053"></a>00053 <span class="keywordflow">return</span> angle * 180 / <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a>;
|
106
|
-
<a name="l00054"></a>00054 }
|
107
|
-
<a name="l00055"></a>00055
|
108
|
-
<a name="l00060"></a>00060 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#e61d02831aa7026e96f1e53a358609b2" title="Returns the horizontal distance between the origin and the point to which you would...">offsetX</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>, <span class="keywordtype">double</span> radius);
|
109
|
-
<a name="l00065"></a>00065 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#9e0845d8b2ed385cb4e8593e7a308a08" title="Returns the vertical distance between the origin and the point to which you would...">offsetY</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>, <span class="keywordtype">double</span> radius);
|
110
|
-
<a name="l00068"></a>00068 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>(<span class="keywordtype">double</span> fromX, <span class="keywordtype">double</span> fromY, <span class="keywordtype">double</span> toX, <span class="keywordtype">double</span> toY,
|
111
|
-
<a name="l00069"></a>00069 <span class="keywordtype">double</span> def = 0);
|
112
|
-
<a name="l00072"></a>00072 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#36cfaba7c2038bfeabdd1672882704f4" title="Returns the smallest angle that can be added to angle1 to get to angle2 (can be negative...">angleDiff</a>(<span class="keywordtype">double</span> angle1, <span class="keywordtype">double</span> angle2);
|
113
|
-
<a name="l00074"></a>00074 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#c6f147ab90f7e343dd9d70cc8bf3a91b" title="Normalizes an angle to fit into the range [0; 360[.">normalizeAngle</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>);
|
114
|
-
<a name="l00075"></a>00075
|
115
|
-
<a name="l00077"></a>00077 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
116
|
-
<a name="l00078"></a><a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc">00078</a> T <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(T value)
|
117
|
-
<a name="l00079"></a>00079 {
|
118
|
-
<a name="l00080"></a>00080 <span class="keywordflow">return</span> value * value;
|
119
|
-
<a name="l00081"></a>00081 }
|
120
|
-
<a name="l00082"></a>00082
|
121
|
-
<a name="l00085"></a>00085 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
122
|
-
<a name="l00086"></a><a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f">00086</a> T <a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f" title="Returns min if value is smaller than min, max if value is larger than max and value...">clamp</a>(T value, T min, T max)
|
123
|
-
<a name="l00087"></a>00087 {
|
124
|
-
<a name="l00088"></a>00088 <span class="keywordflow">if</span> (value < min)
|
125
|
-
<a name="l00089"></a>00089 <span class="keywordflow">return</span> min;
|
126
|
-
<a name="l00090"></a>00090 <span class="keywordflow">if</span> (value > max)
|
127
|
-
<a name="l00091"></a>00091 <span class="keywordflow">return</span> max;
|
128
|
-
<a name="l00092"></a>00092 <span class="keywordflow">return</span> value;
|
129
|
-
<a name="l00093"></a>00093 }
|
130
|
-
<a name="l00094"></a>00094
|
131
|
-
<a name="l00095"></a>00095 <span class="comment">// Backward compatibility with 0.7.x</span>
|
132
|
-
<a name="l00096"></a>00096 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
133
|
-
<a name="l00097"></a><a class="code" href="namespace_gosu.html#5b35114c04a3f01d54c2e052d350b61f">00097</a> T <a class="code" href="namespace_gosu.html#5b35114c04a3f01d54c2e052d350b61f">boundBy</a>(T value, T min, T max)
|
134
|
-
<a name="l00098"></a>00098 {
|
135
|
-
<a name="l00099"></a>00099 <span class="keywordflow">return</span> <a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f" title="Returns min if value is smaller than min, max if value is larger than max and value...">clamp</a>(value, min, max);
|
136
|
-
<a name="l00100"></a>00100 }
|
137
|
-
<a name="l00101"></a>00101
|
138
|
-
<a name="l00103"></a><a class="code" href="namespace_gosu.html#58015f2ee3527184171d3d99176fd360">00103</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#58015f2ee3527184171d3d99176fd360" title="Returns the square of the distance between two points.">distanceSqr</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y2)
|
139
|
-
<a name="l00104"></a>00104 {
|
140
|
-
<a name="l00105"></a>00105 <span class="keywordflow">return</span> <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(x1 - x2) + <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(y1 - y2);
|
141
|
-
<a name="l00106"></a>00106 }
|
142
|
-
<a name="l00107"></a>00107
|
143
|
-
<a name="l00109"></a>00109 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#a06a29a8aefa1be625072b02e2d825bd" title="Returns the distance between two points.">distance</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y2);
|
144
|
-
<a name="l00110"></a>00110
|
145
|
-
<a name="l00113"></a>00113 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
146
|
-
<a name="l00114"></a><a class="code" href="namespace_gosu.html#29515f6c9be056e9ca5f672dec154847">00114</a> T <a class="code" href="namespace_gosu.html#55c2cfa7575386d8eb6a8dc615e905ae" title="Interpolates linearly between two colors, with a given weight towards the second...">interpolate</a>(T a, T b, <span class="keywordtype">double</span> weight = 0.5)
|
147
|
-
<a name="l00115"></a>00115 {
|
148
|
-
<a name="l00116"></a>00116 <span class="keywordflow">return</span> a * (1.0 - weight) + b * weight;
|
149
|
-
<a name="l00117"></a>00117 }
|
150
|
-
<a name="l00118"></a>00118 }
|
151
|
-
<a name="l00119"></a>00119
|
152
|
-
<a name="l00120"></a>00120 <span class="preprocessor">#endif</span>
|
153
|
-
</pre></div></div>
|
154
|
-
<p class="footer">Documentation not clear enough? Please go to one of the places listed on <a href="http://www.libgosu.org/">http://www.libgosu.org/</a> and leave feedback. Thanks!</p>
|
155
|
-
</div>
|
156
|
-
</body>
|
157
|
-
</html>
|
@@ -1,152 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Gosu C++ Reference</title>
|
4
|
-
<link rel="stylesheet" href="cpp.css" type="text/css" charset="utf-8">
|
5
|
-
</head>
|
6
|
-
<body>
|
7
|
-
<div class="everything">
|
8
|
-
<!-- Generated by Doxygen 1.5.9 -->
|
9
|
-
<script type="text/javascript">
|
10
|
-
<!--
|
11
|
-
function changeDisplayState (e){
|
12
|
-
var num=this.id.replace(/[^[0-9]/g,'');
|
13
|
-
var button=this.firstChild;
|
14
|
-
var sectionDiv=document.getElementById('dynsection'+num);
|
15
|
-
if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
|
16
|
-
sectionDiv.style.display='block';
|
17
|
-
button.src='open.gif';
|
18
|
-
}else{
|
19
|
-
sectionDiv.style.display='none';
|
20
|
-
button.src='closed.gif';
|
21
|
-
}
|
22
|
-
}
|
23
|
-
function initDynSections(){
|
24
|
-
var divs=document.getElementsByTagName('div');
|
25
|
-
var sectionCounter=1;
|
26
|
-
for(var i=0;i<divs.length-1;i++){
|
27
|
-
if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
|
28
|
-
var header=divs[i];
|
29
|
-
var section=divs[i+1];
|
30
|
-
var button=header.firstChild;
|
31
|
-
if (button!='IMG'){
|
32
|
-
divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
|
33
|
-
button=document.createElement('img');
|
34
|
-
divs[i].insertBefore(button,divs[i].firstChild);
|
35
|
-
}
|
36
|
-
header.style.cursor='pointer';
|
37
|
-
header.onclick=changeDisplayState;
|
38
|
-
header.id='dynheader'+sectionCounter;
|
39
|
-
button.src='closed.gif';
|
40
|
-
section.id='dynsection'+sectionCounter;
|
41
|
-
section.style.display='none';
|
42
|
-
section.style.marginLeft='14px';
|
43
|
-
sectionCounter++;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
window.onload = initDynSections;
|
48
|
-
-->
|
49
|
-
</script>
|
50
|
-
<div class="navigation" id="top">
|
51
|
-
<div class="tabs">
|
52
|
-
<ul>
|
53
|
-
<li><a href="index.html"><span>Main Page</span></a></li>
|
54
|
-
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
55
|
-
<li><a href="annotated.html"><span>Classes</span></a></li>
|
56
|
-
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
57
|
-
</ul>
|
58
|
-
</div>
|
59
|
-
<div class="tabs">
|
60
|
-
<ul>
|
61
|
-
<li><a href="files.html"><span>File List</span></a></li>
|
62
|
-
<li><a href="globals.html"><span>File Members</span></a></li>
|
63
|
-
</ul>
|
64
|
-
</div>
|
65
|
-
</div>
|
66
|
-
<div class="contents">
|
67
|
-
<h1>Math.hpp File Reference</h1>Contains simple math functionality.
|
68
|
-
<a href="#_details">More...</a>
|
69
|
-
<p>
|
70
|
-
|
71
|
-
<p>
|
72
|
-
<a href="_math_8hpp_source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
|
73
|
-
<tr><td></td></tr>
|
74
|
-
<tr><td colspan="2"><br><h2>Namespaces</h2></td></tr>
|
75
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">namespace </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html">Gosu</a></td></tr>
|
76
|
-
|
77
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">The library's main namespace. <br></td></tr>
|
78
|
-
|
79
|
-
<p>
|
80
|
-
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
|
81
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#dc5f4941f3a17c6c5233d6c7a628cc68">Gosu::trunc</a> (double value)</td></tr>
|
82
|
-
|
83
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Truncates the fractional part of a real value. <a href="#dc5f4941f3a17c6c5233d6c7a628cc68"></a><br></td></tr>
|
84
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">long </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#496868cf52cf159cf98a00888c4fbc1c">Gosu::round</a> (double value)</td></tr>
|
85
|
-
|
86
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Rounds a real value towards the next integer. <a href="#496868cf52cf159cf98a00888c4fbc1c"></a><br></td></tr>
|
87
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#6c855080566f7f1b1967c90805249dda">Gosu::random</a> (double min, double max)</td></tr>
|
88
|
-
|
89
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a real value between min (inclusive) and max (exclusive). <a href="#6c855080566f7f1b1967c90805249dda"></a><br></td></tr>
|
90
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#2f8e80b399a0c5ba42667f22e7f2ba2f">Gosu::gosuToRadians</a> (double angle)</td></tr>
|
91
|
-
|
92
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Translates between Gosu's angle system (where 0� is at the top) and radians (where 0 is at the right). <a href="#2f8e80b399a0c5ba42667f22e7f2ba2f"></a><br></td></tr>
|
93
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#a853d9351f1568d0a949b2b7717e1e6a">Gosu::radiansToGosu</a> (double angle)</td></tr>
|
94
|
-
|
95
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Translates between Gosu's angle system (where 0� is at the top) and radians (where 0 is at the right). <a href="#a853d9351f1568d0a949b2b7717e1e6a"></a><br></td></tr>
|
96
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#dbafc76f69ec3bd403f68f50dbc6d5e4">Gosu::degreesToRadians</a> (double angle)</td></tr>
|
97
|
-
|
98
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Translates between degrees (used by <a class="el" href="namespace_gosu.html" title="The library's main namespace.">Gosu</a>) and radians, i.e. <a href="#dbafc76f69ec3bd403f68f50dbc6d5e4"></a><br></td></tr>
|
99
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#90706a5c3dc1016b5397db75ab15e678">Gosu::radiansToDegrees</a> (double angle)</td></tr>
|
100
|
-
|
101
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Translates between degrees (used by <a class="el" href="namespace_gosu.html" title="The library's main namespace.">Gosu</a>) and radians, i.e. <a href="#90706a5c3dc1016b5397db75ab15e678"></a><br></td></tr>
|
102
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#e61d02831aa7026e96f1e53a358609b2">Gosu::offsetX</a> (double angle, double radius)</td></tr>
|
103
|
-
|
104
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the horizontal distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle. <a href="#e61d02831aa7026e96f1e53a358609b2"></a><br></td></tr>
|
105
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#9e0845d8b2ed385cb4e8593e7a308a08">Gosu::offsetY</a> (double angle, double radius)</td></tr>
|
106
|
-
|
107
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the vertical distance between the origin and the point to which you would get if you moved radius pixels in the direction specified by angle. <a href="#9e0845d8b2ed385cb4e8593e7a308a08"></a><br></td></tr>
|
108
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7">Gosu::angle</a> (double fromX, double fromY, double toX, double toY, double def=0)</td></tr>
|
109
|
-
|
110
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards. <a href="#f7740dec821977a37ff26a90c2e85ac7"></a><br></td></tr>
|
111
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#36cfaba7c2038bfeabdd1672882704f4">Gosu::angleDiff</a> (double angle1, double angle2)</td></tr>
|
112
|
-
|
113
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the smallest angle that can be added to angle1 to get to angle2 (can be negative if counter-clockwise movement is shorter). <a href="#36cfaba7c2038bfeabdd1672882704f4"></a><br></td></tr>
|
114
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#c6f147ab90f7e343dd9d70cc8bf3a91b">Gosu::normalizeAngle</a> (double angle)</td></tr>
|
115
|
-
|
116
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Normalizes an angle to fit into the range [0; 360[. <a href="#c6f147ab90f7e343dd9d70cc8bf3a91b"></a><br></td></tr>
|
117
|
-
<tr><td class="memTemplParams" nowrap colspan="2">template<typename T > </td></tr>
|
118
|
-
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc">Gosu::square</a> (T value)</td></tr>
|
119
|
-
|
120
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns value * value. <a href="#cac78b0775d1b551f4adf9ae76efb4cc"></a><br></td></tr>
|
121
|
-
<tr><td class="memTemplParams" nowrap colspan="2">template<typename T > </td></tr>
|
122
|
-
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f">Gosu::clamp</a> (T value, T min, T max)</td></tr>
|
123
|
-
|
124
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns min if value is smaller than min, max if value is larger than max and value otherwise. <a href="#3359d78e0ca7fa5d163dce7b99f72e9f"></a><br></td></tr>
|
125
|
-
<tr><td class="memTemplParams" nowrap colspan="2">template<typename T > </td></tr>
|
126
|
-
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#5b35114c04a3f01d54c2e052d350b61f">Gosu::boundBy</a> (T value, T min, T max)</td></tr>
|
127
|
-
|
128
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#58015f2ee3527184171d3d99176fd360">Gosu::distanceSqr</a> (double x1, double y1, double x2, double y2)</td></tr>
|
129
|
-
|
130
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the square of the distance between two points. <a href="#58015f2ee3527184171d3d99176fd360"></a><br></td></tr>
|
131
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#a06a29a8aefa1be625072b02e2d825bd">Gosu::distance</a> (double x1, double y1, double x2, double y2)</td></tr>
|
132
|
-
|
133
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the distance between two points. <a href="#a06a29a8aefa1be625072b02e2d825bd"></a><br></td></tr>
|
134
|
-
<tr><td class="memTemplParams" nowrap colspan="2">template<typename T > </td></tr>
|
135
|
-
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">T </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#29515f6c9be056e9ca5f672dec154847">Gosu::interpolate</a> (T a, T b, double weight=0.5)</td></tr>
|
136
|
-
|
137
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Interpolates a value between a and b, weight being the bias towards the second value. <a href="#29515f6c9be056e9ca5f672dec154847"></a><br></td></tr>
|
138
|
-
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
|
139
|
-
<tr><td class="memItemLeft" nowrap align="right" valign="top">const double </td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01">Gosu::pi</a> = 3.1415926536</td></tr>
|
140
|
-
|
141
|
-
<tr><td class="mdescLeft"> </td><td class="mdescRight">Pi. <a href="#cc7336a0eba36412dab0e991fb3faf01"></a><br></td></tr>
|
142
|
-
</table>
|
143
|
-
<hr><h2>Detailed Description</h2>
|
144
|
-
Contains simple math functionality.
|
145
|
-
<p>
|
146
|
-
|
147
|
-
<p>Definition in file <a class="el" href="_math_8hpp_source.html">Math.hpp</a>.</p>
|
148
|
-
</div>
|
149
|
-
<p class="footer">Documentation not clear enough? Please go to one of the places listed on <a href="http://www.libgosu.org/">http://www.libgosu.org/</a> and leave feedback. Thanks!</p>
|
150
|
-
</div>
|
151
|
-
</body>
|
152
|
-
</html>
|
@@ -1,157 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<title>Gosu C++ Reference</title>
|
4
|
-
<link rel="stylesheet" href="cpp.css" type="text/css" charset="utf-8">
|
5
|
-
</head>
|
6
|
-
<body>
|
7
|
-
<div class="everything">
|
8
|
-
<!-- Generated by Doxygen 1.5.9 -->
|
9
|
-
<script type="text/javascript">
|
10
|
-
<!--
|
11
|
-
function changeDisplayState (e){
|
12
|
-
var num=this.id.replace(/[^[0-9]/g,'');
|
13
|
-
var button=this.firstChild;
|
14
|
-
var sectionDiv=document.getElementById('dynsection'+num);
|
15
|
-
if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
|
16
|
-
sectionDiv.style.display='block';
|
17
|
-
button.src='open.gif';
|
18
|
-
}else{
|
19
|
-
sectionDiv.style.display='none';
|
20
|
-
button.src='closed.gif';
|
21
|
-
}
|
22
|
-
}
|
23
|
-
function initDynSections(){
|
24
|
-
var divs=document.getElementsByTagName('div');
|
25
|
-
var sectionCounter=1;
|
26
|
-
for(var i=0;i<divs.length-1;i++){
|
27
|
-
if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
|
28
|
-
var header=divs[i];
|
29
|
-
var section=divs[i+1];
|
30
|
-
var button=header.firstChild;
|
31
|
-
if (button!='IMG'){
|
32
|
-
divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
|
33
|
-
button=document.createElement('img');
|
34
|
-
divs[i].insertBefore(button,divs[i].firstChild);
|
35
|
-
}
|
36
|
-
header.style.cursor='pointer';
|
37
|
-
header.onclick=changeDisplayState;
|
38
|
-
header.id='dynheader'+sectionCounter;
|
39
|
-
button.src='closed.gif';
|
40
|
-
section.id='dynsection'+sectionCounter;
|
41
|
-
section.style.display='none';
|
42
|
-
section.style.marginLeft='14px';
|
43
|
-
sectionCounter++;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
}
|
47
|
-
window.onload = initDynSections;
|
48
|
-
-->
|
49
|
-
</script>
|
50
|
-
<div class="navigation" id="top">
|
51
|
-
<div class="tabs">
|
52
|
-
<ul>
|
53
|
-
<li><a href="index.html"><span>Main Page</span></a></li>
|
54
|
-
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
55
|
-
<li><a href="annotated.html"><span>Classes</span></a></li>
|
56
|
-
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
57
|
-
</ul>
|
58
|
-
</div>
|
59
|
-
<div class="tabs">
|
60
|
-
<ul>
|
61
|
-
<li><a href="files.html"><span>File List</span></a></li>
|
62
|
-
<li><a href="globals.html"><span>File Members</span></a></li>
|
63
|
-
</ul>
|
64
|
-
</div>
|
65
|
-
<h1>Math.hpp</h1><a href="_math_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
|
66
|
-
<a name="l00002"></a>00002
|
67
|
-
<a name="l00003"></a>00003
|
68
|
-
<a name="l00004"></a>00004 <span class="preprocessor">#ifndef GOSU_MATH_HPP</span>
|
69
|
-
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="preprocessor">#define GOSU_MATH_HPP</span>
|
70
|
-
<a name="l00006"></a>00006 <span class="preprocessor"></span>
|
71
|
-
<a name="l00007"></a>00007 <span class="keyword">namespace </span>Gosu
|
72
|
-
<a name="l00008"></a>00008 {
|
73
|
-
<a name="l00010"></a><a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01">00010</a> <span class="keyword">const</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> = 3.1415926536;
|
74
|
-
<a name="l00011"></a>00011
|
75
|
-
<a name="l00014"></a><a class="code" href="namespace_gosu.html#dc5f4941f3a17c6c5233d6c7a628cc68">00014</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespace_gosu.html#dc5f4941f3a17c6c5233d6c7a628cc68" title="Truncates the fractional part of a real value.">trunc</a>(<span class="keywordtype">double</span> value)
|
76
|
-
<a name="l00015"></a>00015 {
|
77
|
-
<a name="l00016"></a>00016 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value);
|
78
|
-
<a name="l00017"></a>00017 }
|
79
|
-
<a name="l00018"></a>00018
|
80
|
-
<a name="l00020"></a><a class="code" href="namespace_gosu.html#496868cf52cf159cf98a00888c4fbc1c">00020</a> <span class="keyword">inline</span> <span class="keywordtype">long</span> <a class="code" href="namespace_gosu.html#496868cf52cf159cf98a00888c4fbc1c" title="Rounds a real value towards the next integer.">round</a>(<span class="keywordtype">double</span> value)
|
81
|
-
<a name="l00021"></a>00021 {
|
82
|
-
<a name="l00022"></a>00022 <span class="keywordflow">if</span> (value >= 0)
|
83
|
-
<a name="l00023"></a>00023 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value + 0.5);
|
84
|
-
<a name="l00024"></a>00024 <span class="keywordflow">else</span>
|
85
|
-
<a name="l00025"></a>00025 <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">long</span><span class="keyword">></span>(value - 0.5);
|
86
|
-
<a name="l00026"></a>00026 }
|
87
|
-
<a name="l00027"></a>00027
|
88
|
-
<a name="l00030"></a>00030 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#6c855080566f7f1b1967c90805249dda" title="Returns a real value between min (inclusive) and max (exclusive).">random</a>(<span class="keywordtype">double</span> min, <span class="keywordtype">double</span> max);
|
89
|
-
<a name="l00031"></a>00031
|
90
|
-
<a name="l00034"></a><a class="code" href="namespace_gosu.html#2f8e80b399a0c5ba42667f22e7f2ba2f">00034</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#2f8e80b399a0c5ba42667f22e7f2ba2f" title="Translates between Gosu&#39;s angle system (where 0� is at the top) and radians (where...">gosuToRadians</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
91
|
-
<a name="l00035"></a>00035 {
|
92
|
-
<a name="l00036"></a>00036 <span class="keywordflow">return</span> (angle - 90) * <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> / 180;
|
93
|
-
<a name="l00037"></a>00037 }
|
94
|
-
<a name="l00040"></a><a class="code" href="namespace_gosu.html#a853d9351f1568d0a949b2b7717e1e6a">00040</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#a853d9351f1568d0a949b2b7717e1e6a" title="Translates between Gosu&#39;s angle system (where 0� is at the top) and radians (where...">radiansToGosu</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
95
|
-
<a name="l00041"></a>00041 {
|
96
|
-
<a name="l00042"></a>00042 <span class="keywordflow">return</span> angle * 180 / <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> + 90;
|
97
|
-
<a name="l00043"></a>00043 }
|
98
|
-
<a name="l00044"></a>00044
|
99
|
-
<a name="l00047"></a><a class="code" href="namespace_gosu.html#dbafc76f69ec3bd403f68f50dbc6d5e4">00047</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#dbafc76f69ec3bd403f68f50dbc6d5e4" title="Translates between degrees (used by Gosu) and radians, i.e.">degreesToRadians</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
100
|
-
<a name="l00048"></a>00048 {
|
101
|
-
<a name="l00049"></a>00049 <span class="keywordflow">return</span> angle * <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a> / 180;
|
102
|
-
<a name="l00050"></a>00050 }
|
103
|
-
<a name="l00053"></a><a class="code" href="namespace_gosu.html#90706a5c3dc1016b5397db75ab15e678">00053</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#90706a5c3dc1016b5397db75ab15e678" title="Translates between degrees (used by Gosu) and radians, i.e.">radiansToDegrees</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>)
|
104
|
-
<a name="l00054"></a>00054 {
|
105
|
-
<a name="l00055"></a>00055 <span class="keywordflow">return</span> angle * 180 / <a class="code" href="namespace_gosu.html#cc7336a0eba36412dab0e991fb3faf01" title="Pi.">pi</a>;
|
106
|
-
<a name="l00056"></a>00056 }
|
107
|
-
<a name="l00057"></a>00057
|
108
|
-
<a name="l00062"></a>00062 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#e61d02831aa7026e96f1e53a358609b2" title="Returns the horizontal distance between the origin and the point to which you would...">offsetX</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>, <span class="keywordtype">double</span> radius);
|
109
|
-
<a name="l00067"></a>00067 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#9e0845d8b2ed385cb4e8593e7a308a08" title="Returns the vertical distance between the origin and the point to which you would...">offsetY</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>, <span class="keywordtype">double</span> radius);
|
110
|
-
<a name="l00070"></a>00070 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>(<span class="keywordtype">double</span> fromX, <span class="keywordtype">double</span> fromY, <span class="keywordtype">double</span> toX, <span class="keywordtype">double</span> toY,
|
111
|
-
<a name="l00071"></a>00071 <span class="keywordtype">double</span> def = 0);
|
112
|
-
<a name="l00074"></a>00074 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#36cfaba7c2038bfeabdd1672882704f4" title="Returns the smallest angle that can be added to angle1 to get to angle2 (can be negative...">angleDiff</a>(<span class="keywordtype">double</span> angle1, <span class="keywordtype">double</span> angle2);
|
113
|
-
<a name="l00076"></a>00076 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#c6f147ab90f7e343dd9d70cc8bf3a91b" title="Normalizes an angle to fit into the range [0; 360[.">normalizeAngle</a>(<span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#f7740dec821977a37ff26a90c2e85ac7" title="Returns the angle from point 1 to point 2 in degrees, where 0.0 means upwards.">angle</a>);
|
114
|
-
<a name="l00077"></a>00077
|
115
|
-
<a name="l00079"></a>00079 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
116
|
-
<a name="l00080"></a><a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc">00080</a> T <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(T value)
|
117
|
-
<a name="l00081"></a>00081 {
|
118
|
-
<a name="l00082"></a>00082 <span class="keywordflow">return</span> value * value;
|
119
|
-
<a name="l00083"></a>00083 }
|
120
|
-
<a name="l00084"></a>00084
|
121
|
-
<a name="l00087"></a>00087 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
122
|
-
<a name="l00088"></a><a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f">00088</a> T <a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f" title="Returns min if value is smaller than min, max if value is larger than max and value...">clamp</a>(T value, T min, T max)
|
123
|
-
<a name="l00089"></a>00089 {
|
124
|
-
<a name="l00090"></a>00090 <span class="keywordflow">if</span> (value < min)
|
125
|
-
<a name="l00091"></a>00091 <span class="keywordflow">return</span> min;
|
126
|
-
<a name="l00092"></a>00092 <span class="keywordflow">if</span> (value > max)
|
127
|
-
<a name="l00093"></a>00093 <span class="keywordflow">return</span> max;
|
128
|
-
<a name="l00094"></a>00094 <span class="keywordflow">return</span> value;
|
129
|
-
<a name="l00095"></a>00095 }
|
130
|
-
<a name="l00096"></a>00096
|
131
|
-
<a name="l00097"></a>00097 <span class="comment">// Backward compatibility with 0.7.x</span>
|
132
|
-
<a name="l00098"></a>00098 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
133
|
-
<a name="l00099"></a><a class="code" href="namespace_gosu.html#5b35114c04a3f01d54c2e052d350b61f">00099</a> T <a class="code" href="namespace_gosu.html#5b35114c04a3f01d54c2e052d350b61f">boundBy</a>(T value, T min, T max)
|
134
|
-
<a name="l00100"></a>00100 {
|
135
|
-
<a name="l00101"></a>00101 <span class="keywordflow">return</span> <a class="code" href="namespace_gosu.html#3359d78e0ca7fa5d163dce7b99f72e9f" title="Returns min if value is smaller than min, max if value is larger than max and value...">clamp</a>(value, min, max);
|
136
|
-
<a name="l00102"></a>00102 }
|
137
|
-
<a name="l00103"></a>00103
|
138
|
-
<a name="l00105"></a><a class="code" href="namespace_gosu.html#58015f2ee3527184171d3d99176fd360">00105</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#58015f2ee3527184171d3d99176fd360" title="Returns the square of the distance between two points.">distanceSqr</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y2)
|
139
|
-
<a name="l00106"></a>00106 {
|
140
|
-
<a name="l00107"></a>00107 <span class="keywordflow">return</span> <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(x1 - x2) + <a class="code" href="namespace_gosu.html#cac78b0775d1b551f4adf9ae76efb4cc" title="Returns value * value.">square</a>(y1 - y2);
|
141
|
-
<a name="l00108"></a>00108 }
|
142
|
-
<a name="l00109"></a>00109
|
143
|
-
<a name="l00111"></a>00111 <span class="keywordtype">double</span> <a class="code" href="namespace_gosu.html#a06a29a8aefa1be625072b02e2d825bd" title="Returns the distance between two points.">distance</a>(<span class="keywordtype">double</span> x1, <span class="keywordtype">double</span> y1, <span class="keywordtype">double</span> x2, <span class="keywordtype">double</span> y2);
|
144
|
-
<a name="l00112"></a>00112
|
145
|
-
<a name="l00115"></a>00115 <span class="keyword">template</span><<span class="keyword">typename</span> T>
|
146
|
-
<a name="l00116"></a><a class="code" href="namespace_gosu.html#29515f6c9be056e9ca5f672dec154847">00116</a> T <a class="code" href="namespace_gosu.html#55c2cfa7575386d8eb6a8dc615e905ae" title="Interpolates linearly between two colors, with a given weight towards the second...">interpolate</a>(T a, T b, <span class="keywordtype">double</span> weight = 0.5)
|
147
|
-
<a name="l00117"></a>00117 {
|
148
|
-
<a name="l00118"></a>00118 <span class="keywordflow">return</span> a * (1.0 - weight) + b * weight;
|
149
|
-
<a name="l00119"></a>00119 }
|
150
|
-
<a name="l00120"></a>00120 }
|
151
|
-
<a name="l00121"></a>00121
|
152
|
-
<a name="l00122"></a>00122 <span class="preprocessor">#endif</span>
|
153
|
-
</pre></div></div>
|
154
|
-
<p class="footer">Documentation not clear enough? Please go to one of the places listed on <a href="http://www.libgosu.org/">http://www.libgosu.org/</a> and leave feedback. Thanks!</p>
|
155
|
-
</div>
|
156
|
-
</body>
|
157
|
-
</html>
|