From: <cad...@li...> - 2005-11-22 00:52:59
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns=3D"http://www.w3.org/1999/xhtml"> <head><style type=3D"text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: = #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica= ,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; fo= nt-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padd= ing: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt= ;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:aut= o;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patc= h .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 = 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 = 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[277] tiki/dc: Adding TextureTile (single Texture with multiple &q= uot;tiles")</title> </head> <body> <div id=3D"msg"> <dl> <dt>Revision</dt> <dd>277</dd> <dt>Author</dt> <dd>atani</dd> <dt>Date</dt> <dd>2005-11-21 16:45:01 -0800 (Mon, 21 Nov 2005)</dd> </dl> <h3>Log Message</h3> <pre>Adding TextureTile (single Texture with multiple "tiles") Removing calls to TikiTest building</pre> <h3>Modified Paths</h3> <ul> <li><a href=3D"#tikidcMakefile">tiki/dc/Makefile</a></li> <li><a href=3D"#tikiincludeTikidrawablesbannerh">tiki/include/Tiki/drawab= les/banner.h</a></li> <li><a href=3D"#tikisdlMakefile">tiki/sdl/Makefile</a></li> </ul> <h3>Added Paths</h3> <ul> <li><a href=3D"#tikiincludeTikidrawablestexturetileh">tiki/include/Tiki/d= rawables/texturetile.h</a></li> <li><a href=3D"#tikisrcgldrawablestexturetilecpp">tiki/src/gl/drawables/t= exturetile.cpp</a></li> </ul> </div> <div id=3D"patch"> <h3>Diff</h3> <a id=3D"tikidcMakefile"></a> <div class=3D"modfile"><h4>Modified: tiki/dc/Makefile (276 =3D> 277)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/dc/Makefile 2005-11-22 00:41:30 UTC (rev 27= 6) +++ tiki/dc/Makefile 2005-11-22 00:45:01 UTC (rev 277) </span><span class=3D"lines">@@ -21,10 +21,7 @@ </span><span class=3D"cx"> $(KOS_AR) ru libtiki.a $(BASE_OBJS) </span><span class=3D"cx"> $(MAKE) tikitest_all </span><span class=3D"cx">=20 </span><del>-clean: tikitest_clean clean_subdirs </del><ins>+clean: clean_subdirs </ins><span class=3D"cx"> -rm -f $(BASE_OBJS) libtiki.a </span><span class=3D"cx">=20 </span><del>-tikitest_clean tikitest_all: - $(MAKE) -C TikiTest $(patsubst tikitest_%,%,$@) - </del><span class=3D"cx"> include Makefile.rules </span></pre></div> <a id=3D"tikiincludeTikidrawablesbannerh"></a> <div class=3D"modfile"><h4>Modified: tiki/include/Tiki/drawables/banner.h= (276 =3D> 277)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/include/Tiki/drawables/banner.h 2005-11-22 = 00:41:30 UTC (rev 276) +++ tiki/include/Tiki/drawables/banner.h 2005-11-22 00:45:01 UTC (rev 277= ) </span><span class=3D"lines">@@ -34,9 +34,10 @@ </span><span class=3D"cx">=20 </span><span class=3D"cx"> virtual void draw(ObjType t); </span><span class=3D"cx">=20 </span><ins>+protected: + RefPtr<Texture> m_texture; </ins><span class=3D"cx"> private: </span><span class=3D"cx"> ObjType m_list; </span><del>- RefPtr<Texture> m_texture; </del><span class=3D"cx">=20 </span><span class=3D"cx"> float m_u1, m_v1, m_u2, m_v2; </span><span class=3D"cx"> float m_u3, m_v3, m_u4, m_v4; </span></pre></div> <a id=3D"tikiincludeTikidrawablestexturetileh"></a> <div class=3D"addfile"><h4>Added: tiki/include/Tiki/drawables/texturetile= .h (276 =3D> 277)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/include/Tiki/drawables/texturetile.h 2005-1= 1-22 00:41:30 UTC (rev 276) +++ tiki/include/Tiki/drawables/texturetile.h 2005-11-22 00:45:01 UTC (re= v 277) </span><span class=3D"lines">@@ -0,0 +1,40 @@ </span><ins>+/* + Tiki + + tilemap.h + + Copyright (C)2005 Atani Software +*/ + +#ifndef __TIKI_DRW_TXRTILE_H +#define __TIKI_DRW_TXRTILE_H + +#include "Tiki/drawable.h" +#include "Tiki/drawables/banner.h" +#include "Tiki/texture.h" +#include "Tiki/color.h" + +namespace Tiki { +namespace GL { + +/** + * TileMap -- Renders a portion of texture as a tile + */ +class TextureTile : public Banner { +public: + TextureTile(ObjType t, Texture * texture); + virtual ~TextureTile(); + + void setTileSize(float w, float h); + void selectTile(float x, float y); + +private: + float m_tile_w, m_tile_h; + float m_sel_tile_x, m_sel_tile_y; +}; + +}; +}; + +#endif // __TIKI_DRW_TXRTILE_H + </ins><span class=3D"cx">Property changes on: tiki/include/Tiki/drawables= /texturetile.h </span><span class=3D"cx">_______________________________________________= ____________________ </span><span class=3D"cx">Name: svn:executable </span><span class=3D"cx"> + * </span></pre></div> <a id=3D"tikisdlMakefile"></a> <div class=3D"modfile"><h4>Modified: tiki/sdl/Makefile (276 =3D> 277)</h4= > <pre class=3D"diff"> <span class=3D"info">--- tiki/sdl/Makefile 2005-11-22 00:41:30 UTC (rev 2= 76) +++ tiki/sdl/Makefile 2005-11-22 00:45:01 UTC (rev 277) </span><span class=3D"lines">@@ -50,12 +50,8 @@ </span><span class=3D"cx">=20 </span><span class=3D"cx"> all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) </span><span class=3D"cx"> $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY= _OBJS) </span><del>- $(MAKE) tikitest_all </del><span class=3D"cx">=20 </span><del>-clean: tikitest_clean clean_subdirs </del><ins>+clean: clean_subdirs </ins><span class=3D"cx"> -rm -f $(BASE_OBJS) libtiki.a </span><span class=3D"cx">=20 </span><del>-tikitest_clean tikitest_all: - $(MAKE) -C TikiTest $(patsubst tikitest_%,%,$@) - </del><span class=3D"cx"> include Makefile.rules </span></pre></div> <a id=3D"tikisrcgldrawablestexturetilecpp"></a> <div class=3D"addfile"><h4>Added: tiki/src/gl/drawables/texturetile.cpp (= 276 =3D> 277)</h4> <pre class=3D"diff"> <span class=3D"info">--- tiki/src/gl/drawables/texturetile.cpp 2005-11-22= 00:41:30 UTC (rev 276) +++ tiki/src/gl/drawables/texturetile.cpp 2005-11-22 00:45:01 UTC (rev 27= 7) </span><span class=3D"lines">@@ -0,0 +1,44 @@ </span><ins>+/* + Tiki + + texturetile.cpp + + Copyright (C)2005 Atani Software +*/ + +#include "pch.h" + +#include "Tiki/drawables/texturetile.h" +#include "Tiki/drawables/banner.h" +#include "Tiki/plxcompat.h" + +using namespace Tiki::GL; +using namespace Tiki::GL::Plxcompat; + +TextureTile::TextureTile(ObjType t, Texture * texture) : Banner(t, textu= re) { +} + +TextureTile::~TextureTile() { +} + +void TextureTile::setTileSize(float w, float h) { + m_tile_w =3D w; + m_tile_h =3D h; +} + +void TextureTile::selectTile(float x, float y) { + m_sel_tile_x =3D x; + m_sel_tile_y =3D y; + + float start_x =3D m_tile_w * x; + float start_y =3D m_tile_h * y; + float stop_x =3D start_x + m_tile_w; + float stop_y =3D start_y + m_tile_h; + + // select region of texture that matches the x/y coord of tile in textu= re + setUV(start_x / m_texture->getW(), stop_y / m_texture->getH(), + start_x / m_texture->getW(), start_y / m_texture->getH(), + stop_x / m_texture->getW(), stop_y / m_texture->getH(), + stop_x / m_texture->getW(), start_y / m_texture->getH() + ); +} </ins><span class=3D"cx">Property changes on: tiki/src/gl/drawables/textu= retile.cpp </span><span class=3D"cx">_______________________________________________= ____________________ </span><span class=3D"cx">Name: svn:executable </span><span class=3D"cx"> + * </span></pre> </div> </div> </body> </html> |