Browse Source

minor fixes

Denis Muratshin 11 years ago
parent
commit
97d366d1b7

+ 2 - 2
.hg_archival.txt

@@ -1,5 +1,5 @@
 repo: b6d71054df5712e643a0685bc3ba54b123db5729
 repo: b6d71054df5712e643a0685bc3ba54b123db5729
-node: 07d735c449664967a4f477c5e34481c7218f931a
+node: 4c78fa96b703895db14e39fec36d8f1a958d6d1b
 branch: default
 branch: default
 latesttag: oldrender
 latesttag: oldrender
-latesttagdistance: 391
+latesttagdistance: 396

+ 1 - 1
oxygine/src/Input.h

@@ -43,7 +43,7 @@ namespace oxygine
 		PointerState _pointers[MAX_TOUCHES];
 		PointerState _pointers[MAX_TOUCHES];
 		PointerState _pointerMouse;
 		PointerState _pointerMouse;
 
 
-		int _ids[MAX_TOUCHES];
+		int _ids[MAX_TOUCHES + 1];
 
 
 
 
 		void sendPointerButtonEvent(MouseButton button, float x, float y, float pressure, int type, PointerState *);
 		void sendPointerButtonEvent(MouseButton button, float x, float y, float pressure, int type, PointerState *);

+ 25 - 35
oxygine/src/SlidingActor.cpp

@@ -29,9 +29,6 @@ namespace oxygine
 		_clip->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &SlidingActor::_newEvent));
 		_clip->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &SlidingActor::_newEvent));
 		_clip->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &SlidingActor::_newEvent));
 		_clip->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &SlidingActor::_newEvent));
 		_clip->addEventListener(TouchEvent::MOVE, CLOSURE(this, &SlidingActor::_newEvent));
 		_clip->addEventListener(TouchEvent::MOVE, CLOSURE(this, &SlidingActor::_newEvent));
-
-		//for (int i = 0; i < NUM; ++i)
-		//	_prev[i] = Vector2(0,0);
 	}
 	}
 	
 	
 	void SlidingActor::destroy()
 	void SlidingActor::destroy()
@@ -64,6 +61,7 @@ namespace oxygine
 	{
 	{
 		updateDragBounds();
 		updateDragBounds();
 		_drag.snapClient2Bounds();
 		_drag.snapClient2Bounds();
+		_sliding = false;
 	}
 	}
 
 
 	void SlidingActor::stop()
 	void SlidingActor::stop()
@@ -79,6 +77,8 @@ namespace oxygine
 			_content->detach();
 			_content->detach();
 		}
 		}
 
 
+		_speed = Vector2(0, 0);
+
 		_content = content;
 		_content = content;
 		_drag.init(content.get());
 		_drag.init(content.get());
 		
 		
@@ -103,24 +103,9 @@ namespace oxygine
 		_drag.setDragBounds(bounds);
 		_drag.setDragBounds(bounds);
 	}
 	}
 
 
-	float getOffset(float cp, float size)
-	{
-		float half = size/2;
-
-		float pos = cp - half;
-		pos = int(pos / size) * size;
-		float d = cp - pos;
-
-		//float t = 
-		d = scalar::clamp(d, -10.0f, 10.0f);
-
-		return d;
-	}
-
 	const timeMS fdt = 1000/60;
 	const timeMS fdt = 1000/60;
 	//const float fdt = 20;
 	//const float fdt = 20;
 
 
-	//int lastPosStep = 20;
 	void SlidingActor::doUpdate(const UpdateState &us)
 	void SlidingActor::doUpdate(const UpdateState &us)
 	{
 	{
 		if (!_content)
 		if (!_content)
@@ -265,23 +250,28 @@ namespace oxygine
 					else
 					else
 					{
 					{
 						Vector2 dr = pos - old->pos;
 						Vector2 dr = pos - old->pos;
-						Vector2 ns = (dr * 1000.0f) / (tm - old->tm);
-					
-						/*
-						int d = tm - _downTime;
-						Vector2 dr2 = pos - _downPos;
-						Vector2 ts = dr2 / float(d) * 1000.0f;
-						ts.x = 0;
-
-						log::messageln("fs: %.2f %d ns: %.2f %d", ns.y, int(tm), ts.y, d);
-						*/
-						//ns = ts;
-
-
-						if (_speed.dot(ns) < 0)
-							_speed = ns;
-						else					
-							_speed += ns;
+						timeMS v = tm - old->tm;
+						OX_ASSERT(v);
+						if (v)
+						{
+							Vector2 ns = (dr * 1000.0f) / v;
+
+							/*
+							int d = tm - _downTime;
+							Vector2 dr2 = pos - _downPos;
+							Vector2 ts = dr2 / float(d) * 1000.0f;
+							ts.x = 0;
+
+							log::messageln("fs: %.2f %d ns: %.2f %d", ns.y, int(tm), ts.y, d);
+							*/
+							//ns = ts;
+
+
+							if (_speed.dot(ns) < 0)
+								_speed = ns;
+							else
+								_speed += ns;
+						}
 					}
 					}
 
 
 				
 				

+ 3 - 0
oxygine/src/SlidingActor.h

@@ -38,8 +38,11 @@ namespace oxygine
 
 
 		/**max allowed radius of touch move when content could be clicked*/
 		/**max allowed radius of touch move when content could be clicked*/
 		void setTouchThreshold(float rad);
 		void setTouchThreshold(float rad);
+		/**sets actor vith scrollable data*/
 		void setContent(spActor content);
 		void setContent(spActor content);
+		/**lock for user scrolling*/
 		void setLocked(bool locked);
 		void setLocked(bool locked);
+		/**snaps content*/
 		void snap();
 		void snap();
 		/**stop if sliding*/
 		/**stop if sliding*/
 		void stop();
 		void stop();

+ 5 - 0
tools/others/build_oxygine_with_sdl.py

@@ -6,6 +6,7 @@ import zipfile
 temp = "../../temp"
 temp = "../../temp"
 SDL_dest = temp + "/SDL"
 SDL_dest = temp + "/SDL"
 OXYGINE_dest = temp + "/oxygine-framework/"
 OXYGINE_dest = temp + "/oxygine-framework/"
+SOUND_dest = temp + "/oxygine-sound/"
 
 
 print "cleaning temp..."
 print "cleaning temp..."
 shutil.rmtree(temp, True)
 shutil.rmtree(temp, True)
@@ -17,6 +18,9 @@ os.system(cmd)
 cmd = "hg archive -R ../../../SDL %s" % (SDL_dest, )
 cmd = "hg archive -R ../../../SDL %s" % (SDL_dest, )
 os.system(cmd)
 os.system(cmd)
 
 
+cmd = "hg archive -R ../../../oxygine-sound %s" % (SOUND_dest, )
+os.system(cmd)
+
 shutil.rmtree(SDL_dest + "/test")
 shutil.rmtree(SDL_dest + "/test")
 
 
 def fix_file(name, cb):
 def fix_file(name, cb):
@@ -55,6 +59,7 @@ def copy(path):
     
     
         
         
 enum(OXYGINE_dest + "/examples/", copy)
 enum(OXYGINE_dest + "/examples/", copy)
+enum(SOUND_dest + "/examples/", copy)
 
 
 shutil.copy(SDL_dest + "/android-project/src/org/libsdl/app/SDLActivity.java", 
 shutil.copy(SDL_dest + "/android-project/src/org/libsdl/app/SDLActivity.java", 
             OXYGINE_dest + "/oxygine/SDL/android/lib/src/org/libsdl/app/SDLActivity.java")
             OXYGINE_dest + "/oxygine/SDL/android/lib/src/org/libsdl/app/SDLActivity.java")

+ 10 - 3
tools/src2/process_atlas.py

@@ -9,6 +9,11 @@ def as_int(attr, df = 0):
         return df
         return df
     return int(attr)
     return int(attr)
 
 
+def as_float(attr, df = 0):
+    if not attr:
+        return df
+    return float(attr)    
+
 def as_bool(attr):
 def as_bool(attr):
     if not attr:
     if not attr:
         return False
         return False
@@ -250,6 +255,8 @@ class atlas_Processor(process.Process):
             rows = as_int(image_el.getAttribute("rows"))
             rows = as_int(image_el.getAttribute("rows"))
             frame_height = as_int(image_el.getAttribute("frame_height"))
             frame_height = as_int(image_el.getAttribute("frame_height"))
             border = as_int(image_el.getAttribute("border"))
             border = as_int(image_el.getAttribute("border"))
+            #sq = as_float(image_el.getAttribute("scale_quality"), 1)
+            #next.scale_quality *= sq
             
             
             if not columns:
             if not columns:
                 columns = 1
                 columns = 1
@@ -278,7 +285,7 @@ class atlas_Processor(process.Process):
             if size_warning:
             if size_warning:
                 context.warnings += 1
                 context.warnings += 1
 
 
-            finalScale = context.get_apply_scale(True, walker)
+            finalScale = context.get_apply_scale(True, next)
             upscale = False            
             upscale = False            
             if finalScale > 1:
             if finalScale > 1:
                 if not context.args.upscale:
                 if not context.args.upscale:
@@ -286,7 +293,7 @@ class atlas_Processor(process.Process):
                 else:
                 else:
                     upscale = True
                     upscale = True
 
 
-            resAnim.frame_scale = context.get_apply_scale(False, walker)
+            resAnim.frame_scale = context.get_apply_scale(False, next)
             #todo, fix bug when frame_scale > 1 and finalScale = 1
             #todo, fix bug when frame_scale > 1 and finalScale = 1
 
 
             resAnim.frame_size = (applyScale(frame_width, finalScale),
             resAnim.frame_size = (applyScale(frame_width, finalScale),
@@ -366,7 +373,7 @@ class atlas_Processor(process.Process):
 
 
         def get_aligned_frame_size(frame):            
         def get_aligned_frame_size(frame):            
             def align_pixel(p):
             def align_pixel(p):
-                if not context.compression:
+                if compression == "no":
                     return p + 1
                     return p + 1
                 align = 4
                 align = 4
                 v = p % align
                 v = p % align