You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(531) |
Nov
(322) |
Dec
(620) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(672) |
Feb
(420) |
Mar
(614) |
Apr
(560) |
May
(315) |
Jun
(257) |
Jul
(222) |
Aug
(328) |
Sep
(46) |
Oct
(203) |
Nov
(297) |
Dec
(196) |
2003 |
Jan
(216) |
Feb
(471) |
Mar
(234) |
Apr
(308) |
May
(280) |
Jun
(232) |
Jul
(155) |
Aug
(412) |
Sep
(906) |
Oct
(440) |
Nov
(269) |
Dec
(415) |
2004 |
Jan
(525) |
Feb
(320) |
Mar
(113) |
Apr
(205) |
May
(217) |
Jun
(43) |
Jul
(29) |
Aug
|
Sep
(80) |
Oct
(74) |
Nov
|
Dec
(13) |
2005 |
Jan
(10) |
Feb
(44) |
Mar
(57) |
Apr
(42) |
May
(51) |
Jun
(41) |
Jul
(65) |
Aug
(31) |
Sep
(51) |
Oct
(79) |
Nov
(94) |
Dec
(113) |
2006 |
Jan
(47) |
Feb
(40) |
Mar
(29) |
Apr
(41) |
May
(33) |
Jun
(51) |
Jul
(28) |
Aug
(56) |
Sep
(45) |
Oct
(7) |
Nov
(3) |
Dec
(1) |
From: Changes to t. C. r. <cla...@li...> - 2006-09-06 07:21:06
|
Dear Webmaster, My name is Oscar and I just wanted to let you know that we have already placed a link to your site on the following webpage: http://www.hanusoftware.com/resources/game-software-development.html Your site details are As Follows: <p><a href="http://www.clanlib.org/" target="_blank"class="l2">ClanLib </a> - A multi-platform game development library. Currently is works on Linux and Win32. Kindly link back to our site with the following details: Title: .Net Application Development Desc: We are an offshore software development company in India offering a wide range of services including palm software and .net application development. URL: http://www.hanusoftware.com Or Below is Our Link Code: <p><a href="http://www.hanusoftware.com" target="_blank">.Net Application Development</a> - We are an offshore software development company in India offering a wide range of services including palm software and .net application development. Once you add our link, your link details will be permanent on our site. Thanks -- Best regards, Oscar Link Manager eBrandz.com, Search Engine Marketing Company Email:- osc...@ho... Visit us at http://www.ebrandz.com _________________________________________________________________ Spice up your IM conversations. New, colorful and animated emoticons. Get chatting! http://server1.msn.co.in/SP05/emoticons/ |
From: Changes to t. C. r. <cla...@li...> - 2006-09-05 10:20:17
|
Author: harry Date: 2006-08-31 16:37:00 +0200 (Thu, 31 Aug 2006) New Revision: 1057 Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp Log: - Removed my earlier try at fixing get_text_size() Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 14:06:40 UTC (rev 1056) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 14:37:00 UTC (rev 1057) @@ -932,16 +932,11 @@ GetTextMetrics(hdc, &tm); size.cx -= tm.tmOverhang; - POINT point; - point.x = size.cx; - point.y = size.cy; - LPtoDP(hdc, &point, 1); - if (font.get_provider()) SelectObject(hdc, old_font); SetMapMode(hdc, old_mode); - return CL_Sized(point.x, point.y); + return CL_Sized(size.cx, size.cy); } ///////////////////////////////////////////////////////////////////////////// |
From: Changes to t. C. r. <cla...@li...> - 2006-09-05 10:20:15
|
Author: mbn Date: 2006-08-31 16:06:40 +0200 (Thu, 31 Aug 2006) New Revision: 1056 Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp Log: - Oops, forgot to click save before committing. :) Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 14:00:07 UTC (rev 1055) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 14:06:40 UTC (rev 1056) @@ -848,13 +848,8 @@ } draw_pixels( -<<<<<<< .mine - (int) (x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x), - (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), -======= - x + pos_x + glyph_metrics.gmptGlyphOrigin.x, + x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x, y + pos_y - glyph_metrics.gmptGlyphOrigin.y, ->>>>>>> .r1054 1.0, 1.0, pb); @@ -907,13 +902,8 @@ } draw_pixels( -<<<<<<< .mine - (int) (x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x), - (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), -======= - x + pos_x + glyph_metrics.gmptGlyphOrigin.x, + x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x, y + pos_y - glyph_metrics.gmptGlyphOrigin.y, ->>>>>>> .r1054 1.0, 1.0, pb); |
From: Changes to t. C. r. <cla...@li...> - 2006-09-05 10:20:14
|
Author: mbn Date: 2006-08-31 16:00:07 +0200 (Thu, 31 Aug 2006) New Revision: 1055 Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp Development/ClanLib-0.9/Tests/Display/Font1/ Log: - Changed cursor advancement calculations when drawing text. Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 12:42:23 UTC (rev 1054) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 14:00:07 UTC (rev 1055) @@ -771,13 +771,31 @@ if (metrics_result == FALSE) return; + BOOL truetype_font = ((text_metrics.tmPitchAndFamily & TMPF_TRUETYPE) == TMPF_TRUETYPE); + CL_DataBuffer glyph_buffer; int pos_x = 0; int pos_y = 0; for (CL_String::size_type p = 0; p < text.length(); p++) { - if (text_metrics.tmHeight > 20) // antialias font + ABC abc; + if (truetype_font) { + BOOL result = GetCharABCWidths(hdc, text[p], text[p], &abc); + if (result == FALSE) + continue; + } + else + { + INT width; + BOOL result = GetCharWidth32(hdc, text[p], text[p], &width); + abc.abcA = 0; + abc.abcB = width; + abc.abcC = text_metrics.tmOverhang; + } + + if (truetype_font && text_metrics.tmHeight > 20) // anti-alias font + { GLYPHMETRICS glyph_metrics; MAT2 mat2; memset(&mat2, 0, sizeof(MAT2)); @@ -786,9 +804,7 @@ DWORD buffer_size = GetGlyphOutline(hdc, text[p], GGO_GRAY4_BITMAP, &glyph_metrics, 0, 0, &mat2); if (buffer_size == GDI_ERROR) { - ABC abc; - if (GetCharABCWidths(hdc, text[p], text[p], &abc)) - pos_x += abc.abcA + abc.abcB + abc.abcC; + pos_x += abc.abcA + abc.abcB + abc.abcC; continue; } @@ -802,9 +818,7 @@ DWORD result = GetGlyphOutline(hdc, text[p], GGO_GRAY4_BITMAP, &glyph_metrics, glyph_buffer.get_size(), glyph_buffer.get_data(), &mat2); if (buffer_size == GDI_ERROR) { - ABC abc; - if (GetCharABCWidths(hdc, text[p], text[p], &abc)) - pos_x += abc.abcA + abc.abcB + abc.abcC; + pos_x += abc.abcA + abc.abcB + abc.abcC; continue; } @@ -834,12 +848,17 @@ } draw_pixels( +<<<<<<< .mine + (int) (x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x), + (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), +======= x + pos_x + glyph_metrics.gmptGlyphOrigin.x, y + pos_y - glyph_metrics.gmptGlyphOrigin.y, +>>>>>>> .r1054 1.0, 1.0, pb); - pos_x += glyph_metrics.gmCellIncX; - pos_y += glyph_metrics.gmCellIncY; + + pos_x += abc.abcA + abc.abcB + abc.abcC; } else { @@ -851,9 +870,7 @@ DWORD buffer_size = GetGlyphOutline(hdc, text[p], GGO_BITMAP, &glyph_metrics, 0, 0, &mat2); if (buffer_size == GDI_ERROR) { - ABC abc; - if (GetCharABCWidths(hdc, text[p], text[p], &abc)) - pos_x += abc.abcA + abc.abcB + abc.abcC; + pos_x += abc.abcA + abc.abcB + abc.abcC; continue; } @@ -867,9 +884,7 @@ DWORD result = GetGlyphOutline(hdc, text[p], GGO_BITMAP, &glyph_metrics, glyph_buffer.get_size(), glyph_buffer.get_data(), &mat2); if (buffer_size == GDI_ERROR) { - ABC abc; - if (GetCharABCWidths(hdc, text[p], text[p], &abc)) - pos_x += abc.abcA + abc.abcB + abc.abcC; + pos_x += abc.abcA + abc.abcB + abc.abcC; continue; } @@ -892,12 +907,17 @@ } draw_pixels( +<<<<<<< .mine + (int) (x + pos_x + abc.abcA + glyph_metrics.gmptGlyphOrigin.x), + (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), +======= x + pos_x + glyph_metrics.gmptGlyphOrigin.x, y + pos_y - glyph_metrics.gmptGlyphOrigin.y, +>>>>>>> .r1054 1.0, 1.0, pb); - pos_x += glyph_metrics.gmCellIncX; - pos_y += glyph_metrics.gmCellIncY; + + pos_x += abc.abcA + abc.abcB + abc.abcC; } } Property changes on: Development/ClanLib-0.9/Tests/Display/Font1 ___________________________________________________________________ Name: svn:ignore + debug |
From: Changes to t. C. r. <cla...@li...> - 2006-09-05 10:20:13
|
Author: harry Date: 2006-08-31 14:42:23 +0200 (Thu, 31 Aug 2006) New Revision: 1054 Added: Development/ClanLib-0.9/Tests/GUI/Images/lineedit_hot.png Development/ClanLib-0.9/Tests/GUI/Images/lineedit_normal.png Development/ClanLib-0.9/Tests/GUI/LineEdit1/ Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.sln Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.vcproj Development/ClanLib-0.9/Tests/GUI/LineEdit1/resources.xml Development/ClanLib-0.9/Tests/GUI/LineEdit1/test.cpp Development/ClanLib-0.9/Tests/GUI/LineEdit1/theme.css Log: - Added LineEdit test and resources. Added: Development/ClanLib-0.9/Tests/GUI/Images/lineedit_hot.png =================================================================== (Binary files differ) Property changes on: Development/ClanLib-0.9/Tests/GUI/Images/lineedit_hot.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: Development/ClanLib-0.9/Tests/GUI/Images/lineedit_normal.png =================================================================== (Binary files differ) Property changes on: Development/ClanLib-0.9/Tests/GUI/Images/lineedit_normal.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Property changes on: Development/ClanLib-0.9/Tests/GUI/LineEdit1 ___________________________________________________________________ Name: svn:ignore + LineEdit1-vc71.ncb *.suo Added: Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.sln =================================================================== --- Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.sln 2006-08-31 12:34:49 UTC (rev 1053) +++ Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.sln 2006-08-31 12:42:23 UTC (rev 1054) @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LineEdit1-vc71", "LineEdit1-vc71.vcproj", "{5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Debug.ActiveCfg = Debug|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Debug.Build.0 = Debug|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Release.ActiveCfg = Release|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal Added: Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.vcproj =================================================================== --- Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.vcproj 2006-08-31 12:34:49 UTC (rev 1053) +++ Development/ClanLib-0.9/Tests/GUI/LineEdit1/LineEdit1-vc71.vcproj 2006-08-31 12:42:23 UTC (rev 1054) @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="LineEdit1-vc71" + ProjectGUID="{5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/CheckBox1.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/CheckBox1.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="0" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/CheckBox1.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\resources.xml"> + </File> + <File + RelativePath=".\test.cpp"> + </File> + <File + RelativePath=".\theme.css"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: Development/ClanLib-0.9/Tests/GUI/LineEdit1/resources.xml =================================================================== --- Development/ClanLib-0.9/Tests/GUI/LineEdit1/resources.xml 2006-08-31 12:34:49 UTC (rev 1053) +++ Development/ClanLib-0.9/Tests/GUI/LineEdit1/resources.xml 2006-08-31 12:42:23 UTC (rev 1054) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<resources> + <sprite name="LineEditDisabled"> + <image file="..\Images\lineedit_disabled.png" /> + </sprite> + <sprite name="LineEditHot"> + <image file="..\Images\lineedit_hot.png" /> + </sprite> + <sprite name="LineEditNormal"> + <image file="..\Images\lineedit_normal.png" /> + </sprite> +</resources> Added: Development/ClanLib-0.9/Tests/GUI/LineEdit1/test.cpp =================================================================== --- Development/ClanLib-0.9/Tests/GUI/LineEdit1/test.cpp 2006-08-31 12:34:49 UTC (rev 1053) +++ Development/ClanLib-0.9/Tests/GUI/LineEdit1/test.cpp 2006-08-31 12:42:23 UTC (rev 1054) @@ -0,0 +1,64 @@ +#include <ClanLib/core.h> +#include <ClanLib/gui.h> +#include <ClanLib/application.h> +#include <ClanLib/display.h> +#include <ClanLib/gl.h> + +class App : public CL_ClanApplication +{ + int main(int argc, char** argv) + { + CL_ConsoleWindow console("Console"); + + try + { + CL_SetupCore setup_core; + CL_SetupDisplay setup_display; + CL_SetupGL setup_gl; + CL_OpenGLTarget display_target; + + CL_ResourceManager resources; + resources.load("resources.xml"); + + CL_GUIManager gui; + gui.set_resources(resources); + + CL_GUIThemeDefault theme; + theme.set_resources(resources); + + gui.set_theme(&theme); + + CL_File file("theme.css", CL_File::open_existing); + CL_CSSDocument css; + css.load(file); + file.close(); + gui.set_css_document(css); + + CL_GUIComponentDescription desc; + desc.set_property("window-title", "GUI2 Test"); + CL_Window root(CL_Rect(200,200,600,600), desc, &gui); + root.func_close().set(this, &App::on_close, &root); + + CL_GUIComponentDescription desc_xp; + desc_xp.set_class_name("xp"); + + CL_LineEdit lineedit1(CL_Rect(20, 20, 200, 50), desc_xp, &root); + lineedit1.set_text("LineEdit 1"); +// lineedit1.set_text("L"); + + gui.exec(); + } + catch (CL_Exception e) + { + CL_Console::write_line(e.message); + console.display_close_message(); + } + + return 0; + } + + void on_close(CL_Window *win) + { + win->exit_with_code(0); + } +} app; Added: Development/ClanLib-0.9/Tests/GUI/LineEdit1/theme.css =================================================================== --- Development/ClanLib-0.9/Tests/GUI/LineEdit1/theme.css 2006-08-31 12:34:49 UTC (rev 1053) +++ Development/ClanLib-0.9/Tests/GUI/LineEdit1/theme.css 2006-08-31 12:42:23 UTC (rev 1054) @@ -0,0 +1,61 @@ +window +{ + background-color: #e0dfe3; +} + +lineedit.xp +{ + bg-image-sizing-left:8; + bg-image-sizing-right:8; + bg-image-sizing-top:9; + bg-image-sizing-bottom:9; + bg-image-sizing:stretch; + padding-left:5; +} + +lineedit.xp:normal +{ + bg-image:LineEditNormal; +} + +lineedit.xp:hot +{ + bg-image:LineEditHot; +} + +lineedit.xp:disabled +{ + bg-image:LineEditDisabled; +} + +lineedit.xp cursor +{ + +} + + +lineedit.possible_css_values +{ + margin-top:0; + margin-left:0; + margin-right:0; + margin-bottom:0; + border-top:0; + border-left:0; + border-right:0; + border-bottom:0; + border-color:Aqua; + padding-top:0; + padding-left:0; + padding-right:0; + padding-bottom:0; + bg-color:Lime; + bg-image:resource_sprite_name; + bg-image-sizing:default | stretch | repeat | repeat-x | repeat-y; + bg-image-sizing-top:0; + bg-image-sizing-left:0; + bg-image-sizing-right:0; + bg-image-sizing-bottom:0; + text-color:#000000; + text-font:resource_font_name; +} |
From: Changes to t. C. r. <cla...@li...> - 2006-09-05 10:20:11
|
Author: harry Date: 2006-08-31 14:34:49 +0200 (Thu, 31 Aug 2006) New Revision: 1053 Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h Development/ClanLib-0.9/Sources/Display/font.cpp Development/ClanLib-0.9/Sources/Display/graphic_context.cpp Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h Development/ClanLib-0.9/Sources/GUI/Components/lineedit.cpp Log: - Start of a LineEdit component. Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-31 12:34:49 UTC (rev 1053) @@ -65,6 +65,9 @@ //! Attributes: public: + //: Returns the current font. + virtual CL_Font get_font() const = 0; + //: Returns the amount of texture units available. virtual int get_texture_unit_count() = 0; Modified: Development/ClanLib-0.9/Sources/Display/font.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/font.cpp 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/Display/font.cpp 2006-08-31 12:34:49 UTC (rev 1053) @@ -85,6 +85,11 @@ fixed_pitch); } +CL_Font::CL_Font(const CL_Font ©) +{ + impl = copy.impl; +} + CL_Font::~CL_Font() { } Modified: Development/ClanLib-0.9/Sources/Display/graphic_context.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/graphic_context.cpp 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/Display/graphic_context.cpp 2006-08-31 12:34:49 UTC (rev 1053) @@ -97,7 +97,7 @@ CL_Font CL_GraphicContext::get_font() { - return CL_Font(); + return impl->provider->get_font(); } CL_FontMetrics CL_GraphicContext::get_font_metrics() Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-31 12:34:49 UTC (rev 1053) @@ -85,6 +85,11 @@ ///////////////////////////////////////////////////////////////////////////// // CL_OpenGLGraphicContextProvider Attributes: +CL_Font CL_OpenGLGraphicContextProvider::get_font() const +{ + return font; +} + int CL_OpenGLGraphicContextProvider::get_texture_unit_count() { return 0; @@ -912,10 +917,21 @@ old_font = SelectObject(hdc, ((CL_OpenGLFontProvider *)font.get_provider())->get_handle()); SIZE size; GetTextExtentPoint32(hdc, text.data(), text.length(), &size); + + TEXTMETRIC tm; + GetTextMetrics(hdc, &tm); + size.cx -= tm.tmOverhang; + + POINT point; + point.x = size.cx; + point.y = size.cy; + LPtoDP(hdc, &point, 1); + if (font.get_provider()) SelectObject(hdc, old_font); SetMapMode(hdc, old_mode); - return CL_Sized(size.cx, size.cy); + + return CL_Sized(point.x, point.y); } ///////////////////////////////////////////////////////////////////////////// Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h 2006-08-31 12:34:49 UTC (rev 1053) @@ -61,6 +61,8 @@ //! Attributes: public: + CL_Font get_font() const; + int get_texture_unit_count(); int get_light_count(); Modified: Development/ClanLib-0.9/Sources/GUI/Components/lineedit.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GUI/Components/lineedit.cpp 2006-08-21 19:53:33 UTC (rev 1052) +++ Development/ClanLib-0.9/Sources/GUI/Components/lineedit.cpp 2006-08-31 12:34:49 UTC (rev 1053) @@ -30,16 +30,36 @@ #include "GUI/precomp.h" #include "API/GUI/gui_component_parent.h" #include "API/GUI/gui_message.h" +#include "API/GUI/gui_message_input.h" #include "API/GUI/gui_theme_part.h" #include "API/GUI/gui_component_description.h" #include "API/GUI/Components/lineedit.h" +#include "API/Display/input_event.h" +#include "API/Display/keyboard.h" +#include "API/Display/keys.h" +#include "API/Display/font.h" +#include "API/Display/font_metrics.h" +#include "API/Display/draw.h" +#include "API/Core/Text/string_help.h" + ///////////////////////////////////////////////////////////////////////////// // CL_LineEdit_Impl Class: class CL_LineEdit_Impl { public: + CL_LineEdit_Impl() : + cursor_pos(0), + max_length(-1), + lowercase(false), + uppercase(false), + password_mode(false), + selection_start(0), + selection_length(0) + { + } + void on_process_message(const CL_GUIMessage &msg); void on_render(CL_GraphicContext &gc, const CL_Rect &update_rect); @@ -53,17 +73,55 @@ CL_Callback_v1<int> func_selection_changed; CL_Callback_v1<int> func_cursor_changed; + + CL_String text; + + CL_Font font; + + int cursor_pos; + + int max_length; + + bool lowercase; + + bool uppercase; + + bool password_mode; + + int selection_start; + + int selection_length; + + +private: + + void left(int count); + + void right(int count); + + void insert_text(int pos, const CL_StringRef &str); + + void backspace(); + + void del(); }; ///////////////////////////////////////////////////////////////////////////// // CL_LineEdit Construction: CL_LineEdit::CL_LineEdit(const CL_Rect &geometry, const CL_GUIComponentDescription &desc, CL_ComponentParent *parent) -: CL_GUIComponent(geometry, CL_GUIComponentDescription(desc, "lineedit"), parent), impl(new CL_LineEdit_Impl) +: CL_GUIComponent(geometry, CL_GUIComponentDescription(desc, "lineedit"), parent), + impl(new CL_LineEdit_Impl) { impl->lineedit = this; + impl->font = CL_Font(/*"MS Sans Serif"*/ "Microsoft Sans Serif", -12, 0, 0.0, 0.0, 0, false, false, false, false, get_gc()); + func_render().set(impl.get(), &CL_LineEdit_Impl::on_render); func_process_message().set(impl.get(), &CL_LineEdit_Impl::on_process_message); - func_render().set(impl.get(), &CL_LineEdit_Impl::on_render); + set_state("hot", false); + set_state("normal", true); + set_state("pressed", false); + set_state("defaulted", false); + set_state("disabled", false); } CL_LineEdit::~CL_LineEdit() @@ -105,7 +163,7 @@ CL_StringRef CL_LineEdit::get_text() const { - return CL_StringRef(); + return impl->text; } CL_StringRef CL_LineEdit::get_selection() const @@ -157,6 +215,8 @@ void CL_LineEdit::set_text(const CL_StringRef &text) { + impl->text = text; + impl->cursor_pos = impl->text.size(); } void CL_LineEdit::set_selection(int pos, int length) @@ -195,11 +255,120 @@ void CL_LineEdit_Impl::on_process_message(const CL_GUIMessage &msg) { + if (msg.get_type() == "input") + { + CL_GUIMessage_Input input_msg = msg; + CL_InputEvent e = input_msg.get_event(); + + if (e.device.get_type() == CL_Keyboard::get_device().get_type()) + { + if (e.type == CL_InputEvent::pressed || e.repeat_count > 1) + { + if (e.id == CL_KEY_LEFT) + { + left(1); + } + else if (e.id == CL_KEY_RIGHT) + { + right(1); + } + else if (e.id == CL_KEY_BACKSPACE) + { + backspace(); + } + else if (e.id == CL_KEY_DELETE) + { + del(); + } + else + { + insert_text(cursor_pos, e.str); + cursor_pos += e.str.size(); + } + } + } + + if (e.type == CL_InputEvent::pressed && e.id == CL_MOUSE_LEFT) + { + lineedit->invalidate_rect(); + } + else if (e.type == CL_InputEvent::released && e.id == CL_MOUSE_LEFT && lineedit->get_state("pressed")) + { + lineedit->invalidate_rect(); + } + } } void CL_LineEdit_Impl::on_render(CL_GraphicContext &gc, const CL_Rect &update_rect) { CL_GUIThemePart part_background(lineedit); + CL_Rect rect = lineedit->get_geometry(); + CL_Rect content_rect = part_background.get_content_box(rect); part_background.render_box(gc, rect, update_rect); + + CL_Font old_font = gc.get_font(); + gc.set_font(font); + CL_Sized text_size = gc.get_text_size(text); + + int padding_left = CL_StringHelp::text_to_int(lineedit->get_property("padding-left", "10")); + int padding_top = CL_StringHelp::text_to_int(lineedit->get_property("padding-top", "5")); + + gc.draw_text( + content_rect.left + padding_left, + content_rect.top + content_rect.get_height()/2 + text_size.height/2 - 2, + text, + CL_Colord::black); + gc.set_font(old_font); + +// if( lineedit->has_focus() ) + { + double cursor_x = content_rect.left + padding_left; + int substr_end = cursor_pos; + CL_Sized text_size = gc.get_text_size(text.substr(0, substr_end)); + cursor_x += text_size.width; + double cursor_y = content_rect.top + content_rect.get_height()/2.0 + text_size.height/2.0; + CL_Draw::line(cursor_x, cursor_y, cursor_x, cursor_y - text_size.height, CL_Colord::black, gc); + } } + +void CL_LineEdit_Impl::left(int count) +{ + cursor_pos -= count; + if (cursor_pos < 0) + cursor_pos = 0; + lineedit->invalidate_rect(); +} + +void CL_LineEdit_Impl::right(int count) +{ + cursor_pos += count; + if (cursor_pos > (int)text.size()) + cursor_pos = text.size(); + lineedit->invalidate_rect(); +} + +void CL_LineEdit_Impl::insert_text(int pos, const CL_StringRef &str) +{ + text.insert(pos, str); + lineedit->invalidate_rect(); +} + +void CL_LineEdit_Impl::backspace() +{ + if (cursor_pos > 0) + { + text.erase(cursor_pos-1); + cursor_pos -= 1; + lineedit->invalidate_rect(); + } +} + +void CL_LineEdit_Impl::del() +{ + if (cursor_pos < (int)text.size()) + { + text.erase(cursor_pos); + lineedit->invalidate_rect(); + } +} |
From: Changes to t. C. r. <cla...@li...> - 2006-08-21 19:54:34
|
Author: mbn Date: 2006-08-21 21:53:33 +0200 (Mon, 21 Aug 2006) New Revision: 1052 Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context.h Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h Development/ClanLib-0.9/Sources/Display/graphic_context.cpp Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h Log: - Changed ints into doubles for draw_pixels. Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/graphic_context.h 2006-08-21 19:39:25 UTC (rev 1051) +++ Development/ClanLib-0.9/Sources/API/Display/graphic_context.h 2006-08-21 19:53:33 UTC (rev 1052) @@ -187,9 +187,9 @@ void draw_primitives(CL_PrimitivesType type, const CL_PrimitivesArray &array); //: Draw pixel buffer on gc. - void draw_pixels(int x, int y, const CL_PixelBuffer &pixel_buffer); + void draw_pixels(double x, double y, const CL_PixelBuffer &pixel_buffer); - void draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer); + void draw_pixels(double x, double y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer); //: Print text on gc. void draw_text(double x, double y, const CL_StringRef &text, const CL_Colord &color = CL_Colord::white); Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-21 19:39:25 UTC (rev 1051) +++ Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-21 19:53:33 UTC (rev 1052) @@ -139,7 +139,7 @@ virtual void draw_primitives(CL_PrimitivesType type, const CL_PrimitivesArray &array) = 0; //: Draw pixel buffer on gc. - virtual void draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer) = 0; + virtual void draw_pixels(double x, double y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer) = 0; //: Print text on gc. virtual void draw_text(double x, double y, const CL_StringRef &text, const CL_Colord &color) = 0; Modified: Development/ClanLib-0.9/Sources/Display/graphic_context.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/graphic_context.cpp 2006-08-21 19:39:25 UTC (rev 1051) +++ Development/ClanLib-0.9/Sources/Display/graphic_context.cpp 2006-08-21 19:53:33 UTC (rev 1052) @@ -203,12 +203,12 @@ impl->provider->draw_primitives(type, array); } -void CL_GraphicContext::draw_pixels(int x, int y, const CL_PixelBuffer &image) +void CL_GraphicContext::draw_pixels(double x, double y, const CL_PixelBuffer &image) { impl->provider->draw_pixels(x, y, 1.0, 1.0, image); } -void CL_GraphicContext::draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &image) +void CL_GraphicContext::draw_pixels(double x, double y, double zoom_x, double zoom_y, const CL_PixelBuffer &image) { impl->provider->draw_pixels(x, y, zoom_x, zoom_y, image); } Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-21 19:39:25 UTC (rev 1051) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.cpp 2006-08-21 19:53:33 UTC (rev 1052) @@ -427,7 +427,7 @@ } void CL_OpenGLGraphicContextProvider::draw_pixels( - int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &image) + double x, double y, double zoom_x, double zoom_y, const CL_PixelBuffer &image) { render_state->set_active(); @@ -829,8 +829,8 @@ } draw_pixels( - (int) (x + pos_x + glyph_metrics.gmptGlyphOrigin.x), - (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), + x + pos_x + glyph_metrics.gmptGlyphOrigin.x, + y + pos_y - glyph_metrics.gmptGlyphOrigin.y, 1.0, 1.0, pb); pos_x += glyph_metrics.gmCellIncX; @@ -887,8 +887,8 @@ } draw_pixels( - (int) (x + pos_x + glyph_metrics.gmptGlyphOrigin.x), - (int) (y + pos_y - glyph_metrics.gmptGlyphOrigin.y), + x + pos_x + glyph_metrics.gmptGlyphOrigin.x, + y + pos_y - glyph_metrics.gmptGlyphOrigin.y, 1.0, 1.0, pb); pos_x += glyph_metrics.gmCellIncX; Modified: Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h 2006-08-21 19:39:25 UTC (rev 1051) +++ Development/ClanLib-0.9/Sources/GL/opengl_graphic_context_provider.h 2006-08-21 19:53:33 UTC (rev 1052) @@ -127,7 +127,7 @@ void draw_primitives(CL_PrimitivesType type, const CL_PrimitivesArray &array); - void draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer); + void draw_pixels(double x, double y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer); void draw_text(double x, double y, const CL_StringRef &text, const CL_Colord &color = CL_Colord::white); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-21 19:40:27
|
Author: mbn Date: 2006-08-21 21:39:25 +0200 (Mon, 21 Aug 2006) New Revision: 1051 Modified: Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp Log: - Small fragment shader code fix to make it work on ATI cards. Modified: Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp =================================================================== --- Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp 2006-08-21 19:05:57 UTC (rev 1050) +++ Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp 2006-08-21 19:39:25 UTC (rev 1051) @@ -21,11 +21,11 @@ "uniform float distance;" "void main(void)" "{" - "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(0, distance*2))*0.05;" + "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(0, distance*2.0))*0.05;" "vec4 texval2 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(0, distance))*0.10;" "vec4 texval3 = texture2D(my_texture, vec2(gl_TexCoord[0]))*0.7;" "vec4 texval4 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(0, distance))*0.10;" - "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(0, distance*2))*0.05;" + "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(0, distance*2.0))*0.05;" "vec4 texsum = (texval1 + texval2 + texval3 + texval4 + texval5);" "gl_FragColor = vec4(texsum.x, texsum.y, texsum.z, 1.0);" "}"; @@ -35,11 +35,11 @@ "uniform float distance;" "void main(void)" "{" - "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(distance*2, 0))*0.05;" + "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(distance*2.0, 0))*0.05;" "vec4 texval2 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(distance, 0))*0.10;" "vec4 texval3 = texture2D(my_texture, vec2(gl_TexCoord[0]))*0.7;" "vec4 texval4 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(distance, 0))*0.10;" - "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(distance*2, 0))*0.05;" + "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(distance*2.0, 0))*0.05;" "vec4 texsum = (texval1 + texval2 + texval3 + texval4 + texval5);" "gl_FragColor = vec4(texsum.x, texsum.y, texsum.z, 1.0);" "}"; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-21 19:06:58
|
Author: mbn Date: 2006-08-21 21:05:57 +0200 (Mon, 21 Aug 2006) New Revision: 1050 Modified: Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.cpp Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.h Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.cpp Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.h Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp Log: - Small bug in argument passing code. Modified: Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h 2006-08-21 19:05:57 UTC (rev 1050) @@ -56,7 +56,7 @@ //: Constructs a sound output object. CL_SoundOutput(); - CL_SoundOutput(int mixing_frequency, int latency = 20); + CL_SoundOutput(int mixing_frequency, int latency = 50); CL_SoundOutput(const CL_SoundOutput_Description &desc); Modified: Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.cpp 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.cpp 2006-08-21 19:05:57 UTC (rev 1050) @@ -25,7 +25,6 @@ ** ** Magnus Norddahl ** Sean Heber - implemented ring buffer -** (if your name is missing here, please add it) */ #include "Sound/precomp.h" @@ -37,7 +36,7 @@ // CL_SoundOutput_MacOSX construction: CL_SoundOutput_MacOSX::CL_SoundOutput_MacOSX(int frequency) : - CL_SoundOutput_Generic(frequency), playing(false) + CL_SoundOutput_Generic(frequency, latency), playing(false) { UInt32 size; OSStatus result; Modified: Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.h =================================================================== --- Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.h 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/Sound/MacOSX/soundoutput_macosx.h 2006-08-21 19:05:57 UTC (rev 1050) @@ -43,7 +43,7 @@ { //! Construction: public: - CL_SoundOutput_MacOSX(int mixing_frequency); + CL_SoundOutput_MacOSX(int mixing_frequency, int mixing_latency); ~CL_SoundOutput_MacOSX(); Modified: Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.cpp 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.cpp 2006-08-21 19:05:57 UTC (rev 1050) @@ -42,7 +42,7 @@ ///////////////////////////////////////////////////////////////////////////// // CL_SoundOutput_OSS construction: -CL_SoundOutput_OSS::CL_SoundOutput_OSS(int mixing_frequency) : +CL_SoundOutput_OSS::CL_SoundOutput_OSS(int mixing_frequency, int mixing_latency) : CL_SoundOutput_Generic(mixing_frequency), dev_dsp_fd(-1), frag_size(0), has_sound(true) { dev_dsp_fd = open("/dev/dsp", O_WRONLY|O_NONBLOCK); Modified: Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.h =================================================================== --- Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.h 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/Sound/Unix/soundoutput_oss.h 2006-08-21 19:05:57 UTC (rev 1050) @@ -40,7 +40,7 @@ { //! Construction: public: - CL_SoundOutput_OSS(int mixing_frequency); + CL_SoundOutput_OSS(int mixing_frequency, int mixing_latency); ~CL_SoundOutput_OSS(); Modified: Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp 2006-08-21 18:54:17 UTC (rev 1049) +++ Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp 2006-08-21 19:05:57 UTC (rev 1050) @@ -62,12 +62,12 @@ CL_SoundOutput::CL_SoundOutput(const CL_SoundOutput_Description &desc) : impl(0) { #ifdef WIN32 - impl = new CL_SoundOutput_DirectSound(desc.get_mixing_frequency()); + impl = new CL_SoundOutput_DirectSound(desc.get_mixing_frequency(), desc.get_mixing_latency()); #else #ifdef __APPLE__ - impl = new CL_SoundOutput_MacOSX(desc.get_mixing_frequency()); + impl = new CL_SoundOutput_MacOSX(desc.get_mixing_frequency(), desc.get_mixing_latency()); #else - impl = new CL_SoundOutput_OSS(desc.get_mixing_frequency()); + impl = new CL_SoundOutput_OSS(desc.get_mixing_frequency(), desc.get_mixing_latency()); #endif #endif impl->add_ref(); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-21 18:55:25
|
Author: mbn Date: 2006-08-21 20:54:17 +0200 (Mon, 21 Aug 2006) New Revision: 1049 Modified: Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h Development/ClanLib-0.9/Sources/API/Sound/soundoutput_description.h Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.cpp Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.h Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp Development/ClanLib-0.9/Sources/Sound/soundoutput_description.cpp Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.cpp Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.h Log: - Made mixing latency (fragment mixing size) configurable in clanSound. Modified: Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/API/Sound/soundoutput.h 2006-08-21 18:54:17 UTC (rev 1049) @@ -56,7 +56,7 @@ //: Constructs a sound output object. CL_SoundOutput(); - CL_SoundOutput(int mixing_frequency); + CL_SoundOutput(int mixing_frequency, int latency = 20); CL_SoundOutput(const CL_SoundOutput_Description &desc); @@ -72,6 +72,9 @@ //: Returns the mixing frequency for the sound output device. int get_mixing_frequency() const; + //: Returns the mixing latency in milliseconds. + int get_mixing_latency() const; + //: Returns the main volume of the sound output. float get_global_volume() const; Modified: Development/ClanLib-0.9/Sources/API/Sound/soundoutput_description.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Sound/soundoutput_description.h 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/API/Sound/soundoutput_description.h 2006-08-21 18:54:17 UTC (rev 1049) @@ -59,6 +59,9 @@ //: Returns the mixing frequency for the sound output device. int get_mixing_frequency() const; + //: Returns the mixing latency in milliseconds. + int get_mixing_latency() const; + //! Operations: public: //: Copy assignment operator. @@ -67,6 +70,9 @@ //: Sets the mixing frequency for the sound output device. void set_mixing_frequency(int frequency); + //: Sets the mixing latency in milliseconds. + void set_mixing_latency(int latency); + //! Implementation: private: CL_SoundOutput_Description_Generic *impl; Modified: Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.cpp 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.cpp 2006-08-21 18:54:17 UTC (rev 1049) @@ -35,11 +35,10 @@ ///////////////////////////////////////////////////////////////////////////// // CL_SoundOutput_DirectSound construction: -CL_SoundOutput_DirectSound::CL_SoundOutput_DirectSound(int mixing_frequency) : - CL_SoundOutput_Generic(mixing_frequency), - directsound(0), soundbuffer(0), - frag_size(0), buffer_size(0), bytes_per_sample(0), - sleep_event(0), notify(0), has_sound(true), last_write_pos(-1) +CL_SoundOutput_DirectSound::CL_SoundOutput_DirectSound(int mixing_frequency, int mixing_latency) +: CL_SoundOutput_Generic(mixing_frequency, mixing_latency), directsound(0), + soundbuffer(0), frag_size(0), buffer_size(0), bytes_per_sample(0), + sleep_event(0), notify(0), has_sound(true), last_write_pos(-1) { HRESULT err; err = DirectSoundCreate(NULL, &directsound, NULL); @@ -113,7 +112,7 @@ bytes_per_sample = format.nBlockAlign; - frag_size = 2048; + frag_size = mixing_frequency * mixing_latency / 1000; int num_fragments = 8; DSBUFFERDESC desc; Modified: Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.h =================================================================== --- Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.h 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/Win32/soundoutput_directsound.h 2006-08-21 18:54:17 UTC (rev 1049) @@ -38,7 +38,7 @@ { //! Construction: public: - CL_SoundOutput_DirectSound(int mixing_frequency); + CL_SoundOutput_DirectSound(int mixing_frequency, int mixing_latency = 50); ~CL_SoundOutput_DirectSound(); Modified: Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/soundoutput.cpp 2006-08-21 18:54:17 UTC (rev 1049) @@ -50,10 +50,12 @@ { } -CL_SoundOutput::CL_SoundOutput(int mixing_frequency) : impl(0) +CL_SoundOutput::CL_SoundOutput(int mixing_frequency, int latency) +: impl(0) { CL_SoundOutput_Description desc; desc.set_mixing_frequency(mixing_frequency); + desc.set_mixing_latency(latency); operator =(CL_SoundOutput(desc)); } @@ -98,6 +100,12 @@ return impl->mixing_frequency; } +int CL_SoundOutput::get_mixing_latency() const +{ + CL_MutexSection mutex_lock(&impl->mutex); + return impl->mixing_latency; +} + float CL_SoundOutput::get_global_volume() const { CL_MutexSection mutex_lock(&impl->mutex); Modified: Development/ClanLib-0.9/Sources/Sound/soundoutput_description.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/soundoutput_description.cpp 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/soundoutput_description.cpp 2006-08-21 18:54:17 UTC (rev 1049) @@ -37,6 +37,8 @@ //! Attributes: public: int mixing_frequency; + + int mixing_latency; }; ///////////////////////////////////////////////////////////////////////////// @@ -45,6 +47,7 @@ CL_SoundOutput_Description::CL_SoundOutput_Description() : impl(new CL_SoundOutput_Description_Generic) { impl->mixing_frequency = 44100; + impl->mixing_latency = 50; } CL_SoundOutput_Description::CL_SoundOutput_Description(const CL_SoundOutput_Description ©) : impl(new CL_SoundOutput_Description_Generic) @@ -65,6 +68,11 @@ return impl->mixing_frequency; } +int CL_SoundOutput_Description::get_mixing_latency() const +{ + return impl->mixing_latency; +} + ///////////////////////////////////////////////////////////////////////////// // CL_SoundOutput_Description operations: @@ -79,5 +87,10 @@ impl->mixing_frequency = frequency; } +void CL_SoundOutput_Description::set_mixing_latency(int latency) +{ + impl->mixing_latency = latency; +} + // CL_SoundOutput_Description implementation: ///////////////////////////////////////////////////////////////////////////// Modified: Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.cpp 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.cpp 2006-08-21 18:54:17 UTC (rev 1049) @@ -34,8 +34,9 @@ ///////////////////////////////////////////////////////////////////////////// // CL_SoundOutput_Generic construction: -CL_SoundOutput_Generic::CL_SoundOutput_Generic(int mixing_frequency) : - mixing_frequency(mixing_frequency), volume(1.0f), pan(0.0f), mix_buffer_size(0), ref_count(0) +CL_SoundOutput_Generic::CL_SoundOutput_Generic(int mixing_frequency, int latency) +: mixing_frequency(mixing_frequency), mixing_latency(latency), volume(1.0f), + pan(0.0f), mix_buffer_size(0), ref_count(0) { mix_buffers[0] = 0; mix_buffers[1] = 0; Modified: Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.h =================================================================== --- Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.h 2006-08-20 21:30:37 UTC (rev 1048) +++ Development/ClanLib-0.9/Sources/Sound/soundoutput_generic.h 2006-08-21 18:54:17 UTC (rev 1049) @@ -48,7 +48,7 @@ { //! Construction: public: - CL_SoundOutput_Generic(int mixing_frequency); + CL_SoundOutput_Generic(int mixing_frequency, int mixing_latency); virtual ~CL_SoundOutput_Generic(); @@ -58,6 +58,8 @@ int mixing_frequency; + int mixing_latency; + float volume; float pan; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-20 21:31:44
|
Author: mbn Date: 2006-08-20 23:30:37 +0200 (Sun, 20 Aug 2006) New Revision: 1048 Modified: Development/ClanLib-0.9/Sources/GL/opengl_texture_provider.cpp Log: - Fixed some opengl state management. Modified: Development/ClanLib-0.9/Sources/GL/opengl_texture_provider.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/opengl_texture_provider.cpp 2006-08-20 18:58:36 UTC (rev 1047) +++ Development/ClanLib-0.9/Sources/GL/opengl_texture_provider.cpp 2006-08-20 21:30:37 UTC (rev 1048) @@ -292,7 +292,7 @@ int format, CL_GraphicContextProvider *gc) { - CL_OpenGLState state(dynamic_cast<CL_OpenGLGraphicContextProvider*>(gc)); + CL_OpenGLState state(static_cast<CL_OpenGLGraphicContextProvider*>(gc)); state.set_active(); clEnable(CL_TEXTURE_2D); @@ -317,7 +317,7 @@ int level, CL_GraphicContextProvider *gc) { - CL_OpenGLState state(dynamic_cast<CL_OpenGLGraphicContextProvider*>(gc)); + CL_OpenGLState state(static_cast<CL_OpenGLGraphicContextProvider*>(gc)); state.set_active(); clEnable(CL_TEXTURE_2D); @@ -334,36 +334,54 @@ void CL_OpenGLTextureProvider::set_min_lod(double min_lod) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameterf(CL_TEXTURE_2D, CL_TEXTURE_MIN_LOD, (CLfloat)min_lod); } void CL_OpenGLTextureProvider::set_max_lod(double max_lod) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameterf(CL_TEXTURE_2D, CL_TEXTURE_MAX_LOD, (CLfloat)max_lod); } void CL_OpenGLTextureProvider::set_lod_bias(double lod_bias) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameterf(CL_TEXTURE_2D, CL_TEXTURE_LOD_BIAS, (CLfloat)lod_bias); } void CL_OpenGLTextureProvider::set_base_level(int base_level) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_BASE_LEVEL, base_level); } void CL_OpenGLTextureProvider::set_max_level(int max_level) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAX_LEVEL, max_level); } void CL_OpenGLTextureProvider::set_generate_mipmap(bool generate_mipmap) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_GENERATE_MIPMAP, generate_mipmap); } @@ -373,6 +391,9 @@ CL_TextureWrapMode wrap_t, CL_TextureWrapMode wrap_r) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_WRAP_S, to_enum(wrap_s)); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_WRAP_T, to_enum(wrap_t)); @@ -383,6 +404,9 @@ CL_TextureWrapMode wrap_s, CL_TextureWrapMode wrap_t) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_WRAP_S, to_enum(wrap_s)); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_WRAP_T, to_enum(wrap_t)); @@ -391,24 +415,36 @@ void CL_OpenGLTextureProvider::set_wrap_mode( CL_TextureWrapMode wrap_s) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_WRAP_S, to_enum(wrap_s)); } void CL_OpenGLTextureProvider::set_min_filter(CL_TextureFilter filter) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MIN_FILTER, to_enum(filter)); } void CL_OpenGLTextureProvider::set_mag_filter(CL_TextureFilter filter) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_MAG_FILTER, to_enum(filter)); } void CL_OpenGLTextureProvider::set_border_color(double red, double green, double blue, double alpha) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); CLfloat color[4] = {(CLfloat)red, (CLfloat)green, (CLfloat)blue, (CLfloat)alpha}; clTexParameterfv(CL_TEXTURE_2D, CL_TEXTURE_BORDER_COLOR, color); @@ -416,18 +452,27 @@ void CL_OpenGLTextureProvider::set_priority(double priority) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameterf(CL_TEXTURE_2D, CL_TEXTURE_PRIORITY, (CLfloat)priority); } void CL_OpenGLTextureProvider::set_depth_mode(CL_TextureDepthMode depth_mode) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_DEPTH_TEXTURE_MODE, to_enum(depth_mode)); } void CL_OpenGLTextureProvider::set_texture_compare(CL_TextureCompareMode mode, CL_CompareFunction func) { + CL_OpenGLState state(gc_provider); + state.set_active(); + clEnable(CL_TEXTURE_2D); clBindTexture(CL_TEXTURE_2D, get_handle()); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_COMPARE_MODE, to_enum(mode)); clTexParameteri(CL_TEXTURE_2D, CL_TEXTURE_COMPARE_FUNC, to_enum(func)); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-20 18:59:51
|
Author: mbn Date: 2006-08-20 20:58:36 +0200 (Sun, 20 Aug 2006) New Revision: 1047 Added: Development/ClanLib-0.9/Tests/Display/BlendShader1/ Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.sln Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.vcproj Development/ClanLib-0.9/Tests/Display/BlendShader1/image.png Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp Log: - Added fragment shader test. Added: Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.sln =================================================================== --- Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.sln 2006-08-19 23:56:00 UTC (rev 1046) +++ Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.sln 2006-08-20 18:58:36 UTC (rev 1047) @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlendShader1-vc71", "BlendShader1-vc71.vcproj", "{5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Debug.ActiveCfg = Debug|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Debug.Build.0 = Debug|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Release.ActiveCfg = Release|Win32 + {5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal Added: Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.vcproj =================================================================== --- Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.vcproj 2006-08-19 23:56:00 UTC (rev 1046) +++ Development/ClanLib-0.9/Tests/Display/BlendShader1/BlendShader1-vc71.vcproj 2006-08-20 18:58:36 UTC (rev 1047) @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="BlendShader1-vc71" + ProjectGUID="{5C1AAF8C-7FF0-447E-B01D-AED0A0B2849F}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="4"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/BlendShader1.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/BlendShader1.pdb" + SubSystem="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" + RuntimeLibrary="0" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + OutputFile="$(OutDir)/BlendShader1.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> + <File + RelativePath=".\test.cpp"> + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Added: Development/ClanLib-0.9/Tests/Display/BlendShader1/image.png =================================================================== (Binary files differ) Property changes on: Development/ClanLib-0.9/Tests/Display/BlendShader1/image.png ___________________________________________________________________ Name: svn:mime-type + image/png Added: Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp =================================================================== --- Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp 2006-08-19 23:56:00 UTC (rev 1046) +++ Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp 2006-08-20 18:58:36 UTC (rev 1047) @@ -0,0 +1,174 @@ +#include <ClanLib/core.h> +#include <ClanLib/application.h> +#include <ClanLib/display.h> +#include <ClanLib/gl.h> + +class App : public CL_ClanApplication +{ + int main(int argc, char** argv) + { + CL_ConsoleWindow console("Console"); + console.redirect_stdio(); + + try + { + CL_SetupCore setup_core; + CL_SetupDisplay setup_disp; + CL_SetupGL setup_gl; + + const char *blendhorz_source = + "uniform sampler2D my_texture;" + "uniform float distance;" + "void main(void)" + "{" + "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(0, distance*2))*0.05;" + "vec4 texval2 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(0, distance))*0.10;" + "vec4 texval3 = texture2D(my_texture, vec2(gl_TexCoord[0]))*0.7;" + "vec4 texval4 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(0, distance))*0.10;" + "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(0, distance*2))*0.05;" + "vec4 texsum = (texval1 + texval2 + texval3 + texval4 + texval5);" + "gl_FragColor = vec4(texsum.x, texsum.y, texsum.z, 1.0);" + "}"; + + const char *blendvert_source = + "uniform sampler2D my_texture;" + "uniform float distance;" + "void main(void)" + "{" + "vec4 texval1 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(distance*2, 0))*0.05;" + "vec4 texval2 = texture2D(my_texture, vec2(gl_TexCoord[0]) - vec2(distance, 0))*0.10;" + "vec4 texval3 = texture2D(my_texture, vec2(gl_TexCoord[0]))*0.7;" + "vec4 texval4 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(distance, 0))*0.10;" + "vec4 texval5 = texture2D(my_texture, vec2(gl_TexCoord[0]) + vec2(distance*2, 0))*0.05;" + "vec4 texsum = (texval1 + texval2 + texval3 + texval4 + texval5);" + "gl_FragColor = vec4(texsum.x, texsum.y, texsum.z, 1.0);" + "}"; + + CL_DisplayWindow w("BlendShader1", 640, 800); + CL_GraphicContext gc = w.get_gc(); + gc.clear(CL_Colord::white); + + CL_ShaderObject blendhorz_shader(cl_shadertype_fragment, blendhorz_source, gc); + if (!blendhorz_shader.get_compile_status()) + { + CL_Console::write_line("Blend Horizontal shader compile failed:"); + CL_Console::write_line(blendhorz_shader.get_info_log()); + } + CL_ProgramObject blendhorz_program(gc); + blendhorz_program.attach(blendhorz_shader); + blendhorz_program.link(); + if (!blendhorz_program.get_link_status()) + { + CL_Console::write_line("Blend Horizontal program link failed:"); + CL_Console::write_line(blendhorz_program.get_info_log()); + } + + CL_ShaderObject blendvert_shader(cl_shadertype_fragment, blendvert_source, gc); + if (!blendvert_shader.get_compile_status()) + { + CL_Console::write_line("Blend Horizontal shader compile failed:"); + CL_Console::write_line(blendvert_shader.get_info_log()); + } + CL_ProgramObject blendvert_program(gc); + blendvert_program.attach(blendvert_shader); + blendvert_program.link(); + if (!blendvert_program.get_link_status()) + { + CL_Console::write_line("Blend Horizontal program link failed:"); + CL_Console::write_line(blendvert_program.get_info_log()); + } + + CL_Sprite sprite("image.png"); + + CL_Texture texture(640, 800, 1, 0, gc); + + CL_Font f2("Tahoma", 32, 0, 0.0, 0.0, 0, false, true, false, false, gc); + CL_Font f3("Tahoma", 55, 0, 0.0, 0.0, 0, false, true, false, false, gc); + gc.set_map_mode(cl_map_2d_upper_left); + int i = 10; + int dir = 0; + while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE)) + { + // Draw light source: + gc.clear(CL_Colord::whitesmoke); + + // Draw scene objects: + CL_BlendMode blend_mode; + blend_mode.enable_blending(true); + gc.set_texture(0, CL_Texture()); + sprite.draw(0.0, 0.0, gc); + gc.set_texture(0, CL_Texture()); + gc.set_blend_mode(blend_mode); + gc.set_font(f2); + gc.draw_text(100, 140, "Blend Fragment Shader Test #1", CL_Colord::black); + gc.set_font(f3); + gc.draw_text(100, 240, "To blend or not to blend!", CL_Colord::darkgoldenrod); + + i += dir; + if (i == 99) + dir = -1; + if (i == 10) + dir = 1; +// if ((i/10)%2) + { + //: Draw Blend horz: + texture.copy_image_from(0, 0, 640, 800, 0, 0, CL_RGB, &gc); + texture.set_min_filter(cl_filter_nearest); + texture.set_mag_filter(cl_filter_nearest); + gc.set_texture(0, texture); + gc.set_program_object(blendhorz_program); + blendhorz_program.set_uniform("my_texture", 0); + blendhorz_program.set_uniform("distance", i/1000.0f); + CL_TexturedRectPrimitive rect; + rect.enable_constant_color(true); + rect.set_constant_color(CL_Colord::white); + rect.tex_coord(0, 0.0, 1.0); + rect.vertex( 0.0, 0.0); + rect.tex_coord(0, 1.0, 1.0); + rect.vertex(640.0, 0.0); + rect.tex_coord(0, 0.0, 0.0); + rect.vertex( 0.0, 800.0); + rect.tex_coord(0, 1.0, 0.0); + rect.vertex(640.0, 800.0); + gc.draw_primitives(cl_triangles, rect); + gc.set_program_object(CL_ProgramObject()); + gc.set_texture(0, CL_Texture()); + + //: Draw Blend vert: + texture.copy_image_from(0, 0, 640, 800, 0, 0, CL_RGB, &gc); + texture.set_min_filter(cl_filter_nearest); + texture.set_mag_filter(cl_filter_nearest); + gc.set_texture(0, texture); + gc.set_program_object(blendvert_program); + blendvert_program.set_uniform("my_texture", 0); + blendvert_program.set_uniform("distance", i/1000.0f); + CL_TexturedRectPrimitive rect2; + rect2.enable_constant_color(true); + rect2.set_constant_color(CL_Colord::white); + rect2.tex_coord(0, 0.0, 1.0); + rect2.vertex( 0.0, 0.0); + rect2.tex_coord(0, 1.0, 1.0); + rect2.vertex(640.0, 0.0); + rect2.tex_coord(0, 0.0, 0.0); + rect2.vertex( 0.0, 800.0); + rect2.tex_coord(0, 1.0, 0.0); + rect2.vertex(640.0, 800.0); + gc.draw_primitives(cl_triangles, rect2); + gc.set_program_object(CL_ProgramObject()); + gc.set_texture(0, CL_Texture()); + } + + w.flip(1); + w.process_messages(); + } + return 0; + } + catch (CL_Exception e) + { + CL_Console::write_line(e.message); + console.display_close_message(); + } + + return 0; + } +} app; Property changes on: Development/ClanLib-0.9/Tests/Display/BlendShader1/test.cpp ___________________________________________________________________ Name: svn:eol-style + native |
From: Changes to t. C. r. <cla...@li...> - 2006-08-19 23:57:11
|
Author: sphair Date: 2006-08-20 01:56:00 +0200 (Sun, 20 Aug 2006) New Revision: 1046 Modified: Development/ClanLib-0.9/Sources/Display/blend_mode.cpp Development/ClanLib-0.9/Sources/Display/sprite.cpp Log: - adding scaling to sprite drawing Modified: Development/ClanLib-0.9/Sources/Display/blend_mode.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/blend_mode.cpp 2006-08-19 23:54:44 UTC (rev 1045) +++ Development/ClanLib-0.9/Sources/Display/blend_mode.cpp 2006-08-19 23:56:00 UTC (rev 1046) @@ -42,7 +42,8 @@ alpha_equation(cl_blend_equation_add), src_func(cl_blend_src_alpha), dest_func(cl_blend_one_minus_src_alpha), - src_alpha_func(cl_blend_src_alpha), dest_alpha_func(cl_blend_one_minus_src_alpha) + src_alpha_func(cl_blend_src_alpha), + dest_alpha_func(cl_blend_one_minus_src_alpha) { } Modified: Development/ClanLib-0.9/Sources/Display/sprite.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/sprite.cpp 2006-08-19 23:54:44 UTC (rev 1045) +++ Development/ClanLib-0.9/Sources/Display/sprite.cpp 2006-08-19 23:56:00 UTC (rev 1046) @@ -398,40 +398,50 @@ { CL_Sprite_Impl::SpriteFrame &frame = impl->frames[impl->current_frame]; - impl->gc.set_texture(0, frame.texture); + gc.set_texture(0, frame.texture); - // Using 0.38 for the texture matrix instead of 0.375 - reduces some slight smooth (rounding errors?) - double pixelcenter_x = 0.38 / frame.texture.get_width(0); - double pixelcenter_y = 0.38 / frame.texture.get_height(0); double width = frame.position.get_width(); double height = frame.position.get_height(); - double texcoord_x = width / frame.texture.get_width(0); - double texcoord_y = height / frame.texture.get_height(0); + double dest_width = width * impl->scale_x; + double dest_height = height * impl->scale_y; + double tex_width = frame.texture.get_width(0); + double tex_height = frame.texture.get_height(0); + // Using 0.38 for the texture matrix instead of 0.375 - reduces some slight smooth (rounding errors?) + double pixelcenter_x = 0.38 / tex_width; + double pixelcenter_y = 0.38 / tex_height; + + double tc_x1 = (frame.position.left) / tex_width + pixelcenter_x; + double tc_y1 = (frame.position.top) / tex_height + pixelcenter_y; + double tc_x2 = (frame.position.left + width) / tex_width + pixelcenter_x; + double tc_y2 = (frame.position.top + height) / tex_height + pixelcenter_y; + // Apply translation alignment - CL_Pointd pos = calc_origin(impl->translation_origin, CL_Sized(width, height)); + CL_Pointd pos = calc_origin(impl->translation_origin, CL_Sized(dest_width, dest_height)); x -= pos.x + impl->translation_hotspot.x; y -= pos.y + impl->translation_hotspot.y; + double alpha = impl->alpha; + CL_TexturedRectPrimitive quad; - quad.color(1.0, 1.0, 1.0, 1.0); - quad.tex_coord(0, pixelcenter_x, pixelcenter_y); + quad.color(1.0, 1.0, 1.0, alpha); + quad.tex_coord(0, tc_x1, tc_y1); quad.vertex(x, y); - quad.color(1.0, 1.0, 1.0, 1.0); - quad.tex_coord(0, pixelcenter_x + texcoord_x, pixelcenter_y); - quad.vertex(x + width, y); + quad.color(1.0, 1.0, 1.0, alpha); + quad.tex_coord(0, tc_x2, tc_y1); + quad.vertex(x + dest_width, y); - quad.color(1.0, 1.0, 1.0, 1.0); - quad.tex_coord(0, pixelcenter_x, pixelcenter_y + texcoord_y); - quad.vertex(x, y + height); + quad.color(1.0, 1.0, 1.0, alpha); + quad.tex_coord(0, tc_x1, tc_y2); + quad.vertex(x, y + dest_height); - quad.color(1.0, 1.0, 1.0, 1.0); - quad.tex_coord(0, pixelcenter_x + texcoord_x, pixelcenter_y + texcoord_y); - quad.vertex(x + width, y + height); + quad.color(1.0, 1.0, 1.0, alpha); + quad.tex_coord(0, tc_x2, tc_y2); + quad.vertex(x + dest_width, y + dest_height); - impl->gc.draw_primitives(cl_triangles, quad); + gc.draw_primitives(cl_triangles, quad); /* static CL_Surface_DrawParams2 params2; params2.srcX = frame.position.left; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-19 23:55:56
|
Author: mbn Date: 2006-08-20 01:54:44 +0200 (Sun, 20 Aug 2006) New Revision: 1045 Modified: Development/ClanLib-0.9/Sources/API/Display/color.h Development/ClanLib-0.9/Sources/Display/color.cpp Log: - Added auto conversion operators between CL_Color and CL_Colord. Modified: Development/ClanLib-0.9/Sources/API/Display/color.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/color.h 2006-08-13 23:20:50 UTC (rev 1044) +++ Development/ClanLib-0.9/Sources/API/Display/color.h 2006-08-19 23:54:44 UTC (rev 1045) @@ -108,6 +108,9 @@ bool operator!=(const CL_Color &c) const { return (color != c.color); } + //: Type conversion operator. + operator CL_Colord() const; + //! Statics: public: //: <img src="../images/aliceblue-chip.png" width=16 height=16 /> rgb(240, 248, 255). @@ -667,7 +670,6 @@ //! Operations: public: - //: Normalize the color by ensuring that all color values lie inbetween (0.0, 1.0) void normalize() { @@ -702,6 +704,12 @@ return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a); } + //: Type conversion operator. + operator CL_Color() const + { + return CL_Color(*this); + } + //! Statics: public: //: <img src="../images/aliceblue-chip.png" width=16 height=16 /> rgb(240, 248, 255). Modified: Development/ClanLib-0.9/Sources/Display/color.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/color.cpp 2006-08-13 23:20:50 UTC (rev 1044) +++ Development/ClanLib-0.9/Sources/Display/color.cpp 2006-08-19 23:54:44 UTC (rev 1045) @@ -76,6 +76,11 @@ { } +CL_Color::operator CL_Colord() const +{ + return CL_Colord(*this); +} + CL_Color CL_Color::from_pixelformat(unsigned int raw_color, const CL_PixelFormat &pf) { const int in_r_shift = CL_PixelFormat::get_mask_shift(pf.get_red_mask()); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-13 23:22:26
|
Author: mrfun Date: 2006-08-14 01:20:50 +0200 (Mon, 14 Aug 2006) New Revision: 1044 Modified: Development/ClanLib-0.8/Sources/API/Core/System/thread.h Development/ClanLib-0.8/Sources/API/Sound/soundoutput.h Development/ClanLib-0.8/Sources/Core/System/Unix/thread_pthread.cpp Development/ClanLib-0.8/Sources/Core/System/Win32/thread_win32.cpp Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.cpp Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.h Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.cpp Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.h Development/ClanLib-0.8/Sources/Sound/soundoutput.cpp Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.cpp Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.h Log: Added Kamil Toman's sound thread fix: Fixing problem with trying to kill a non-existent sound thread at shutdown in cases where sound failed to initialize. Also adds more asserts and a way to query if sound was properly initialized or not. Modified: Development/ClanLib-0.8/Sources/API/Core/System/thread.h =================================================================== --- Development/ClanLib-0.8/Sources/API/Core/System/thread.h 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/API/Core/System/thread.h 2006-08-13 23:20:50 UTC (rev 1044) @@ -129,6 +129,10 @@ CL_Thread(const CL_Thread ©); CL_Thread(); + + inline bool is_initialized() { + return impl != 0; + } //: Destructor. ~CL_Thread(); Modified: Development/ClanLib-0.8/Sources/API/Sound/soundoutput.h =================================================================== --- Development/ClanLib-0.8/Sources/API/Sound/soundoutput.h 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/API/Sound/soundoutput.h 2006-08-13 23:20:50 UTC (rev 1044) @@ -76,6 +76,9 @@ //! Attributes: public: + //: True if the sound system has been properly initialized + bool has_sound() const; + //: Name of the output device. const std::string &get_name() const; Modified: Development/ClanLib-0.8/Sources/Core/System/Unix/thread_pthread.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Core/System/Unix/thread_pthread.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Core/System/Unix/thread_pthread.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -123,6 +123,8 @@ void CL_Thread::start() { + cl_assert((impl != NULL)); + if (impl->running) return; cl_assert( @@ -148,18 +150,24 @@ void CL_Thread::terminate() { + cl_assert(impl != NULL); + if (impl->running) pthread_cancel(impl->thread); impl->running = false; } void CL_Thread::wait() { + cl_assert(impl != NULL); + if (impl->running) pthread_join(impl->thread, NULL); impl->running = false; } void CL_Thread::set_priority(EThreadPriority priority) { + cl_assert(impl != NULL); + #ifdef __APPLE__ struct sched_param param; memset(¶m, 0, sizeof(struct sched_param)); Modified: Development/ClanLib-0.8/Sources/Core/System/Win32/thread_win32.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Core/System/Win32/thread_win32.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Core/System/Win32/thread_win32.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -33,6 +33,7 @@ #include "API/Core/System/error.h" #include "API/Core/System/crash_reporter.h" #include "thread_win32.h" +#include "API/Core/System/cl_assert.h" ///////////////////////////////////////////////////////////////////////////// // CL_Thread_Helper win32 implementation: @@ -135,6 +136,8 @@ void CL_Thread::start() { + cl_assert(impl != NULL); + impl->thread_handle = CreateThread( NULL, 0, @@ -149,6 +152,8 @@ void CL_Thread::terminate() { + cl_assert(impl != NULL); + TerminateThread(impl->thread_handle, 0); CloseHandle(impl->thread_handle); impl->thread_handle = NULL; @@ -156,6 +161,8 @@ void CL_Thread::wait() { + cl_assert(impl != NULL); + if (impl->thread_handle == NULL) return; WaitForSingleObject(impl->thread_handle, INFINITE); @@ -165,6 +172,8 @@ void CL_Thread::set_priority(EThreadPriority priority) { + cl_assert(impl != NULL); + if (impl->thread_handle == NULL) return; int prio = THREAD_PRIORITY_NORMAL; Modified: Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -45,7 +45,7 @@ // CL_SoundOutput_OSS construction: CL_SoundOutput_OSS::CL_SoundOutput_OSS(int mixing_frequency) : - CL_SoundOutput_Generic(mixing_frequency), dev_dsp_fd(-1), frag_size(0), has_sound(true) + CL_SoundOutput_Generic(mixing_frequency), dev_dsp_fd(-1), frag_size(0) { dev_dsp_fd = open("/dev/dsp", O_WRONLY|O_NONBLOCK); if (dev_dsp_fd == -1) @@ -111,7 +111,7 @@ CL_SoundOutput_OSS::~CL_SoundOutput_OSS() { - stop_mixer_thread(); + if (has_sound) stop_mixer_thread(); } ///////////////////////////////////////////////////////////////////////////// Modified: Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.h =================================================================== --- Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.h 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/Unix/soundoutput_oss.h 2006-08-13 23:20:50 UTC (rev 1044) @@ -50,8 +50,6 @@ int frag_size; - bool has_sound; - //! Operations: public: //: Called when we have no samples to play - and wants to tell the soundcard Modified: Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -41,7 +41,7 @@ CL_SoundOutput_Generic(mixing_frequency), directsound(0), soundbuffer(0), frag_size(0), buffer_size(0), bytes_per_sample(0), - sleep_event(0), notify(0), has_sound(true), last_write_pos(-1) + sleep_event(0), notify(0), last_write_pos(-1) { HRESULT err; err = DirectSoundCreate(NULL, &directsound, NULL); @@ -173,7 +173,7 @@ CL_SoundOutput_DirectSound::~CL_SoundOutput_DirectSound() { - stop_mixer_thread(); + if (has_sound) stop_mixer_thread(); if (notify) notify->Release(); if (soundbuffer) soundbuffer->Release(); Modified: Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.h =================================================================== --- Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.h 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/Win32/soundoutput_directsound.h 2006-08-13 23:20:50 UTC (rev 1044) @@ -56,8 +56,6 @@ LPDIRECTSOUNDNOTIFY notify; - bool has_sound; - int last_write_pos; //! Operations: Modified: Development/ClanLib-0.8/Sources/Sound/soundoutput.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Sound/soundoutput.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/soundoutput.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -87,6 +87,12 @@ ///////////////////////////////////////////////////////////////////////////// // CL_SoundOutput attributes: +bool CL_SoundOutput::has_sound() const +{ + if (impl) return impl->has_sound; + return false; +} + const std::string &CL_SoundOutput::get_name() const { CL_MutexSection mutex_lock(&impl->mutex); Modified: Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.cpp =================================================================== --- Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.cpp 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.cpp 2006-08-13 23:20:50 UTC (rev 1044) @@ -37,7 +37,7 @@ // CL_SoundOutput_Generic construction: CL_SoundOutput_Generic::CL_SoundOutput_Generic(int mixing_frequency) : - mixing_frequency(mixing_frequency), volume(1.0f), pan(0.0f), mix_buffer_size(0), ref_count(0) + mixing_frequency(mixing_frequency), volume(1.0f), pan(0.0f), mix_buffer_size(0), has_sound(true), ref_count(0) { mix_buffers[0] = 0; mix_buffers[1] = 0; Modified: Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.h =================================================================== --- Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.h 2006-08-10 14:45:11 UTC (rev 1043) +++ Development/ClanLib-0.8/Sources/Sound/soundoutput_generic.h 2006-08-13 23:20:50 UTC (rev 1044) @@ -83,6 +83,8 @@ short *stereo_buffer; + bool has_sound; + //! Operations: public: void add_ref(); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-10 14:47:01
|
Author: mbn Date: 2006-08-10 16:45:11 +0200 (Thu, 10 Aug 2006) New Revision: 1043 Modified: Development/ClanLib-0.9/Sources/Core/XML/dom_element.cpp Log: - Added recursiveness and support for CDATA sections to CL_DomElement::get_text(). Modified: Development/ClanLib-0.9/Sources/Core/XML/dom_element.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Core/XML/dom_element.cpp 2006-08-10 11:43:47 UTC (rev 1042) +++ Development/ClanLib-0.9/Sources/Core/XML/dom_element.cpp 2006-08-10 14:45:11 UTC (rev 1043) @@ -259,8 +259,10 @@ CL_DomNode cur = get_first_child(); while (!cur.is_null()) { - if (cur.is_text()) + if (cur.is_text() || cur.is_cdata_section()) str.append(cur.get_node_value()); + if (cur.is_element()) + str.append(cur.to_element().get_text()); cur = cur.get_next_sibling(); } return str; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-10 11:45:36
|
Author: mbn Date: 2006-08-10 13:43:47 +0200 (Thu, 10 Aug 2006) New Revision: 1042 Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_component.h Development/ClanLib-0.9/Sources/API/GUI/gui_component_parent.h Development/ClanLib-0.9/Sources/API/GUI/gui_manager.h Development/ClanLib-0.9/Sources/API/GUI/gui_message.h Development/ClanLib-0.9/Sources/API/GUI/gui_message_input.h Development/ClanLib-0.9/Sources/API/GUI/gui_theme.h Development/ClanLib-0.9/Sources/API/GUI/gui_theme_default.h Development/ClanLib-0.9/Sources/API/GUI/gui_theme_part.h Development/ClanLib-0.9/Sources/GUI/gui_manager.cpp Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.cpp Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.h Development/ClanLib-0.9/Sources/GUI/gui_theme_part.cpp Log: - GUI reference documentation. - Minor clean-up of code. Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_component.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_component.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_component.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -94,6 +94,7 @@ //: Returns true if the component has the focus. bool has_focus() const; + //: Focus policies. enum FocusPolicy { focus_refuse, @@ -101,6 +102,7 @@ focus_parent }; + //: Returns the focus policy of the component. FocusPolicy get_focus_policy() const; //: Returns the GUI manager owning this component. @@ -124,12 +126,12 @@ CL_GUIComponent *get_last_child(); + //: Returns true if the component has any child components. + bool has_child_components() const; + //: Returns the previous sibling component. const CL_GUIComponent *get_previous_sibling() const; - //: Returns true if the component has any child components. - bool has_child_components() const; - CL_GUIComponent *get_previous_sibling(); //: Returns the next sibling component. @@ -226,7 +228,6 @@ //! Implementation: private: - CL_SharedPtr<CL_GUIComponent_Impl> impl; friend class CL_GUIManager; Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_component_parent.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_component_parent.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_component_parent.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -45,6 +45,7 @@ //! Attributes: public: + //: Returns true if the parent is the GUI manager. virtual bool is_gui_manager() const { return false; } }; Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_manager.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_manager.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_manager.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -63,12 +63,16 @@ //! Attributes: public: + //: Returns true if the parent is the GUI manager. bool is_gui_manager() const { return true; } + //: Returns the GUI theme being used. CL_GUITheme *get_theme() const; + //: Returns the CSS document being used. CL_CSSDocument get_css_document() const; + //: Returns the resource manager for the GUI resources. CL_ResourceManager get_resources() const; //! Events: @@ -78,14 +82,19 @@ //! Operations: public: + //: Sets the GUI theme. void set_theme(CL_GUITheme *theme); + //: Sets the CSS document. void set_css_document(CL_CSSDocument css); + //: Sets the resource manager for the GUI resources. void set_resources(CL_ResourceManager resources); + //: Processes messages until exit_with_code is called. int exec(); + //: Breaks the message loop. void exit_with_code(int exit_code); //: Post GUI message onto the message queue. @@ -95,17 +104,11 @@ //: Send GUI message directly to the target. void send_message(const CL_GUIMessage &message); - // Request an asynchronous redraw of the specified area. + // Mark the specified area to be redrawn. void invalidate_rect(const CL_Rect &rect, CL_GUIComponent *root_component); //! Implementation: private: - bool local_process_message(const CL_GUIMessage &msg); - - CL_GUIComponent *get_component_at(const CL_Point &pos); - - CL_GUIComponent *get_focus_component(); - CL_SharedPtr<CL_GUIManager_Impl> impl; friend class CL_GUIComponent_Impl; Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_message.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_message.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_message.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -45,24 +45,31 @@ { //! Construction: public: + //: Constructs a GUI message. CL_GUIMessage(); virtual ~CL_GUIMessage(); //! Attributes: public: + //: Returns the message type name. CL_StringRef get_type() const; + //: Returns the stored data object for a given data name. CL_UnknownSharedPtr get_data(const CL_StringRef &data_name) const; + //: Returns the target destination of the message. CL_GUIComponent *get_target() const; //! Operations: public: + //: Sets the message type name. void set_type(const CL_StringRef &type); + //: Stores an object in the given data name slot. void set_data(const CL_StringRef &data_name, const CL_UnknownSharedPtr &ptr); + //: Sets the target destination. void set_target(CL_GUIComponent *target); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_message_input.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_message_input.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_message_input.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -45,6 +45,7 @@ { //! Construction: public: + //: Constructs an input GUI message. CL_GUIMessage_Input(); CL_GUIMessage_Input(const CL_GUIMessage &message); @@ -53,10 +54,12 @@ //! Attributes: public: + //: Retrieves the input event for this message. CL_InputEvent get_event() const; //! Operations: public: + //: Sets the input event. void set_event(const CL_InputEvent &event); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_theme.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_theme.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_theme.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -52,35 +52,52 @@ public: virtual ~CL_GUITheme() { return; } +//! Attributes: +public: + //: Allows the theme to alter GUI part properties. + //- <p>When a component queries a theme part for a property, the property + //- is searched in the CSS document and then passed to get_property. If + //- the theme does not wish to alter the value of the property, it simply + //- returns the css_value parameter. The string returned by this function + //- is the result of CL_GUIThemePart::get_property.</p> virtual CL_StringRef get_property( const CL_GUIThemePart &part, const CL_StringRef &name, const CL_StringRef &css_value) = 0; - -//! Attributes: -public: + + //: Returns the resource manager associated with the theme. virtual CL_ResourceManager get_resources() const = 0; + //: Retrieves the minimum geometry size allowed by a theme part. virtual CL_Size get_minimum_size(const CL_GUIThemePart &part) const = 0; + //: Retrieves the maximum geometry size allowed by a theme part. virtual CL_Size get_maximum_size(const CL_GUIThemePart &part) const = 0; + //: Retrieves the preferred geometry size of a theme part. virtual CL_Size get_preferred_size(const CL_GUIThemePart &part) const = 0; + //: Returns the content box for a given render box. virtual CL_Rect get_content_box(const CL_GUIThemePart &part, const CL_Rect &render_box_rect) const = 0; + //: Returns the render box for a given content box. virtual CL_Rect get_render_box(const CL_GUIThemePart &part, const CL_Rect &content_box_rect) const = 0; //! Operations: public: + //: Sets the resource manager to be used to retrieve resources. virtual void set_resources(CL_ResourceManager resources) = 0; + //: Renders a background box for the given theme part. virtual void render_box( CL_GUIThemePart &part, CL_GraphicContext &gc, const CL_Rect &rect, const CL_Rect &clip_rect) = 0; + //: Notifies the theme that a component has been destroyed. + //- <p>This notification allows a theme to clean up cached theme part + //- resources used by the component.</p> virtual void component_destroyed(CL_GUIComponent *component) = 0; }; Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_theme_default.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_theme_default.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_theme_default.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -49,34 +49,53 @@ { //! Construction: public: + //: Constructs a default GUI theme. CL_GUIThemeDefault(); + virtual ~CL_GUIThemeDefault(); //! Attributes: public: + //: Allows the theme to alter GUI part properties. + //- <p>When a component queries a theme part for a property, the property + //- is searched in the CSS document and then passed to get_property. If + //- the theme does not wish to alter the value of the property, it simply + //- returns the css_value parameter. The string returned by this function + //- is the result of CL_GUIThemePart::get_property.</p> virtual CL_StringRef get_property( const CL_GUIThemePart &part, const CL_StringRef &name, const CL_StringRef &css_value); + //: Returns the resource manager associated with the theme. virtual CL_ResourceManager get_resources() const; + //: Retrieves the minimum geometry size allowed by a theme part. virtual CL_Size get_minimum_size(const CL_GUIThemePart &part) const; + //: Retrieves the maximum geometry size allowed by a theme part. virtual CL_Size get_maximum_size(const CL_GUIThemePart &part) const; + //: Retrieves the preferred geometry size of a theme part. virtual CL_Size get_preferred_size(const CL_GUIThemePart &part) const; + //: Returns the content box for a given render box. virtual CL_Rect get_content_box(const CL_GUIThemePart &part, const CL_Rect &render_box_rect) const; + //: Returns the render box for a given content box. virtual CL_Rect get_render_box(const CL_GUIThemePart &part, const CL_Rect &content_box_rect) const; //! Operations: public: + //: Sets the resource manager to be used to retrieve resources. virtual void set_resources(CL_ResourceManager resources); + //: Renders a background box for the given theme part. virtual void render_box(CL_GUIThemePart &part, CL_GraphicContext &gc, const CL_Rect &rect, const CL_Rect &clip_rect); + //: Notifies the theme that a component has been destroyed. + //- <p>This notification allows a theme to clean up cached theme part + //- resources used by the component.</p> virtual void component_destroyed(CL_GUIComponent *component); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/GUI/gui_theme_part.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GUI/gui_theme_part.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/API/GUI/gui_theme_part.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -49,6 +49,7 @@ { //! Construction: public: + //: Constructs a GUI theme part. CL_GUIThemePart( CL_ComponentParent *component, const CL_StringRef &relative_element_name = CL_StringRef()); @@ -63,15 +64,6 @@ //: Returns the CSS element name for the part in its current states. CL_String get_element_name() const; - //: Returns the part type name. - CL_StringRef get_type_name() const; - - //: Returns the part class name. - CL_StringRef get_class_name() const; - - //: Returns the part ID name. - CL_StringRef get_id_name() const; - //: Returns the value of a property. CL_StringRef get_property( const CL_StringRef &name, @@ -117,12 +109,6 @@ //! Operations: public: - void set_type_name(const CL_StringRef &type_name); - - void set_class_name(const CL_StringRef &class_name); - - void set_id_name(const CL_StringRef &id_name); - //: Sets a part state. void set_state(const CL_StringRef &name, bool flag); Modified: Development/ClanLib-0.9/Sources/GUI/gui_manager.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GUI/gui_manager.cpp 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/GUI/gui_manager.cpp 2006-08-10 11:43:47 UTC (rev 1042) @@ -131,7 +131,7 @@ std::vector<CL_GUIMessage>::size_type queue_index; for (queue_index = 0; queue_index < local_message_queue.size(); queue_index++) { - if( local_process_message(local_message_queue[queue_index]) ) + if (impl->local_process_message(local_message_queue[queue_index])) continue; try @@ -189,29 +189,7 @@ void CL_GUIManager::send_message(const CL_GUIMessage &message) { - CL_GUIMessage m = message; - - if( m.get_target() == 0 ) - { - bool target_set = false; - if( m.get_type() == "input" ) - { - CL_GUIMessage_Input im = m; - CL_InputEvent::Type type = im.get_event().type; - if( type == CL_InputEvent::pressed || type == CL_InputEvent::released ) - { - m.set_target(get_component_at(im.get_event().mouse_pos)); - target_set = true; - } - } - if( !target_set ) - m.set_target(get_focus_component()); - } - - if (impl->func_filter_message.is_null() || impl->func_filter_message.invoke(message)) - if (m.get_target()) - if (m.get_target()->func_process_message().is_null() == false) - m.get_target()->func_process_message().invoke(m); + impl->send_message(message); } void CL_GUIManager::invalidate_rect(const CL_Rect &rect, CL_GUIComponent *root_component) @@ -230,113 +208,3 @@ ///////////////////////////////////////////////////////////////////////////// // CL_GUIManager Implementation: - -CL_GUIComponent *CL_GUIManager::get_focus_component() -{ - std::vector<CL_ComponentTreeRoot>::size_type pos, size; - size = impl->root_components.size(); - - for( pos = 0; pos < size; pos++ ) - { - if( impl->root_components[pos].window.has_focus() ) - { - return impl->root_components[pos].focused_component; - } - } - - return 0; -} - - -CL_GUIComponent *CL_GUIManager::get_component_at(const CL_Point &point) -{ - std::vector<CL_ComponentTreeRoot>::size_type pos, size; - size = impl->root_components.size(); - - for( pos = 0; pos < size; pos++ ) - { - if( impl->root_components[pos].window.has_focus() ) - { - return impl->root_components[pos].component->get_component_at(point); - } - } - - return 0; -} - -bool CL_GUIManager::local_process_message(const CL_GUIMessage &msg) -{ - if( msg.get_type() == "paint" ) - { - std::vector<CL_ComponentTreeRoot>::size_type pos, size; - size = impl->root_components.size(); - - for( pos = 0; pos < size; pos++ ) - { - if( msg.get_target() == impl->root_components[pos].component ) - { - if (impl->root_components[pos].update_regions.size() > 4) - { - CL_Rect rect = impl->root_components[pos].component->get_geometry(); - impl->root_components[pos].component->paint(rect); - } - else - { - for( std::size_t i=0; i < impl->root_components[pos].update_regions.size(); i++ ) - { - CL_Rect &rect = impl->root_components[pos].update_regions[i]; - impl->root_components[pos].component->paint(rect); - } - } - impl->root_components[pos].update_regions.clear(); - return true; - } - } - } - else if( msg.get_type() == "input" ) - { - CL_GUIMessage_Input im = msg; - CL_InputEvent::Type type = im.get_event().type; - - if( type == CL_InputEvent::pointer_moved ) - { - std::vector<CL_ComponentTreeRoot>::size_type rcomp, size; - size = impl->root_components.size(); - - for( rcomp = 0; rcomp < size; rcomp++ ) - { - if( impl->root_components[rcomp].window.has_focus() ) - { - break; - } - } - if (rcomp == size) - return true; - - CL_GUIComponent *comp = impl->root_components[rcomp].component->get_component_at(im.get_event().mouse_pos); - - if( comp != impl->root_components[rcomp].mouse_over_component ) - { - if( impl->root_components[rcomp].mouse_over_component != 0 ) - { - CL_GUIMessage msg; - msg.set_type("pointer leave"); - msg.set_target(impl->root_components[rcomp].mouse_over_component); - send_message(msg); - } - - impl->root_components[rcomp].mouse_over_component = comp; - - if( comp ) - { - CL_GUIMessage msg; - msg.set_type("pointer enter"); - msg.set_target(comp); - send_message(msg); - } - } - } - } - - return false; -} Modified: Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.cpp 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.cpp 2006-08-10 11:43:47 UTC (rev 1042) @@ -163,6 +163,142 @@ message_queue.push_back(message); } +void CL_GUIManager_Impl::send_message(const CL_GUIMessage &message) +{ + CL_GUIMessage m = message; + + if( m.get_target() == 0 ) + { + bool target_set = false; + if( m.get_type() == "input" ) + { + CL_GUIMessage_Input im = m; + CL_InputEvent::Type type = im.get_event().type; + if( type == CL_InputEvent::pressed || type == CL_InputEvent::released ) + { + m.set_target(get_component_at(im.get_event().mouse_pos)); + target_set = true; + } + } + if( !target_set ) + m.set_target(get_focus_component()); + } + + if (func_filter_message.is_null() || func_filter_message.invoke(message)) + if (m.get_target()) + if (m.get_target()->func_process_message().is_null() == false) + m.get_target()->func_process_message().invoke(m); +} + +CL_GUIComponent *CL_GUIManager_Impl::get_focus_component() +{ + std::vector<CL_ComponentTreeRoot>::size_type pos, size; + size = root_components.size(); + + for( pos = 0; pos < size; pos++ ) + { + if( root_components[pos].window.has_focus() ) + { + return root_components[pos].focused_component; + } + } + + return 0; +} + +CL_GUIComponent *CL_GUIManager_Impl::get_component_at(const CL_Point &point) +{ + std::vector<CL_ComponentTreeRoot>::size_type pos, size; + size = root_components.size(); + + for( pos = 0; pos < size; pos++ ) + { + if( root_components[pos].window.has_focus() ) + { + return root_components[pos].component->get_component_at(point); + } + } + + return 0; +} + +bool CL_GUIManager_Impl::local_process_message(const CL_GUIMessage &msg) +{ + if( msg.get_type() == "paint" ) + { + std::vector<CL_ComponentTreeRoot>::size_type pos, size; + size = root_components.size(); + + for( pos = 0; pos < size; pos++ ) + { + if( msg.get_target() == root_components[pos].component ) + { + if (root_components[pos].update_regions.size() > 4) + { + CL_Rect rect = root_components[pos].component->get_geometry(); + root_components[pos].component->paint(rect); + } + else + { + for( std::size_t i=0; i < root_components[pos].update_regions.size(); i++ ) + { + CL_Rect &rect = root_components[pos].update_regions[i]; + root_components[pos].component->paint(rect); + } + } + root_components[pos].update_regions.clear(); + return true; + } + } + } + else if( msg.get_type() == "input" ) + { + CL_GUIMessage_Input im = msg; + CL_InputEvent::Type type = im.get_event().type; + + if( type == CL_InputEvent::pointer_moved ) + { + std::vector<CL_ComponentTreeRoot>::size_type rcomp, size; + size = root_components.size(); + + for( rcomp = 0; rcomp < size; rcomp++ ) + { + if( root_components[rcomp].window.has_focus() ) + { + break; + } + } + if (rcomp == size) + return true; + + CL_GUIComponent *comp = root_components[rcomp].component->get_component_at(im.get_event().mouse_pos); + + if( comp != root_components[rcomp].mouse_over_component ) + { + if( root_components[rcomp].mouse_over_component != 0 ) + { + CL_GUIMessage msg; + msg.set_type("pointer leave"); + msg.set_target(root_components[rcomp].mouse_over_component); + send_message(msg); + } + + root_components[rcomp].mouse_over_component = comp; + + if( comp ) + { + CL_GUIMessage msg; + msg.set_type("pointer enter"); + msg.set_target(comp); + send_message(msg); + } + } + } + } + + return false; +} + void CL_GUIManager_Impl::on_displaywindow_lost_focus(CL_GUIComponent *component) { std::vector<CL_ComponentTreeRoot>::size_type index, size; @@ -253,6 +389,5 @@ } } - ///////////////////////////////////////////////////////////////////////////// // CL_GUIManager_Impl Implementation: Modified: Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.h =================================================================== --- Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.h 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/GUI/gui_manager_impl.h 2006-08-10 11:43:47 UTC (rev 1042) @@ -99,6 +99,14 @@ void post_message(const CL_GUIMessage &message); + void send_message(const CL_GUIMessage &message); + + bool local_process_message(const CL_GUIMessage &msg); + + CL_GUIComponent *get_component_at(const CL_Point &pos); + + CL_GUIComponent *get_focus_component(); + void on_displaywindow_lost_focus(CL_GUIComponent *component); void on_displaywindow_got_focus(CL_GUIComponent *component); Modified: Development/ClanLib-0.9/Sources/GUI/gui_theme_part.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GUI/gui_theme_part.cpp 2006-08-10 10:56:56 UTC (rev 1041) +++ Development/ClanLib-0.9/Sources/GUI/gui_theme_part.cpp 2006-08-10 11:43:47 UTC (rev 1042) @@ -50,8 +50,6 @@ CL_String relative_element_name; - CL_String type_name, class_name, id_name; - std::vector<CL_String> states; }; @@ -102,21 +100,6 @@ return component->get_element_name(); } -CL_StringRef CL_GUIThemePart::get_type_name() const -{ - return impl->type_name; -} - -CL_StringRef CL_GUIThemePart::get_class_name() const -{ - return impl->class_name; -} - -CL_StringRef CL_GUIThemePart::get_id_name() const -{ - return impl->id_name; -} - CL_StringRef CL_GUIThemePart::get_property( const CL_StringRef &name, const CL_StringRef &default_value) const @@ -293,21 +276,6 @@ ///////////////////////////////////////////////////////////////////////////// // CL_GUIThemePart Operations: -void CL_GUIThemePart::set_type_name(const CL_StringRef &type_name) -{ - impl->type_name = type_name; -} - -void CL_GUIThemePart::set_class_name(const CL_StringRef &class_name) -{ - impl->class_name = class_name; -} - -void CL_GUIThemePart::set_id_name(const CL_StringRef &id_name) -{ - impl->id_name = id_name; -} - void CL_GUIThemePart::set_state(const CL_StringRef &name, bool flag) { std::vector<CL_String>::size_type index, size; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-10 10:58:43
|
Author: mbn Date: 2006-08-10 12:56:56 +0200 (Thu, 10 Aug 2006) New Revision: 1041 Modified: Development/ClanLib-0.9/Sources/API/GL/setup_gl.h Development/ClanLib-0.9/Sources/GL/setup_gl.cpp Log: - Moved stuff out of API space. Modified: Development/ClanLib-0.9/Sources/API/GL/setup_gl.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GL/setup_gl.h 2006-08-10 10:50:15 UTC (rev 1040) +++ Development/ClanLib-0.9/Sources/API/GL/setup_gl.h 2006-08-10 10:56:56 UTC (rev 1041) @@ -38,8 +38,6 @@ #include "api_gl.h" -class CL_OpenGLTarget; - //: ClanGL initialization functions. //- !group=GL/System! //- !header=gl.h! @@ -51,9 +49,6 @@ CL_SetupGL(); ~CL_SetupGL(); - -private: - CL_OpenGLTarget *target; }; #endif Modified: Development/ClanLib-0.9/Sources/GL/setup_gl.cpp =================================================================== --- Development/ClanLib-0.9/Sources/GL/setup_gl.cpp 2006-08-10 10:50:15 UTC (rev 1040) +++ Development/ClanLib-0.9/Sources/GL/setup_gl.cpp 2006-08-10 10:56:56 UTC (rev 1041) @@ -33,12 +33,24 @@ ///////////////////////////////////////////////////////////////////////////// // CL_SetupGL Construction: +static CL_Mutex cl_opengl_mutex; + +static int cl_opengl_refcount = 0; + +static CL_OpenGLTarget *cl_opengl_target = 0; + CL_SetupGL::CL_SetupGL() { - target = new CL_OpenGLTarget(); + CL_MutexSection mutex_lock(&cl_opengl_mutex); + if (cl_opengl_refcount == 0) + cl_opengl_target = new CL_OpenGLTarget(); + cl_opengl_refcount++; } CL_SetupGL::~CL_SetupGL() { - delete target; + CL_MutexSection mutex_lock(&cl_opengl_mutex); + cl_opengl_refcount--; + if (cl_opengl_refcount == 0) + delete cl_opengl_target; } |
From: Changes to t. C. r. <cla...@li...> - 2006-08-10 10:52:07
|
Author: mbn Date: 2006-08-10 12:50:15 +0200 (Thu, 10 Aug 2006) New Revision: 1040 Modified: Development/ClanLib-0.9/Sources/API/Display/mouse.h Development/ClanLib-0.9/Sources/API/GL/opengl_target.h Log: - Minor doc changes. Modified: Development/ClanLib-0.9/Sources/API/Display/mouse.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/mouse.h 2006-08-08 15:04:03 UTC (rev 1039) +++ Development/ClanLib-0.9/Sources/API/Display/mouse.h 2006-08-10 10:50:15 UTC (rev 1040) @@ -69,7 +69,6 @@ static bool get_keycode(int keycode, int mouse = 0); //: Key name for specified identifier (Mouse Left, Mouse Right). -// static std::string get_key_name(int id); static CL_String get_key_name(int id); //! Operations: Modified: Development/ClanLib-0.9/Sources/API/GL/opengl_target.h =================================================================== --- Development/ClanLib-0.9/Sources/API/GL/opengl_target.h 2006-08-08 15:04:03 UTC (rev 1039) +++ Development/ClanLib-0.9/Sources/API/GL/opengl_target.h 2006-08-10 10:50:15 UTC (rev 1040) @@ -47,6 +47,7 @@ { //! Construction: public: + //: Constructs an OpenGL target. CL_OpenGLTarget(); ~CL_OpenGLTarget(); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-08 15:06:02
|
Author: mbn Date: 2006-08-08 17:04:03 +0200 (Tue, 08 Aug 2006) New Revision: 1039 Modified: Development/ClanLib-0.9/Sources/API/Display/buffer_control.h Development/ClanLib-0.9/Sources/API/Display/display_target.h Development/ClanLib-0.9/Sources/API/Display/display_target_provider.h Development/ClanLib-0.9/Sources/API/Display/display_window.h Development/ClanLib-0.9/Sources/API/Display/display_window_provider.h Development/ClanLib-0.9/Sources/API/Display/font.h Development/ClanLib-0.9/Sources/API/Display/font_metrics.h Development/ClanLib-0.9/Sources/API/Display/font_provider.h Development/ClanLib-0.9/Sources/API/Display/gradient.h Development/ClanLib-0.9/Sources/API/Display/graphic_context.h Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h Development/ClanLib-0.9/Sources/API/Display/input_device_provider.h Development/ClanLib-0.9/Sources/API/Display/occlusion_query.h Development/ClanLib-0.9/Sources/API/Display/occlusion_query_provider.h Development/ClanLib-0.9/Sources/API/Display/pen.h Development/ClanLib-0.9/Sources/API/Display/polygon_rasterizer.h Development/ClanLib-0.9/Sources/API/Display/primitives_array.h Development/ClanLib-0.9/Sources/API/Display/rect_primitive.h Development/ClanLib-0.9/Sources/API/Display/shader_object_provider.h Development/ClanLib-0.9/Sources/API/Display/static_lines_array.h Development/ClanLib-0.9/Sources/API/Display/static_triangles_array.h Development/ClanLib-0.9/Sources/API/Display/subtexture.h Development/ClanLib-0.9/Sources/API/Display/texture.h Development/ClanLib-0.9/Sources/API/Display/texture_group.h Development/ClanLib-0.9/Sources/API/Display/texture_provider.h Development/ClanLib-0.9/Sources/API/Display/texture_unit.h Development/ClanLib-0.9/Sources/API/Display/vector_font.h Log: - Added documentation. Modified: Development/ClanLib-0.9/Sources/API/Display/buffer_control.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -76,7 +76,7 @@ class CL_BufferControl_Impl; -//: Container class for states related to reading, writing and tests performed of buffers. +//: Container class for states related to reading, writing and tests performed on buffers. //- !group=Display/Display! //- !header=display.h! class CL_API_DISPLAY CL_BufferControl Modified: Development/ClanLib-0.9/Sources/API/Display/display_target.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/display_target.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/display_target.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -46,6 +46,7 @@ { //! Construction: public: + //: Constructs a display target. CL_DisplayTarget(); CL_DisplayTarget(CL_DisplayTargetProvider *provider); @@ -54,9 +55,10 @@ //! Attributes: public: + //: Returns the provider for the display target. CL_DisplayTargetProvider *get_provider(); - //: returns true if this display target is invalid + //: Returns true if this display target is invalid. bool is_null() const; //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/display_target_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/display_target_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/display_target_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -52,8 +52,10 @@ //! Operations: public: + //: Destroys the provider. virtual void destroy() = 0; + //: Allocates a display window provider. virtual CL_DisplayWindowProvider *alloc_display_window() = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/display_window.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/display_window.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/display_window.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -203,6 +203,7 @@ //: Hides the mouse cursor. void hide_cursor(); + //: Processes the message queue. void process_messages(); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/display_window_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/display_window_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/display_window_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -44,20 +44,26 @@ class CL_GraphicContext; class CL_InputContext; +//: Display Window site. //- !group=Display/Display! //- !header=display.h! class CL_API_DISPLAY CL_DisplayWindowSite { //! Attributes: public: + //: Pointer to lost focus signal. CL_Signal_v0 *sig_lost_focus; + //: Pointer to got focus signal. CL_Signal_v0 *sig_got_focus; + //: Pointer to resize signal. CL_Signal_v2<int, int> *sig_resize; + //: Pointer to paint signal. CL_Signal_v1<const CL_Rect &> *sig_paint; + //: Pointer to window close signal. CL_Signal_v0 *sig_window_close; }; @@ -72,28 +78,39 @@ //! Attributes: public: + //: Returns the position and size of the window frame. virtual CL_Rect get_geometry() const = 0; + //: Returns the drawable area of the window. virtual CL_Rect get_viewport() const = 0; + //: Returns true if window has focus. virtual bool has_focus() const = 0; + //: Return the graphic context for the window. virtual CL_GraphicContext get_gc() const = 0; + //: Return the input context for the window. virtual CL_InputContext get_ic() const = 0; //! Operations: public: + //: Destroys the display window provider. virtual void destroy() = 0; + //: Creates window, assigning site and description to provider. virtual void create(CL_DisplayWindowSite *site, const CL_DisplayWindowDescription &description) = 0; + //: Shows the mouse cursor. virtual void show_system_cursor() = 0; + //: Hides the mouse cursor. virtual void hide_system_cursor() = 0; + //: Change window title. virtual void set_title(const CL_StringRef &new_title) = 0; + //: Set window position and size. virtual void set_position(const CL_Rect &pos) = 0; virtual void set_size(int width, int height) = 0; @@ -119,6 +136,7 @@ //: Copy a region of the backbuffer to the frontbuffer. virtual void update(const CL_Rect &rect) = 0; + //: Processes the message queue. virtual void process_messages() = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/font.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/font.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/font.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -46,6 +46,7 @@ { //! Construction: public: + //: Constructs a font. CL_Font(); CL_Font( @@ -67,6 +68,7 @@ //! Attributes: public: + //: Retrieves the font provider. CL_FontProvider *get_provider(); //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/font_metrics.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/font_metrics.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/font_metrics.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -45,6 +45,7 @@ { //! Construction: public: + //: Constructs a font metrics description. CL_FontMetrics(); CL_FontMetrics( @@ -70,42 +71,63 @@ //! Attributes: public: + //: Returns the height of the font. double get_height() const; + //: Returns the font ascender. double get_ascent() const; + //: Returns the font descender. double get_descent() const; + //: Returns the amount of leading (space) inside the bounds set by the get_height() function. double get_internal_leading() const; + //: Returns the amount of extra leading (space) that the application adds between rows. double get_external_leading() const; + //: Returns the average width of characters in the font. + //- <p>The average width is generally defined as the width of the letter x. The + //- value does not include the overhang required for bold or italic characters.</p> double get_average_character_width() const; + //: Returns the width of the widest character in the font. double get_max_character_width() const; + //: Returns the weight of the font. double get_weight() const; + //: Returns the extra width per string that may be added to some synthesized fonts. double get_overhang() const; + //: Returns the horizontal aspect of the device for which the font was designed. double get_digitized_aspect_x() const; + //: Returns the vertical aspect of the device for which the font was designed. double get_digitized_aspect_y() const; + //: Returns the value of the first character defined in the font. CL_String::CharacterType get_first_char() const; + //: Returns the value of the last character defined in the font CL_String::CharacterType get_last_char() const; + //: Returns the value of the character to be substituted for characters not in the font. CL_String::CharacterType get_default_char() const; + //: Returns the value of the character that will be used to define word breaks for text justification. CL_String::CharacterType get_word_break_char() const; + //: Returns true if the font is italic. bool is_italic() const; + //: Returns true if the font is underlined. bool is_underlined() const; + //: Returns true if the font is struck out. bool is_struck_out() const; + //: Returns true if the font is a mono space font. bool is_fixed_pitch() const; //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/font_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/font_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/font_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -48,8 +48,10 @@ //! Operations: public: + //: Destroys the font provider. virtual void destroy() = 0; + //: Creates the font. virtual void create( const CL_StringRef &typeface_name, int height, Modified: Development/ClanLib-0.9/Sources/API/Display/gradient.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/gradient.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/gradient.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -71,20 +71,26 @@ //! Attributes: public: + //: Color of top left corner of gradient. CL_Colord top_left; + //: Color of top right corner of gradient. CL_Colord top_right; + //: Color of bottom left corner of gradient. CL_Colord bottom_left; + //: Color of bottom right corner of gradient. CL_Colord bottom_right; + //: Compares gradient to another one. bool operator==(const CL_Gradient &other) const { return top_left == other.top_left && top_right==other.top_right && bottom_left == other.bottom_left && bottom_right == bottom_right; } + //: Compares gradient to another one. bool operator!=(const CL_Gradient &other) const { return !(*this == other); Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/graphic_context.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/graphic_context.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -55,6 +55,7 @@ class CL_GraphicContext_Impl; class CL_ProgramObject; +//: Primitive types. //- !group=Display/Display! //- !header=display.h! enum CL_PrimitivesType @@ -71,6 +72,7 @@ cl_polygon }; +//: Mapping modes. //- !group=Display/Display! //- !header=display.h! enum CL_MapMode @@ -87,6 +89,7 @@ { //! Construction: public: + //: Constructs a graphic context. CL_GraphicContext(); CL_GraphicContext(CL_GraphicContextProvider *provider); @@ -95,26 +98,37 @@ //! Attributes: public: + //: Returns the texture unit description for the specified unit. CL_TextureUnit get_texture_unit(int unit); + //: Returns the amount of texture units available. int get_texture_unit_count(); + //: Returns the currently selected texture for the specified unit. CL_Texture get_texture(int unit); + //: Returns the light source description for the given light source. CL_LightSource get_light(int light); + //: Returns the amount of light sources available. int get_light_count(); + //: Returns the blending mode description. CL_BlendMode get_blend_mode(); + //: Returns the buffer control description. CL_BufferControl get_buffer_control(); + //: Returns the polygon rasterizer setup. CL_PolygonRasterizer get_polygon_rasterizer(); + //: Returns the currently selected pen. CL_Pen get_pen(); + //: Returns the currently selected font. CL_Font get_font(); + //: Retrieves font metrics description for the selected font. CL_FontMetrics get_font_metrics(); //: Returns the current width of the context. @@ -131,54 +145,67 @@ //: Returns the maximum size of a texture this graphic context supports. //- <p>It returns CL_Size(0,0) if there is no known limitation to the max - //- texture size. Of course it is still limited by available memory, - //- which is not considered by this function.</p> + //- texture size.</p> CL_Size get_max_texture_size() const; + //: Returns the provider for this graphic context. CL_GraphicContextProvider *get_provider(); //! Operations: public: - //: Return the content of the back buffer into a pixel buffer. + //: Return the content of the draw buffer into a pixel buffer. CL_PixelBuffer get_pixeldata(const CL_Rect& rect = CL_Rect(0,0,0,0)) const; + //: Setup texture unit. void set_texture_unit(int unit_index, const CL_TextureUnit &unit); + //: Select texture into unit. void set_texture(int unit_index, const CL_Texture &texture); + //: Set active program object. void set_program_object(const CL_ProgramObject &program); + //: Set light source. void set_light(int light_index, const CL_LightSource &light); + //: Set blending modes. void set_blend_mode(const CL_BlendMode &blend_mode); + //: Set buffer control states. void set_buffer_control(const CL_BufferControl &buffer_control); + //: Select pen. void set_pen(const CL_Pen &pen); + //: Set polygon rasterizer settings. void set_polygon_rasterizer(const CL_PolygonRasterizer &raster); + //: Select font. void set_font(const CL_Font &font); + //: Draw primitives on gc. void draw_primitives(CL_PrimitivesType type, const CL_PrimitivesArray &array); + //: Draw pixel buffer on gc. void draw_pixels(int x, int y, const CL_PixelBuffer &pixel_buffer); void draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer); + //: Print text on gc. void draw_text(double x, double y, const CL_StringRef &text, const CL_Colord &color = CL_Colord::white); + //: Calculate size of text string. CL_Sized get_text_size(const CL_StringRef &text); //: Clears the whole context using the specified color. void clear(const CL_Colord &color = CL_Colord::black); //: Clear the stencil buffer - //param value: value to clear to. Default: 0 + //param value: value to clear to. void clear_stencil(int value = 0); //: Clear the depth buffer - //param value: value to clear to. Range: 0.0 - 1.0. Default: 0 + //param value: value to clear to. Range: 0.0 - 1.0. void clear_depth(double value = 0); //: Set the current clipping rectangle. Modified: Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/graphic_context_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -65,70 +65,106 @@ //! Attributes: public: + //: Returns the amount of texture units available. virtual int get_texture_unit_count() = 0; + //: Returns the amount of light sources available. virtual int get_light_count() = 0; + //: Returns the maximum size of a texture this graphic context supports. + //- <p>It returns CL_Size(0,0) if there is no known limitation to the max + //- texture size.</p> virtual CL_Size get_max_texture_size() const = 0; + //: Returns the current width of the context. virtual int get_width() const = 0; + //: Returns the current height of the context. virtual int get_height() const = 0; //! Operations: public: + //: Destroys graphic context provider. virtual void destroy() = 0; + //: Return the content of the draw buffer into a pixel buffer. virtual CL_PixelBuffer get_pixeldata(const CL_Rect& rect) = 0; + //: Allocate texture provider for this gc. virtual CL_TextureProvider *alloc_texture() = 0; + //: Allocate canvas for this gc. virtual CL_CanvasProvider *alloc_canvas() = 0; + //: Allocate font for this gc. virtual CL_FontProvider *alloc_font() = 0; + //: Allocate occlusion query provider of this gc. virtual CL_OcclusionQueryProvider *alloc_occlusion_query() = 0; + //: Allocate program object provider of this gc. virtual CL_ProgramObjectProvider *alloc_program_object() = 0; + //: Allocate shader object provider of this gc. virtual CL_ShaderObjectProvider *alloc_shader_object() = 0; + //: Set active program object. virtual void set_program_object(const CL_ProgramObject &program)=0; + //: Setup texture unit. virtual void set_texture_unit(int unit_index, const CL_TextureUnit &unit) = 0; + //: Select texture into unit. virtual void set_texture(int unit_index, const CL_Texture &texture) = 0; + //: Set light source. virtual void set_light(int light_index, const CL_LightSource &light) = 0; + //: Set blending modes. virtual void set_blend_mode(const CL_BlendMode &blendmode) = 0; + //: Set buffer control states. virtual void set_buffer_control(const CL_BufferControl &buffer_control) = 0; + //: Select pen. virtual void set_pen(const CL_Pen &pen) = 0; + //: Set polygon rasterizer settings. virtual void set_polygon_rasterizer(const CL_PolygonRasterizer &raster) = 0; + //: Select font. virtual void set_font(const CL_Font &font) = 0; + //: Draw primitives on gc. virtual void draw_primitives(CL_PrimitivesType type, const CL_PrimitivesArray &array) = 0; + //: Draw pixel buffer on gc. virtual void draw_pixels(int x, int y, double zoom_x, double zoom_y, const CL_PixelBuffer &pixel_buffer) = 0; + //: Print text on gc. virtual void draw_text(double x, double y, const CL_StringRef &text, const CL_Colord &color) = 0; + //: Calculate size of text string. virtual CL_Sized get_text_size(const CL_StringRef &text) = 0; + //: Clears the whole context using the specified color. virtual void clear(double red, double green, double blue, double alpha) = 0; + //: Clear the depth buffer + //param value: value to clear to. Range: 0.0 - 1.0. virtual void clear_depth(double value) = 0; + //: Clear the stencil buffer + //param value: value to clear to. virtual void clear_stencil(int value) = 0; + //: Set the projection mapping mode. virtual void set_map_mode(CL_MapMode mode) = 0; + //: Set the projection matrix to be used in user projection map mode. virtual void set_projection(const CL_Matrix4x4 &matrix) = 0; + //: Sets the model view matrix to a new matrix. virtual void set_modelview(const CL_Matrix4x4 &matrix) = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/input_device_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/input_device_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/input_device_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -47,6 +47,7 @@ public: virtual ~CL_InputDeviceProvider() { return; } + //: Destroys the input device provider. virtual void destroy() = 0; //! Attributes: Modified: Development/ClanLib-0.9/Sources/API/Display/occlusion_query.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/occlusion_query.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/occlusion_query.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -50,17 +50,25 @@ { //! Construction: public: + //: Constructs an occlusion query object. CL_OcclusionQuery(CL_GraphicContext context = CL_GraphicContext()); + virtual ~CL_OcclusionQuery(); //! Attributes: public: + //: Returns the result of the occlusion query. int get_result(); + + //: Returns true if the GPU is ready to return the result. bool is_result_ready(); //! Operations: public: + //: Start occlusion query. void begin(); + + //: Finish occlusion query. void end(); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/occlusion_query_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/occlusion_query_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/occlusion_query_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -50,18 +50,24 @@ //! Attributes: public: + //: Returns true if the GPU is ready to return the result. virtual bool is_result_ready() const = 0; + //: Returns the result of the occlusion query. virtual int get_result() const = 0; //! Operations: public: + //: Start occlusion query. virtual void begin() = 0; + //: Finish occlusion query. virtual void end() = 0; + //: Create occlusion query object. virtual void create() = 0; + //: Destroy occlusion query provider. virtual void destroy() = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/pen.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/pen.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/pen.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -48,6 +48,7 @@ { //!Construction public: + //: Constructs a pen description. CL_Pen(); virtual ~CL_Pen(); Modified: Development/ClanLib-0.9/Sources/API/Display/polygon_rasterizer.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/polygon_rasterizer.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/polygon_rasterizer.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -38,6 +38,7 @@ class CL_PolygonRasterizer_Impl; +//: Polygon culling modes. //- !group=Display/Display! //- !header=display.h! enum CL_CullMode @@ -47,6 +48,7 @@ cl_cull_front_and_back }; +//: Polygon filling modes. //- !group=Display/Display! //- !header=display.h! enum CL_FillMode @@ -63,39 +65,73 @@ { //! Construction: public: + //: Constructs a polygon rasterizer description. CL_PolygonRasterizer(); + virtual ~CL_PolygonRasterizer(); //! Attributes: public: + //: Returns true if the polygons are anti-aliased. bool is_antialiased() const; + + //: Returns true if cull testing is enabled. bool is_culled() const; + + //: Returns true if points are offset. bool is_point_offset() const; + + //: Returns true if lines are offset. bool is_line_offset() const; + + //: Returns true if polygons are offset. bool is_polygon_offset() const; + //: Returns the polygon cull clipping mode. CL_CullMode get_face_cull_mode() const; + //: Returns the filling mode for front-facing polygons. CL_FillMode get_face_fill_mode_front() const; + + //: Returns the filling mode for back-facing polygons. CL_FillMode get_face_fill_mode_back() const; + //: Returns the offsetting factor. float get_offset_factor() const; + + //: Returns the offsetting units. float get_offset_units() const; //! Operations: public: + //: Enables/disables anti-aliasing. void set_antialiased(bool value); + + //: Enables/disables polygon cull clipping. void set_culled(bool value); + + //: Enables/disables point offsetting. void set_point_offset(bool value); + + //: Enables/disables line offsetting. void set_line_offset(bool value); + + //: Enables/disables polygon offsetting. void set_polygon_offset(bool value); + //: Sets the polygon cull clipping mode. void set_face_cull_mode(CL_CullMode value); + //: Sets the filling mode for front-facing polygons. void set_face_fill_mode_front(CL_FillMode value); + + //: Sets the filling mode for back-facing polygons. void set_face_fill_mode_back(CL_FillMode value); + //: Sets the offset factor. void set_offset_factor(float value); + + //: Sets the offset units. void set_offset_units(float value); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/primitives_array.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/primitives_array.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/primitives_array.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -45,26 +45,56 @@ //! Attributes: public: + //: Primitives sub-array description. struct PrimitivesSubarray { + //: Number of vertices in array. int num_vertices; + + //: Vertex array. const double *vertex; + + //: Normal vectors array. const double *normal; + + //: Primary colors array. const double *primary_color; + + //: Secondary colors array. const double *secondary_color; + + //: Edge flag array. const bool *edge_flag; + + //: Fog coordinates array. const double *fog_coord; + + //: Number of texture unit arrays. int num_tex_units; + + //: Texture units' texture coordinates array. const double * const*tex_coords; + + //: Number of program attributes. int num_attribs; + + //: Program attributes array. const double *attribs[64]; + + //: Normalize program attribute flags. bool attribs_normalized[64]; + + //: Flag controlling if primary colors array is used. bool use_primary_color_array; + + //: Flag controlling if secondary colors array is used. bool use_secondary_color_array; }; + //: Returns a primitives sub-array. virtual void get_subarray(int index, PrimitivesSubarray &v) const = 0; + //: Returns the number of sub-arrays available. virtual int get_subarray_length() const = 0; //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/rect_primitive.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/rect_primitive.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/rect_primitive.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -31,10 +31,12 @@ #ifndef header_textured_rect_primitive #define header_textured_rect_primitive +//: Primitives array helper for creating a non-textured rectangle. //- !group=Display/Display! //- !header=display.h! class CL_API_DISPLAY CL_RectPrimitive : public CL_PrimitivesArray { +//! Construction: public: CL_RectPrimitive() : _index(0), constant_color_enabled(false) @@ -45,6 +47,8 @@ constant_color[3] = 1.0; } +//! Attributes: +public: void get_subarray(int index, PrimitivesSubarray &v) const { v.num_vertices = 6; @@ -65,6 +69,8 @@ return 1; } +//! Operations: +public: void vertex(double x, double y, double z = 0.0, double w = 1.0) { _vertex[_index*4 + 0] = x; @@ -116,6 +122,7 @@ constant_color[3] = color.get_alpha(); } +//! Implementation: private: double _vertex[6*4]; @@ -128,10 +135,12 @@ double constant_color[4]; }; +//: Primitives array helper for creating a textured rectangle. //- !group=Display/Display! //- !header=display.h! class CL_API_DISPLAY CL_TexturedRectPrimitive : public CL_PrimitivesArray { +//! Construction: public: CL_TexturedRectPrimitive() : _index(0), ptr_tex_coord(_tex_coord), constant_color_enabled(false) @@ -142,6 +151,8 @@ constant_color[3] = 1.0; } +//! Attributes: +public: void get_subarray(int index, PrimitivesSubarray &v) const { v.num_vertices = 6; @@ -162,6 +173,8 @@ return 1; } +//! Operations: +public: void vertex(double x, double y, double z = 0.0, double w = 1.0) { _vertex[_index*4 + 0] = x; @@ -229,6 +242,7 @@ constant_color[3] = color.get_alpha(); } +//! Implementation: private: double _vertex[6*4]; @@ -245,10 +259,12 @@ double constant_color[4]; }; +//: Primitives array helper for creating a multi-textured rectangle. //- !group=Display/Display! //- !header=display.h! class CL_API_DISPLAY CL_MultiTexturedRectPrimitive : public CL_PrimitivesArray { +//! Construction: public: CL_MultiTexturedRectPrimitive(int unit_count) : num_tex_units(unit_count), _index(0), constant_color_enabled(false) @@ -276,6 +292,8 @@ delete tex_coords; } +//! Attributes: +public: void get_subarray(int index, PrimitivesSubarray &v) const { v.num_vertices = 6; @@ -296,6 +314,8 @@ return 1; } +//! Operations: +public: void vertex(double x, double y, double z = 0.0, double w = 1.0) { _vertex[_index*4 + 0] = x; @@ -374,6 +394,7 @@ constant_color[3] = color.get_alpha(); } +//! Implementation: private: double _vertex[6*4]; @@ -390,5 +411,4 @@ double constant_color[4]; }; - #endif Modified: Development/ClanLib-0.9/Sources/API/Display/shader_object_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/shader_object_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/shader_object_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -44,10 +44,12 @@ public: virtual ~CL_ShaderObjectProvider() {}; + //: Creates a shader object. virtual void create(CL_ShaderType type, const CL_StringRef &source)=0; virtual void create(CL_ShaderType type, const std::vector<CL_StringRef> &sources)=0; + //: Destroys the shadoer object provider. virtual void destroy()=0; //! Attributes: Modified: Development/ClanLib-0.9/Sources/API/Display/static_lines_array.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/static_lines_array.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/static_lines_array.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -36,6 +36,7 @@ #include "../Display/color.h" #include "../Core/Math/ear_clip_triangulator.h" +//: Primitives array helper for creating lines. //- !group=Display/Display! //- !header=display.h! class CL_StaticLinesArray : public CL_PrimitivesArray Modified: Development/ClanLib-0.9/Sources/API/Display/static_triangles_array.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/static_triangles_array.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/static_triangles_array.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -38,6 +38,7 @@ #include "../Core/Math/ear_clip_triangulator.h" #include "../Core/System/databuffer.h" +//: Primitives array helper for creating triangles. //- !group=Display/Display! //- !header=display.h! class CL_StaticTrianglesArray : public CL_PrimitivesArray Modified: Development/ClanLib-0.9/Sources/API/Display/subtexture.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/subtexture.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/subtexture.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -46,6 +46,7 @@ { //! Construction: public: + //: Constructs a sub texture description. CL_Subtexture(); CL_Subtexture(CL_Texture texture, const CL_Rect &geometry); @@ -54,8 +55,10 @@ //! Attributes: public: + //: Returns the texture. CL_Texture get_texture(); + //: Returns the part of the texture used by this object. CL_Rect get_geometry() const; //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/texture.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/texture.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/texture.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -46,6 +46,7 @@ class CL_TextureProvider; class CL_Texture_Impl; +//: Texture coordinate wrapping modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureWrapMode @@ -57,6 +58,7 @@ cl_wrap_mirrored_repeat }; +//: Texture filters. //- !group=Display/Display! //- !header=display.h! enum CL_TextureFilter @@ -69,6 +71,7 @@ cl_filter_linear_mipmap_linear }; +//: Texture depth modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureDepthMode @@ -78,6 +81,7 @@ cl_depthmode_alpha }; +//: Texture compare modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureCompareMode @@ -93,6 +97,7 @@ { //! Construction: public: + //: Constructs a texture. CL_Texture(); CL_Texture( Modified: Development/ClanLib-0.9/Sources/API/Display/texture_group.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/texture_group.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/texture_group.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -45,7 +45,9 @@ //- !header=display.h! class CL_API_DISPLAY CL_TextureGroup { +//! Enumerations: public: + //: Texture allocation policy. enum TextureAllocationPolicy { create_new_texture, @@ -54,22 +56,31 @@ //! Construction: public: + //: Constructs a texture. CL_TextureGroup(const CL_Size &texture_sizes); ~CL_TextureGroup(); //! Attributes: public: + //: Returns the amount of sub-textures allocated in group. int get_subtexture_count() const; + + //: Returns the amount of sub-textures for a specific texture index. int get_subtexture_count(unsigned int texture_index) const; + + //: Returns the amount of textures used by group. int get_texture_count() const; + //: Returns the texture allocation policy. TextureAllocationPolicy get_texture_allocation_policy() const; //! Operations: public: + //: Allocate space for another sub texture. CL_Subtexture add(const CL_Size &size); + //: Set the texture allocation policy. void set_texture_allocation_policy(TextureAllocationPolicy policy); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/texture_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/texture_provider.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/texture_provider.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -61,14 +61,19 @@ //! Operations: public: + //: Destroys the texture provider. virtual void destroy() = 0; + //: Create texture. virtual void create(int width, int height, int depth, int border) = 0; + //: Retrieve image data from texture. virtual CL_PixelBuffer get_pixeldata(CL_PixelFormat &format, int level) = 0; + //: Upload image to texture. virtual void set_image(CL_PixelBuffer &image, int level, int border, int format) = 0; + //: Upload cube map. virtual void set_cube_map( CL_PixelBuffer &cube_map_positive_x, CL_PixelBuffer &cube_map_negative_x, @@ -80,12 +85,14 @@ int border, int format) = 0; + //: Upload image to sub texture. virtual void set_subimage( int x, int y, CL_PixelBuffer &image, int level) = 0; + //: Copy image data from a graphic context. virtual void copy_image_from( int x, int y, @@ -96,6 +103,7 @@ int format, CL_GraphicContextProvider *gc) = 0; + //: Copy sub image data from a graphic context. virtual void copy_subimage_from( int offset_x, int offset_y, @@ -106,18 +114,25 @@ int level, CL_GraphicContextProvider *gc) = 0; + //: Set the minimum level of detail texture parameter. virtual void set_min_lod(double min_lod) = 0; + //: Set the maximum level of detail texture parameter. virtual void set_max_lod(double max_lod) = 0; + //: Sets the level of detail bias constant. virtual void set_lod_bias(double lod_bias) = 0; + //: Sets the texture base level texture parameter. virtual void set_base_level(int base_level) = 0; + //: Sets the texture max level texture parameter. virtual void set_max_level(int max_level) = 0; + //: Enables or disables automatic mipmap generation when uploading image data. virtual void set_generate_mipmap(bool generate_mipmap) = 0; + //: Set the texture wrapping mode. virtual void set_wrap_mode( CL_TextureWrapMode wrap_s, CL_TextureWrapMode wrap_t, @@ -130,16 +145,22 @@ virtual void set_wrap_mode( CL_TextureWrapMode wrap_s) = 0; + //: Set the minification filter. virtual void set_min_filter(CL_TextureFilter filter) = 0; + //: Set the magnification filter. virtual void set_mag_filter(CL_TextureFilter filter) = 0; + //: Set texture border color. virtual void set_border_color(double red, double green, double blue, double alpha) = 0; + //: Set texture priority. virtual void set_priority(double priority) = 0; + //: Set the depth texture mode parameter. virtual void set_depth_mode(CL_TextureDepthMode depth_mode) = 0; + //: Sets the texture compare mode and compare function texture parameters. virtual void set_texture_compare(CL_TextureCompareMode mode, CL_CompareFunction func) = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/texture_unit.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/texture_unit.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/texture_unit.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -42,6 +42,7 @@ class CL_TextureUnit_Impl; class CL_Colord; +//: Texture unit modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitMode @@ -54,6 +55,7 @@ cl_unitmode_combine }; +//: Texture unit RGB combine modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitRGBMode @@ -68,6 +70,7 @@ cl_combinemode_rgb_dot3_rgba }; +//: Texture unit alpha combine modes. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitAlphaMode @@ -80,6 +83,7 @@ cl_combinemode_alpha_subtract }; +//: Texture unit sources. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitSource @@ -106,6 +110,7 @@ cl_source_previous }; +//: Texture unit RGB operands. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitRGBOperand @@ -116,6 +121,7 @@ cl_rgb_operand_one_minus_src_alpha }; +//: Texture unit alpha operands. //- !group=Display/Display! //- !header=display.h! enum CL_TextureUnitAlphaOperand Modified: Development/ClanLib-0.9/Sources/API/Display/vector_font.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/vector_font.h 2006-08-08 12:58:14 UTC (rev 1038) +++ Development/ClanLib-0.9/Sources/API/Display/vector_font.h 2006-08-08 15:04:03 UTC (rev 1039) @@ -55,6 +55,7 @@ { //! Construction: public: + //: Creates a vector font. CL_VectorFont(); CL_VectorFont( @@ -86,22 +87,28 @@ //! Attributes: public: + //: Retrieves font metrics for vector font. CL_FontMetrics get_font_metrics(); //! Operations: public: + //: Returns the amount of glyphs used by text. int get_glyph_count(const CL_StringRef &text); + //: Gets the glyph outline for a glyph. CL_GlyphPrimitivesArrayOutline get_glyph_outline(int glyph); + //: Gets the glyph triangles for a glyph. CL_GlyphPrimitivesArray get_glyph_triangles(int glyph); + //: Find glyph indexes and inter-spacing (x,y) values for text. void get_glyphs( const CL_StringRef &text, int *out_glyphs, double *out_interspacing_x, double *out_interspacing_y); + //: Draw glyphs on device context. void draw_glyphs( double x, double y, @@ -113,6 +120,7 @@ const CL_Colord &color = CL_Colord::white, CL_GraphicContext gc = CL_GraphicContext()); + //: Draw text on device context. void draw_text( double x, double y, @@ -121,6 +129,7 @@ bool filled = true, CL_GraphicContext gc = CL_GraphicContext()); + //: Calculate size requirements for text. CL_Sized get_text_size(const CL_StringRef &text); CL_Sized get_glyphs_size(int *glyphs, int length); |
From: Changes to t. C. r. <cla...@li...> - 2006-08-08 13:00:21
|
Author: harry Date: 2006-08-08 14:58:14 +0200 (Tue, 08 Aug 2006) New Revision: 1038 Modified: Development/ClanLib-0.9/Sources/API/Display/buffer_control.h Log: - Doc fixes for Stencil functions. Modified: Development/ClanLib-0.9/Sources/API/Display/buffer_control.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 12:08:34 UTC (rev 1037) +++ Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 12:58:14 UTC (rev 1038) @@ -93,46 +93,46 @@ //: Returns true if stencil test is enabled. bool is_stencil_test_enabled() const; - //: Returns the stencil compare function for front buffer. + //: Returns the stencil compare function for front facing polygons, points, lines and bitmaps. CL_CompareFunction get_stencil_compare_func_front() const; - //: Returns the stencil compare function for back buffer. + //: Returns the stencil compare function for back facing polygons. CL_CompareFunction get_stencil_compare_func_back() const; - //: Returns the stencil compare reference for front buffer. + //: Returns the stencil compare reference for front facing polygons, points, lines and bitmaps int get_stencil_compare_reference_front() const; - //: Returns the stencil compare reference for back buffer. + //: Returns the stencil compare reference for back facing polygons. int get_stencil_compare_reference_back() const; - //: Returns the stencil operation to perform when test fails for front buffer. + //: Returns the stencil operation to perform when test fails for front facing polygons, points, lines and bitmaps CL_StencilOp get_stencil_fail_front() const; - //: Returns the stencil operation to perform when test fails for back buffer. + //: Returns the stencil operation to perform when test fails for back facing polygons. CL_StencilOp get_stencil_fail_back() const; - //: Returns the stencil operation to perform when test passes for front buffer. + //: Returns the stencil operation to perform when test passes for front facing polygons, points, lines and bitmaps CL_StencilOp get_stencil_pass_depth_pass_front() const; - //: Returns the stencil operation to perform when test passes for back buffer. + //: Returns the stencil operation to perform when test passes for back facing polygons. CL_StencilOp get_stencil_pass_depth_pass_back() const; - //: Returns the stencil operation to perform when depth test passes but stencil test fails for front buffer. + //: Returns the stencil operation to perform when depth test passes but stencil test fails for front facing polygons, points, lines and bitmaps CL_StencilOp get_stencil_pass_depth_fail_front() const; - //: Returns the stencil operation to perform when depth test passes but stencil test fails for back buffer. + //: Returns the stencil operation to perform when depth test passes but stencil test fails for back facing polygons. CL_StencilOp get_stencil_pass_depth_fail_back() const; - //: Returns the stencil comparation mask for front buffer. + //: Returns the stencil comparation mask for front facing polygons, points, lines and bitmaps. unsigned char get_stencil_compare_mask_front() const; - //: Returns the stencil comparation mask for back buffer. + //: Returns the stencil comparation mask for back facing polygons. unsigned char get_stencil_compare_mask_back() const; - //: Returns the stencil write mask for front buffer. + //: Returns the stencil write mask for front facing polygons, points, lines and bitmaps. unsigned char get_stencil_write_mask_front() const; - //: Returns the stencil write mask for back buffer. + //: Returns the stencil write mask for back facing polygons. unsigned char get_stencil_write_mask_back() const; //: Returns true if alpha test is enabled. |
From: Changes to t. C. r. <cla...@li...> - 2006-08-08 12:10:31
|
Author: harry Date: 2006-08-08 14:08:34 +0200 (Tue, 08 Aug 2006) New Revision: 1037 Added: Development/ClanLib-0.9/Sources/API/Core/Math/math_help.h Development/ClanLib-0.9/Sources/API/Core/Math/point_generic3.h Modified: Development/ClanLib-0.9/Sources/API/Core/Math/point.h Log: - Added new CL_MathHelp class - Added CL_PointGeneric class typedef'ed to CL_Vector3[dfi] and CL_Point3[dfi] - Added datatype typedefs to CL_Point* classes so they can be used with CL_MathHelp. Added: Development/ClanLib-0.9/Sources/API/Core/Math/math_help.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Math/math_help.h 2006-08-08 11:41:34 UTC (rev 1036) +++ Development/ClanLib-0.9/Sources/API/Core/Math/math_help.h 2006-08-08 12:08:34 UTC (rev 1037) @@ -0,0 +1,236 @@ +/* +** ClanLib SDK +** Copyright (c) 1997-2005 The ClanLib Team +** +** This software is provided 'as-is', without any express or implied +** warranty. In no event will the authors be held liable for any damages +** arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, +** including commercial applications, and to alter it and redistribute it +** freely, subject to the following restrictions: +** +** 1. The origin of this software must not be misrepresented; you must not +** claim that you wrote the original software. If you use this software +** in a product, an acknowledgment in the product documentation would be +** appreciated but is not required. +** 2. Altered source versions must be plainly marked as such, and must not be +** misrepresented as being the original software. +** 3. This notice may not be removed or altered from any source distribution. +** +** Note: Some of the libraries ClanLib may link to may have additional +** requirements or restrictions. +** +** File Author(s): +** +** Harry Storbacka +*/ + +//! clanCore="Math" +//! header=core.h + +#ifndef header_new_math +#define header_new_math + +#include <cmath> + +#ifndef CL_PI + #define CL_PI 3.141592653589793238462643383279 +#endif + +//: Math operations on 2D and 3d point and vector structures. +//- !group=Core/Math! +//- !header=core.h! +class CL_MathHelp +{ +public: + + //: Return a point rotated around a hotspot in 2D. + //param angle_rad: Rotation amount, in radians. + //param t: Point to rotate. + //param hotspot: Point to rotate around. + template<class T, class RotationPoint> + static T rotate2d(double angle_rad, const T &t, const RotationPoint &hotspot ) + { + // Move the hotspot to 0,0 + T r(t.x - (T::datatype)(hotspot.x), t.y - (T::datatype)(hotspot.y)); + + const typename T::datatype c = T::datatype(sqrt(r.x*r.x + r.y*r.y)); + + const typename T::datatype nw = (typename T::datatype)((typename T::datatype)atan2(r.y, r.x) + ((angle_rad + CL_PI))); + + r.x = ((typename T::datatype)(sin(1.5 * CL_PI - nw)) * c) + hotspot.x; + r.y = -((typename T::datatype)(sin(nw)) * c) + hotspot.y; + + return r; + } + + //: Return a point rotated around an axis in 3D. + //param angle_rad: Rotation amount, in radians. + //param t: Point to rotate. + //param a: Axis to rotate around. + template<class T, class Axis> + static T rotate3d(double angle, const T &t, const Axis &a) + { + T tmp; + + double s = sin(angle); + double c = cos(angle); + + tmp.x = t.x*(a.x*a.x*(1-c)+c) + t.y*(a.x*a.y*(1-c)-a.z*s) + t.z*(a.x*a.z*(1-c)+a.y*s); + tmp.y = t.x*(a.y*a.x*(1-c)+a.z*s) + t.y*(a.y*a.y*(1-c)+c) + t.z*(a.y*a.z*(1-c)-a.x*s); + tmp.z = t.x*(a.x*a.z*(1-c)-a.y*s) + t.y*(a.y*a.z*(1-c)+a.x*s) + t.z*(a.z*a.z*(1-c)+c); + + return tmp; + } + + //: Calculate the angle between two vectors in 3D. + //param t1: first vector used to calculate angle. + //param t2: Second vector used to calculate angle. + //return: The angle between the two vectors. + template<class T1, class T2> + static typename T1::datatype angle3d(const T1& t1, const T2 &t2 ) + { + return acos(dot3d(t1,t2)/(t1.length3d()*t2.length3d())); + } + + //: Calculate the distance between two points in 2D. + //param t1: first point. + //param t2: Second point. + //return: The distance between the two points. + template<class T1, class T2> + static typename T1::datatype distance2d( const T1 &t1, const T2 &t2 ) + { + return static_cast<typename T1::datatype>(sqrt((t1.x-t2.x)*(t1.x-t2.x) + (t1.y-t2.y)*(t1.y-t2.y))); + } + + //: Calculate the distance between two points in 3D. + //param t1: first point. + //param t2: Second point. + //return: The distance between the two points. + template<class T1, class T2> + static typename T1::datatype distance3d( const T1 &t1, const T2 &t2 ) + { + return static_cast<typename T1::datatype>(sqrt((t1.x-t2.x)*(t1.x-t2.x) + (t1.y-t2.y)*(t1.y-t2.y) + (t1.z-t2.z)*(t1.z-t2.z))); + } + + //: Calculate the length of a vector in 2D. + //param t: vector. + //return: The Length of the vector. + template<class T> + static typename T::datatype length2d( const T &t ) + { + return (typename T::datatype)sqrt(t.x*t.x + t.y*t.y); + } + + //: Calculate the length of a vector in 3D. + //param t: vector. + //return: The Length of the vector. + template<class T> + static typename T::datatype length3d( const T &t ) + { + return (typename T::datatype)sqrt(t.x*t.x + t.y*t.y + t.z*t.z); + } + + //: Calculate the unit vector of a 2D vector. + //param t: the vector used to calculate the unit vector. + //return: unit vector. + template<class T> + static T normalize2d( const T &t ) + { + T R; + typename T::datatype len = length2d(t); + + if (len != 0) + { + R.x = t.x/len; + R.y = t.y/len; + } + + return R; + } + + //: Calculate the unit vector of a 3D vector. + //param t: The vector used to calculate the unit vector. + //return: Unit vector. + template<class T> + static T normalize3d( const T &t ) + { + T R; + typename T::datatype len = length3d(t); + + if (len != 0) + { + R.x = t.x/len; + R.y = t.y/len; + R.z = t.z/len; + } + + return R; + } + + //: Calculate the dot product of 2D vectors. + //param t1: First vector. + //param t1: Second vector. + //return: Dot product. + template<class T1, class T2> + static typename T1::datatype dot2d( const T1 &t1, const T2 &t2 ) + { + return static_cast<typename T1::datatype>(t1.x*t2.x + t1.y*t2.y); + } + + //: Calculate the dot product of 3D vectors. + //param t1: First vector. + //param t1: Second vector. + //return: Dot product. + template<class T1, class T2> + static typename T1::datatype dot3d( const T1 &t1, const T2 &t2 ) + { + return static_cast<typename T1::datatype>(t1.x*t2.x + t1.y*t2.y + t1.z*t2.z); + } + + //: Return the orthogonal vector of a 2D vector. + template<class T> + static T othogonal2d( const T &t) + { + return T(t.y,-t.x); + } + + //: Calculate the cross product of 3D vectors. + //param t: First vector. + //param v: Second vector. + //return: Cross Product. + template<class T1, class T2> + static typename T1::datatype cross3d( const T1 &t, const T2 &v ) + { + typedef typename T1::datatype dt; + + return T1(t.y * static_cast<dt>(v.z) - t.z * static_cast<dt>(v.y), + t.z * static_cast<dt>(v.x) - t.x * static_cast<dt>(v.z), + t.x * static_cast<dt>(v.y) - t.y * static_cast<dt>(v.x)); + } + + //: Round a 2D Points x,y values to closest integer value. + template<class T> + static T round2d(const T &t) + { + T tmp; + tmp.x = static_cast<typename T::datatype>( static_cast<int>(static_cast<double>(t.x) + 0.5) ); + tmp.y = static_cast<typename T::datatype>( static_cast<int>(static_cast<double>(t.y) + 0.5) ); + return tmp; + } + + //: Round a 3D Points x,y,z values to closest integer value. + template<class T> + static T round3d(const T &t) + { + T tmp; + tmp.x = static_cast<typename T::datatype>( static_cast<int>(static_cast<double>(t.x) + 0.5) ); + tmp.y = static_cast<typename T::datatype>( static_cast<int>(static_cast<double>(t.y) + 0.5) ); + tmp.z = static_cast<typename T::datatype>( static_cast<int>(static_cast<double>(t.z) + 0.5) ); + return tmp; + } + +}; + +#endif Modified: Development/ClanLib-0.9/Sources/API/Core/Math/point.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Math/point.h 2006-08-08 11:41:34 UTC (rev 1036) +++ Development/ClanLib-0.9/Sources/API/Core/Math/point.h 2006-08-08 12:08:34 UTC (rev 1037) @@ -25,6 +25,10 @@ ** ** Magnus Norddahl ** Kenneth Gangst<<<<< .mine +** Harry Storbacka +======= +>>>>>>> .r1036 */ //! clanCore="Math" @@ -48,6 +52,10 @@ //- !header=core.h! class CL_API_CORE CL_Point { +// Typedefs: +public: + typedef int datatype; + // Construction: public: //: Constructs a point. @@ -146,6 +154,10 @@ //- !header=core.h! class CL_Pointf { +// Typedefs: +public: + typedef float datatype; + // Construction: public: //: Constructs a point. @@ -247,6 +259,10 @@ //- !header=core.h! class CL_Pointd { +// Typedefs: +public: + typedef double datatype; + // Construction: public: //: Constructs a point. Added: Development/ClanLib-0.9/Sources/API/Core/Math/point_generic3.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Math/point_generic3.h 2006-08-08 11:41:34 UTC (rev 1036) +++ Development/ClanLib-0.9/Sources/API/Core/Math/point_generic3.h 2006-08-08 12:08:34 UTC (rev 1037) @@ -0,0 +1,144 @@ +/* +** ClanLib SDK +** Copyright (c) 1997-2005 The ClanLib Team +** +** This software is provided 'as-is', without any express or implied +** warranty. In no event will the authors be held liable for any damages +** arising from the use of this software. +** +** Permission is granted to anyone to use this software for any purpose, +** including commercial applications, and to alter it and redistribute it +** freely, subject to the following restrictions: +** +** 1. The origin of this software must not be misrepresented; you must not +** claim that you wrote the original software. If you use this software +** in a product, an acknowledgment in the product documentation would be +** appreciated but is not required. +** 2. Altered source versions must be plainly marked as such, and must not be +** misrepresented as being the original software. +** 3. This notice may not be removed or altered from any source distribution. +** +** Note: Some of the libraries ClanLib may link to may have additional +** requirements or restrictions. +** +** File Author(s): +** +** Harry Storbacka +*/ + +#ifndef header_point_generic +#define header_point_generic + +template<class T> +class CL_PointGeneric +{ +public: + typedef T datatype; + + CL_PointGeneric() : x(0), y(0), z(0) {} + CL_PointGeneric(T x, T y, T z=0) : x(x), y(y), z(z) {} + + //: Translate point. + template<class P> + CL_PointGeneric<T> &operator+=(const P &p) + { + x += static_cast<datatype>(p.x); + y += static_cast<datatype>(p.y); + z += static_cast<datatype>(p.z); + return *this; + } + + //: Translate point negatively. + template<class P> + CL_PointGeneric<T> &operator-=(const P &p) + { + x -= static_cast<datatype>(p.x); + y -= static_cast<datatype>(p.y); + z -= static_cast<datatype>(p.z); + return *this; + } + + //: Point + Point operator. + template<class P> + CL_PointGeneric<T> operator+(const P &p) const + { + return T( x + static_cast<datatype>(p.x), + y + static_cast<datatype>(p.y), + z + static_cast<datatype>(p.z)); + } + + //: Point - Point operator. + template<class P> + CL_PointGeneric<T> operator-(const P &p) const + { + return T( x - static_cast<datatype>(p.x), + y - static_cast<datatype>(p.y), + z - static_cast<datatype>(p.z)); + } + + //: Point operator. + CL_PointGeneric<T> operator-() const + { + return CL_PointGeneric<T>(-x, -y, -z); + } + + //: Point assignment operator. + CL_PointGeneric<T> operator=(const CL_PointGeneric<T> &t) + { + this->x = t.x; + this->y = t.y; + this->z = t.z; + return *this; + } + + //: Scalar multiplications. + template<typename Scalar> + CL_PointGeneric<T> operator*(Scalar scalar) const + { + CL_PointGeneric<T> tmp; + tmp.x = x * scalar; + tmp.y = y * scalar; + tmp.z = z * scalar; + return tmp; + } + + //: Scalar product (scalar * vector) + //return: The scalar product. + template<typename Scalar> + friend CL_PointGeneric<T> operator * (Scalar scalar, const T& t) + { + CL_PointGeneric<T> tmp; + tmp.x = t.x * scalar; + tmp.y = t.y * scalar; + tmp.z = t.z * scalar; + return tmp; + } + + //: Point == Point operator (deep compare) + template<class P> + bool operator==(const P &p) const + { + return (x == static_cast<datatype>(p.x) && + y == static_cast<datatype>(p.y) && + z == static_cast<datatype>(p.z) ); + } + + //: Point != Point operator (deep compare) + template<class P> + bool operator!=(const P &p) const + { + return !operator==(p); + } + + T x, y, z; +}; + +typedef CL_PointGeneric<double> CL_Vector3d; +typedef CL_PointGeneric<float> CL_Vector3f; +typedef CL_PointGeneric<float> CL_Vector3i; + +typedef CL_PointGeneric<double> CL_Point3d; +typedef CL_PointGeneric<float> CL_Point3f; +typedef CL_PointGeneric<int> CL_Point3i; + +#endif |
From: Changes to t. C. r. <cla...@li...> - 2006-08-08 11:43:31
|
Author: mbn Date: 2006-08-08 13:41:34 +0200 (Tue, 08 Aug 2006) New Revision: 1036 Modified: Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h Development/ClanLib-0.9/Sources/API/Core/Text/console.h Development/ClanLib-0.9/Sources/API/Core/Text/string_ref16.h Development/ClanLib-0.9/Sources/API/Core/Text/string_ref8.h Development/ClanLib-0.9/Sources/API/Database/db_command.h Development/ClanLib-0.9/Sources/API/Database/db_command_provider.h Development/ClanLib-0.9/Sources/API/Database/db_connection.h Development/ClanLib-0.9/Sources/API/Database/db_connection_provider.h Development/ClanLib-0.9/Sources/API/Database/db_return_value.h Development/ClanLib-0.9/Sources/API/Display/blend_mode.h Development/ClanLib-0.9/Sources/API/Display/buffer_control.h Development/ClanLib-0.9/Sources/API/Display/canvas.h Development/ClanLib-0.9/Sources/API/Display/canvas_provider.h Development/ClanLib-0.9/Sources/API/Display/compare_function.h Log: - More documentation. Modified: Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -48,6 +48,7 @@ //- issues with some compilers.</p> class CL_BasicStringTypes { +//! Attributes: public: typedef unsigned int size_type; Modified: Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -39,9 +39,12 @@ //- !header=core.h! class CL_API_CORE CL_CharacterSet { +//! Construction: public: virtual ~CL_CharacterSet() {} +//! Operations: +public: //: Convert text from character set to ucs2. virtual int to_unicode( void *input, Modified: Development/ClanLib-0.9/Sources/API/Core/Text/console.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/console.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Core/Text/console.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -50,6 +50,7 @@ //- !header=core.h! class CL_Console { +//! Operations: public: //: Writes text to the console window. static void write(const CL_StringRef8 &text) Modified: Development/ClanLib-0.9/Sources/API/Core/Text/string_ref16.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/string_ref16.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Core/Text/string_ref16.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -41,6 +41,7 @@ //- !hide! class CL_API_CORE CL_String16Traits { +//! Operations: public: static inline CL_BasicString<wchar_t, CL_String8Traits, std::string>::size_type length(const wchar_t *s) { Modified: Development/ClanLib-0.9/Sources/API/Core/Text/string_ref8.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/string_ref8.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Core/Text/string_ref8.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -41,6 +41,7 @@ //- !hide! class CL_API_CORE CL_String8Traits { +//! Operations: public: static inline CL_BasicString<char, CL_String8Traits, std::string>::size_type length(const char *s) { Modified: Development/ClanLib-0.9/Sources/API/Database/db_command.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Database/db_command.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Database/db_command.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -46,6 +46,7 @@ { //! Construction: public: + //: Constructs a database command. CL_DBCommand(CL_DBConnection &connection); CL_DBCommand(const CL_StringRef &sql_statement, CL_DBConnection &connection); @@ -56,24 +57,30 @@ //! Attributes: public: + //: Returns the index for a given parameter name. int get_param_column(const CL_StringRef &name) const; //! Operations: public: + //: Set command statement. void set_command(const CL_StringRef &sql_statement); - + + //: Assign parameter a double value. void set_param_double(int column, double value); void set_param_double(const CL_StringRef &column_name, double value); + //: Assign parameter an integer value. void set_param_int(int column, int value); void set_param_int(const CL_StringRef &column_name, int value); + //: Assign parameter a BLOB value. void set_param_blob(int column, const CL_DataBuffer &blob); void set_param_blob(const CL_StringRef &column_name, const CL_DataBuffer &blob); + //: Assign parameter a text value. void set_param_text(int column, const CL_StringRef &text); void set_param_text(const CL_StringRef &column_name, const CL_StringRef &text); Modified: Development/ClanLib-0.9/Sources/API/Database/db_command_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Database/db_command_provider.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Database/db_command_provider.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -48,18 +48,24 @@ //! Attributes: public: + //: Returns the index for a given parameter name. virtual int get_param_column(const CL_StringRef &name) const = 0; //! Operations: public: + //: Set command statement. virtual void set_command(const CL_StringRef &sql_statement) = 0; + //: Assign parameter a double value. virtual void set_param_double(int column, double value) = 0; + //: Assign parameter an integer value. virtual void set_param_int(int column, int value) = 0; + //: Assign parameter a BLOB value. virtual void set_param_blob(int column, const CL_DataBuffer &blob) = 0; + //: Assign parameter a text value. virtual void set_param_text(int column, const CL_StringRef &text) = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Database/db_connection.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Database/db_connection.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Database/db_connection.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -47,6 +47,7 @@ { //! Construction: public: + //: Constructs a database connection. CL_DBConnection(); CL_DBConnection(CL_DBConnectionProvider *provider); @@ -55,20 +56,27 @@ //! Attributes: public: + //: Returns true if current execution step resulted in a row. bool is_row() const; + //: Returns the 'rowid' for the last inserted record. int get_last_insert_rowid() const; + //: Returns the number of columns for the current row. int get_columns() const; - + + //: Returns the name of a column index. CL_StringRef get_name(int column) const; + //: Returns the column index for a given column name. int get_index(const CL_StringRef &name) const; + //: Get declaration type for column. CL_StringRef get_decltype(int column) const; CL_StringRef get_decltype(const CL_StringRef &name) const; + //: Get BLOB object for column. CL_DataBuffer get_blob(int column) const; CL_DataBuffer get_blob(const CL_StringRef &name) const; @@ -77,34 +85,42 @@ void get_blob(const CL_StringRef &name, CL_DataBuffer &array) const; + //: Get BLOB object for column. const void *get_blob_raw(int column) const; const void *get_blob_raw(const CL_StringRef &name) const; + //: Get BLOB size for column. int get_blob_size(int column) const; int get_blob_size(const CL_StringRef &name) const; + //: Get double value for column. double get_double(int column) const; double get_double(const CL_StringRef &name) const; + //: Get integer value for column. int get_int(int column) const; int get_int(const CL_StringRef &name) const; + //: Get text value for column. CL_StringRef get_text(int column) const; CL_StringRef get_text(const CL_StringRef &name) const; + //: Get value for column. CL_DBReturnValue operator[](int column) const; CL_DBReturnValue operator[](const CL_StringRef &name) const; //! Operations: public: + //: Begin execution of database command. void execute(const CL_DBCommand &command); + //: Retrieve next row for currently executed command. bool next_row(); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Database/db_connection_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Database/db_connection_provider.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Database/db_connection_provider.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -48,36 +48,51 @@ //! Attributes: public: + //: Returns true if current execution step resulted in a row. virtual bool is_row() const = 0; + //: Returns the 'rowid' for the last inserted record. virtual int get_last_insert_rowid() const = 0; + //: Returns the number of columns for the current row. virtual int get_columns() const = 0; + //: Returns the name of a column index. virtual CL_StringRef get_name(int column) const = 0; + //: Returns the column index for a given column name. virtual int get_index(const CL_StringRef &name) const = 0; + //: Get declaration type for column. virtual CL_StringRef get_decltype(int column) const = 0; + //: Get BLOB object for column. virtual void get_blob(int column, CL_DataBuffer &array) const = 0; + //: Get BLOB object for column. virtual const void *get_blob_raw(int column) const = 0; + //: Get BLOB size for column. virtual int get_blob_size(int column) const = 0; + //: Get double value for column. virtual double get_double(int column) const = 0; + //: Get integer value for column. virtual int get_int(int column) const = 0; + //: Get text value for column. virtual CL_StringRef get_text(int column) const = 0; //! Operations: public: + //: Creates a DB command provider for this connection. virtual CL_DBCommandProvider *create_command_provider() = 0; + //: Begin execution of database command. virtual void execute(CL_DBCommandProvider *command) = 0; + //: Retrieve next row for currently executed command. virtual bool next_row() = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Database/db_return_value.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Database/db_return_value.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Database/db_return_value.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -44,28 +44,39 @@ { //! Operations: public: + //: Get BLOB value. CL_DataBuffer get_blob() const; void get_blob(CL_DataBuffer &array) const; + //: Get BLOB value. const void *get_blob_raw() const; + //: Get BLOB value size. int get_blob_size() const; + //: Get double value. double get_double() const; + //: Get integer value. int get_int() const; + //: Get text value. CL_StringRef get_text() const; + //: Get BLOB value. operator CL_DataBuffer() const; + //: Get double value. operator double() const; + //: Get integer value. operator int() const; + //: Get unsigned integer value. operator unsigned int() const; + //: Get text value. operator CL_StringRef() const; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/blend_mode.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/blend_mode.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Display/blend_mode.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -42,27 +42,58 @@ class CL_Colord; class CL_BlendMode_Impl; +//: Blending functions. //- !group=Display/Display! //- !header=display.h! enum CL_BlendFunc { - cl_blend_zero, // source or destination (0, 0, 0, 0) - cl_blend_one, // source or destination (1, 1, 1, 1) - cl_blend_dest_color, // source (Rd, Gd, Bd, Ad) - cl_blend_src_color, // destination (Rs, Gs, Bs, As) - cl_blend_one_minus_dest_color, // source (1, 1, 1, 1) - (Rd, Gd, Bd, Ad) - cl_blend_one_minus_src_color, // destination (1, 1, 1, 1) - (Rs, Gs, Bs, As) - cl_blend_src_alpha, // source or destination (As, As, As, As) - cl_blend_one_minus_src_alpha, // source or destination (1, 1, 1, 1) - (As, As, As, As) - cl_blend_dest_alpha, // source or destination (Ad, Ad, Ad, Ad) - cl_blend_one_minus_dest_alpha, // source or destination (1, 1, 1, 1) - (Ad, Ad, Ad, Ad) - cl_blend_src_alpha_saturate, // source (f, f, f, 1) - f = min(As, 1 - Ad) - cl_blend_constant_color, // source or destination (Rc, Gc, Bc, Ac) - cl_blend_one_minus_constant_color, // source or destination (1, 1, 1, 1) - (Rc, Gc, Bc, Ac) - cl_blend_constant_alpha, // source or destination (Ac, Ac, Ac, Ac) - cl_blend_one_minus_constant_alpha // source or destination (1, 1, 1, 1) - (Ac, Ac, Ac, Ac) + //: source or destination (0, 0, 0, 0) + cl_blend_zero, + + //: source or destination (1, 1, 1, 1) + cl_blend_one, + + //: source (Rd, Gd, Bd, Ad) + cl_blend_dest_color, + + //: destination (Rs, Gs, Bs, As) + cl_blend_src_color, + + //: source (1, 1, 1, 1) - (Rd, Gd, Bd, Ad) + cl_blend_one_minus_dest_color, + + //: destination (1, 1, 1, 1) - (Rs, Gs, Bs, As) + cl_blend_one_minus_src_color, + + //: source or destination (As, As, As, As) + cl_blend_src_alpha, + + //: source or destination (1, 1, 1, 1) - (As, As, As, As) + cl_blend_one_minus_src_alpha, + + //: source or destination (Ad, Ad, Ad, Ad) + cl_blend_dest_alpha, + + //: source or destination (1, 1, 1, 1) - (Ad, Ad, Ad, Ad) + cl_blend_one_minus_dest_alpha, + + //: source (f, f, f, 1) - f = min(As, 1 - Ad) + cl_blend_src_alpha_saturate, + + //: source or destination (Rc, Gc, Bc, Ac) + cl_blend_constant_color, + + //: source or destination (1, 1, 1, 1) - (Rc, Gc, Bc, Ac) + cl_blend_one_minus_constant_color, + + //: source or destination (Ac, Ac, Ac, Ac) + cl_blend_constant_alpha, + + //: source or destination (1, 1, 1, 1) - (Ac, Ac, Ac, Ac) + cl_blend_one_minus_constant_alpha }; +//: Blending equations. //- !group=Display/Display! //- !header=display.h! enum CL_BlendEquation @@ -83,6 +114,7 @@ //! Construction: public: CL_BlendMode(); + ~CL_BlendMode(); //! Attributes: @@ -108,6 +140,7 @@ //: Returns the destination alpha blend function. CL_BlendFunc get_blend_function_dest_alpha() const; + //: Returns true if blending mode is enabled. bool is_blend_enabled() const; //! Operations: Modified: Development/ClanLib-0.9/Sources/API/Display/buffer_control.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Display/buffer_control.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -55,6 +55,7 @@ cl_stencil_decr_wrap }; +//: Drawing buffers. enum CL_DrawBuffer { cl_buffer_none, @@ -82,76 +83,136 @@ { //! Construction: public: - //: Constructs a CL_BufferControl. + //: Constructs a buffer control description object. CL_BufferControl(); virtual ~CL_BufferControl(); //! Attributes: public: + //: Returns true if stencil test is enabled. bool is_stencil_test_enabled() const; + //: Returns the stencil compare function for front buffer. CL_CompareFunction get_stencil_compare_func_front() const; + + //: Returns the stencil compare function for back buffer. CL_CompareFunction get_stencil_compare_func_back() const; + //: Returns the stencil compare reference for front buffer. int get_stencil_compare_reference_front() const; + + //: Returns the stencil compare reference for back buffer. int get_stencil_compare_reference_back() const; + //: Returns the stencil operation to perform when test fails for front buffer. CL_StencilOp get_stencil_fail_front() const; + + //: Returns the stencil operation to perform when test fails for back buffer. CL_StencilOp get_stencil_fail_back() const; + //: Returns the stencil operation to perform when test passes for front buffer. CL_StencilOp get_stencil_pass_depth_pass_front() const; + + //: Returns the stencil operation to perform when test passes for back buffer. CL_StencilOp get_stencil_pass_depth_pass_back() const; + //: Returns the stencil operation to perform when depth test passes but stencil test fails for front buffer. CL_StencilOp get_stencil_pass_depth_fail_front() const; + + //: Returns the stencil operation to perform when depth test passes but stencil test fails for back buffer. CL_StencilOp get_stencil_pass_depth_fail_back() const; + //: Returns the stencil comparation mask for front buffer. unsigned char get_stencil_compare_mask_front() const; + + //: Returns the stencil comparation mask for back buffer. unsigned char get_stencil_compare_mask_back() const; + //: Returns the stencil write mask for front buffer. unsigned char get_stencil_write_mask_front() const; + + //: Returns the stencil write mask for back buffer. unsigned char get_stencil_write_mask_back() const; + //: Returns true if alpha test is enabled. bool is_alpha_test_enabled() const; + + //: Returns the alpha test comparation reference value. float get_alpha_compare_reference() const; + + //: Returns the alpha test compare function. CL_CompareFunction get_alpha_compare_function() const; + //: Returns true if the depth test is enabled. bool is_depth_test_enabled() const; + + //: Returns true if depth writing is enabled. bool is_depth_write_enabled() const; + + //: Returns the depth test function. CL_CompareFunction get_depth_compare_function() const; + //: Retrieves which color components are write enabled. void is_color_write_enabled(bool &red, bool &green, bool &blue, bool &alpha) const; + //: Returns the used draw buffer. CL_DrawBuffer get_draw_buffer() const; //! Operations: public: + //: Enables/disables stencil testing. void enable_stencil_test(bool enabled); + + //: Set stencil compare function. void set_stencil_compare_func(CL_CompareFunction front, CL_CompareFunction back); + + //: Set stencil compare reference values. void set_stencil_compare_reference(int front_ref, int back_ref); + + //: Set stencil write masks. void set_stencil_write_mask(unsigned char front_facing_mask, unsigned char back_facing_mask); + + //: Set stencil failed test operations. void set_stencil_fail(CL_StencilOp front, CL_StencilOp back); + + //: Set stencil passed test operations. void set_stencil_pass_depth_pass(CL_StencilOp front, CL_StencilOp back); + + //: Set stencil passed depth test but failed stencil test operations. void set_stencil_pass_depth_fail(CL_StencilOp front, CL_StencilOp back); + + //: Set stencil comparation masks. void set_stencil_compare_mask(int front_mask, int back_mask); + //: Enables/disables alpha testing. void enable_alpha_test(bool value); + + //: Set alpha comparation reference value. void set_alpha_compare_reference(float alpha_compare_reference); + + //: Set alpha test function. void set_alpha_compare_function(CL_CompareFunction func); + //: Enables/disables depth testing. void enable_depth_test(bool enabled); + + //: Enables/disables depth writing. void enable_depth_write(bool enabled); + + //: Set depth test function. void set_depth_compare_function(CL_CompareFunction func); //: Enable/disable writing to the color buffer void enable_color_write(bool enabled); + void enable_color_write(bool red, bool green, bool blue, bool alpha); + //: Set used draw buffer. void set_draw_buffer(CL_DrawBuffer buffer); //! Implementation: private: - CL_SharedPtr<CL_BufferControl_Impl> impl; }; Modified: Development/ClanLib-0.9/Sources/API/Display/canvas.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/canvas.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Display/canvas.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -45,6 +45,7 @@ { //! Construction: public: + //: Creates a canvas. CL_Canvas(int width, int height, CL_GraphicContext target = CL_GraphicContext()); virtual ~CL_Canvas(); Modified: Development/ClanLib-0.9/Sources/API/Display/canvas_provider.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/canvas_provider.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Display/canvas_provider.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -50,14 +50,18 @@ //! Attributes: public: + //: Returns the size of the canvas. virtual CL_Size get_size() const = 0; + //: Returns the graphic context for the canvas. virtual CL_GraphicContext get_gc() const = 0; //! Operations: public: + //: Creates a canvas with the given dimensions. virtual void create(int width, int height) = 0; + //: Destroy canvas provider. virtual void destroy() = 0; //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Display/compare_function.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Display/compare_function.h 2006-08-08 10:45:43 UTC (rev 1035) +++ Development/ClanLib-0.9/Sources/API/Display/compare_function.h 2006-08-08 11:41:34 UTC (rev 1036) @@ -33,6 +33,7 @@ #ifndef header_compare_function #define header_compare_function +//: Compare functions. //- !group=Display/Display! //- !header=display.h! enum CL_CompareFunction |
From: Changes to t. C. r. <cla...@li...> - 2006-08-08 10:47:40
|
Author: mbn Date: 2006-08-08 12:45:43 +0200 (Tue, 08 Aug 2006) New Revision: 1035 Modified: Development/ClanLib-0.9/Sources/API/Core/System/thread.h Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h Development/ClanLib-0.9/Sources/API/Core/Text/console.h Development/ClanLib-0.9/Sources/API/Core/Text/console_logger.h Development/ClanLib-0.9/Sources/API/Core/Text/file_logger.h Development/ClanLib-0.9/Sources/API/Core/Text/logger.h Development/ClanLib-0.9/Sources/API/Core/Text/string16.h Development/ClanLib-0.9/Sources/API/Core/Text/string8.h Log: - More reference documentation stuff. Modified: Development/ClanLib-0.9/Sources/API/Core/System/thread.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/System/thread.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/System/thread.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -46,6 +46,7 @@ { //! Construction: public: + //: Constructs a thread object. CL_Thread(); ~CL_Thread(); @@ -55,6 +56,7 @@ //! Operations: public: + //: Starts a thread. void start(CL_Runnable *runnable); template<class C> @@ -147,6 +149,7 @@ } } + //: Blocks until thread has completed its execution. void join(); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/basic_string.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -60,6 +60,7 @@ template <typename CharType, typename CharacterTraits, typename std_string> class CL_BasicString : public CL_BasicStringTypes { +//! Construction: public: CL_BasicString() { @@ -91,6 +92,8 @@ data_clear(); } +//! Operations: +public: CL_BasicString &operator =(const CL_BasicString &source) { data_init(); Modified: Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/character_set.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -42,6 +42,7 @@ public: virtual ~CL_CharacterSet() {} + //: Convert text from character set to ucs2. virtual int to_unicode( void *input, int input_length, @@ -49,6 +50,7 @@ int output_capacity, int *output_length) = 0; + //: Convert text from ucs2 into character set. virtual int from_unicode( unsigned int *input, int input_length, @@ -56,12 +58,12 @@ int output_capacity, int *output_length) = 0; + //: Returns the amount of characters in buffer. virtual int get_character_length( void *input, int input_length) = 0; - - virtual int get_index_size() = 0; - + + //: Returns the index positions for a number of characters. virtual int get_character_indexes( void *input, int input_length, Modified: Development/ClanLib-0.9/Sources/API/Core/Text/console.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/console.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/console.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -51,6 +51,7 @@ class CL_Console { public: + //: Writes text to the console window. static void write(const CL_StringRef8 &text) { #ifdef WIN32 @@ -138,6 +139,7 @@ write(f.get_result()); } + //: Writes text to the console window and then advances to a new line. static void write_line(const CL_StringRef8 &text) { write(text); @@ -225,6 +227,7 @@ write_line(f.get_result()); } + //: Block until a key is pressed in the console window. static void wait_for_key() { #ifdef WIN32 Modified: Development/ClanLib-0.9/Sources/API/Core/Text/console_logger.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/console_logger.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/console_logger.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -42,6 +42,7 @@ { //! Construction: public: + //: Constructs a console logger. CL_ConsoleLogger(); ~CL_ConsoleLogger(); @@ -51,6 +52,7 @@ //! Operations: public: + //: Log text to console. void log(const CL_String8 &type, const CL_String &text); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Core/Text/file_logger.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/file_logger.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/file_logger.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -44,6 +44,7 @@ { //! Construction: public: + //: Constructs a file logger. CL_FileLogger(const CL_String &filename); ~CL_FileLogger(); @@ -53,6 +54,7 @@ //! Operations: public: + //: Log text to file. void log(const CL_String8 &type, const CL_String &text); //! Implementation: Modified: Development/ClanLib-0.9/Sources/API/Core/Text/logger.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/logger.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/logger.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -44,30 +44,37 @@ { //! Construction: public: + //: Constructs a logger. CL_Logger(); virtual ~CL_Logger(); //! Attributes: public: + //: Pointer to currently enabled logger. static CL_Logger *instance; + //: Logger mutex object. static CL_Mutex mutex; //! Operations: public: + //: Enable logger for logging. void enable(); + //: Disable logging. void disable(); + //: Log text. virtual void log(const CL_String8 &type, const CL_String &text)=0; //! Implementation: private: }; -//! Operations: - +//: Log text to logger. +//- !group=Core/Text! +//- !header=core.h! CL_API_CORE void cl_log_event(const CL_String8 &type, const CL_String16 &text); CL_API_CORE void cl_log_event(const CL_String8 &type, const CL_String8 &text); Modified: Development/ClanLib-0.9/Sources/API/Core/Text/string16.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/string16.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/string16.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -43,6 +43,7 @@ //- !header=core.h! class CL_API_CORE CL_String16 : public CL_StringRef16 { +//! Construction: public: CL_String16() { @@ -76,6 +77,8 @@ resize(n, c); } +//! Operations: +public: CL_String16 &operator =(const CL_StringRef16 &source) { data_set_copy(source); @@ -397,6 +400,9 @@ } }; +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String16 operator+(const CL_StringRef16 &s1, const CL_StringRef16 &s2) { CL_String16 result; @@ -406,6 +412,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String16 operator+(const CL_StringRef16::CharacterType *s1, const CL_StringRef16 &s2) { CL_String16 result; @@ -415,6 +424,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String16 operator+(const CL_StringRef16 &s1, const CL_StringRef16::CharacterType *s2) { CL_String16 result; @@ -424,6 +436,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String16 operator+(CL_StringRef16::CharacterType c, const CL_StringRef16 &s2) { CL_String16 result; @@ -433,6 +448,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String16 operator+(const CL_StringRef16 &s1, CL_StringRef16::CharacterType c) { CL_String16 result; Modified: Development/ClanLib-0.9/Sources/API/Core/Text/string8.h =================================================================== --- Development/ClanLib-0.9/Sources/API/Core/Text/string8.h 2006-08-07 17:38:49 UTC (rev 1034) +++ Development/ClanLib-0.9/Sources/API/Core/Text/string8.h 2006-08-08 10:45:43 UTC (rev 1035) @@ -43,6 +43,7 @@ //- !header=core.h! class CL_API_CORE CL_String8 : public CL_StringRef8 { +//! Construction: public: CL_String8() { @@ -76,6 +77,8 @@ resize(n, c); } +//! Operations: +public: CL_String8 &operator =(const CL_StringRef8 &source) { data_set_copy(source); @@ -397,6 +400,9 @@ } }; +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String8 operator+(const CL_StringRef8 &s1, const CL_StringRef8 &s2) { CL_String8 result; @@ -406,6 +412,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String8 operator+(const CL_StringRef8::CharacterType *s1, const CL_StringRef8 &s2) { CL_String8 result; @@ -415,6 +424,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String8 operator+(const CL_StringRef8 &s1, const CL_StringRef8::CharacterType *s2) { CL_String8 result; @@ -424,6 +436,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String8 operator+(CL_StringRef8::CharacterType c, const CL_StringRef8 &s2) { CL_String8 result; @@ -433,6 +448,9 @@ return result; } +//- !group=Core/Text! +//- !header=core.h! +//- !hide! inline CL_String8 operator+(const CL_StringRef8 &s1, CL_StringRef8::CharacterType c) { CL_String8 result; |
From: Changes to t. C. r. <cla...@li...> - 2006-08-07 17:40:50
|
Author: sphair Date: 2006-08-07 19:38:49 +0200 (Mon, 07 Aug 2006) New Revision: 1034 Modified: Development/ClanLib-0.9/Sources/Display/Collision/collision_outline_generic.cpp Log: - fixed compile error caused by deleting files Modified: Development/ClanLib-0.9/Sources/Display/Collision/collision_outline_generic.cpp =================================================================== --- Development/ClanLib-0.9/Sources/Display/Collision/collision_outline_generic.cpp 2006-08-07 14:45:45 UTC (rev 1033) +++ Development/ClanLib-0.9/Sources/Display/Collision/collision_outline_generic.cpp 2006-08-07 17:38:49 UTC (rev 1034) @@ -42,7 +42,6 @@ #include "API/Core/Math/circle.h" #include "API/Core/Math/pointset_math.h" #include "API/Core/Math/cl_vector.h" -#include "API/Core/Math/vector2.h" #include <float.h> template<typename T> inline T cl_min(T a, T b) { if(a < b) return a; return b; } |