Breach

Check-in [1ba914670e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:minor bugfix to drawing the outline for a box (StateEditing::UpdateGame())
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1ba914670efbc44d58f95023ec60564b741ea118
User & Date: donnyjward@gmail.com 2011-09-10 02:19:55
Context
2011-09-10
04:39
colors can now be assigned to blocks in edit mode using right click! right clicking a block will cycle through all the available colors check-in: 06e2db82a3 user: donnyjward@gmail.com tags: trunk
02:19
minor bugfix to drawing the outline for a box (StateEditing::UpdateGame()) check-in: 1ba914670e user: donnyjward@gmail.com tags: trunk
02:10
in editmode, boxes can be created by dragging in any direction. there is also a minimum dimension that must be satisifed to create the block. an outline will also draw to show you the box you are dragging out. check-in: e2d78ca550 user: donnyjward@gmail.com tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to s_statemachine.cpp.

603
604
605
606
607
608
609





610
611
612
613
614
615
616
...
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
...
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
			case SDL_MOUSEBUTTONDOWN:
				switch (event.button.button)
				{
					case SDL_BUTTON_LEFT:
						leftClickHeld = true;
						//start drawing box
						SDL_GetMouseState(&(boxStartX), &(boxStartY));





						break;
					case SDL_BUTTON_RIGHT:

						break;
				}
				break;
			case SDL_MOUSEBUTTONUP:
................................................................................
		boxEndY = Objects.mouseY;
		fixBoxCoords();

		//check for minimum size
		if ( boxBottomRightX - boxTopLeftX < MIN_BLOCKLENGTH || boxBottomRightY - boxTopLeftY < MIN_BLOCKLENGTH)
		{
			goodBox = false;
			cout << fileID << "editmode: box doesn't meet minimum dimensions (" << MIN_BLOCKLENGTH << " x " << MIN_BLOCKLENGTH << ")\n";
			cout << fileID << "editmode: box was (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ")\n";
		}

		outlineTop.x = boxTopLeftX;
		outlineTop.y = boxTopLeftY;
		outlineTop.w = boxBottomRightX - boxTopLeftX;
		outlineTop.h = OUTLINE_THICKNESS;

................................................................................

		fixBoxCoords();
		
		//check for minimum size
		if ( boxBottomRightX - boxTopLeftX < MIN_BLOCKLENGTH || boxBottomRightY - boxTopLeftY < MIN_BLOCKLENGTH)
		{
			goodBox = false;
			cout << fileID << "editmode: box doesn't meet minimum dimensions (" << MIN_BLOCKLENGTH << " x " << MIN_BLOCKLENGTH << ")\n";
			cout << fileID << "editmode: box was (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ")\n";
		}

//		Block(int startX, int startY, int width, int height, int hp, bool soft, color_t c);
//	addObject( new Block(0, 0, 50, 100, 100, true, COLOR_RED) );
		if (goodBox)
		{
			cout << fileID << "editmode: creating a (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ") box\n";







>
>
>
>
>







 







|
|







 







|
|







603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
...
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
...
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
			case SDL_MOUSEBUTTONDOWN:
				switch (event.button.button)
				{
					case SDL_BUTTON_LEFT:
						leftClickHeld = true;
						//start drawing box
						SDL_GetMouseState(&(boxStartX), &(boxStartY));

						//cosmetic bugfix 
						boxEndX = boxStartX+1;
						boxEndY = boxStartY+1;
						fixBoxCoords();
						break;
					case SDL_BUTTON_RIGHT:

						break;
				}
				break;
			case SDL_MOUSEBUTTONUP:
................................................................................
		boxEndY = Objects.mouseY;
		fixBoxCoords();

		//check for minimum size
		if ( boxBottomRightX - boxTopLeftX < MIN_BLOCKLENGTH || boxBottomRightY - boxTopLeftY < MIN_BLOCKLENGTH)
		{
			goodBox = false;
			//cout << fileID << "editmode: box doesn't meet minimum dimensions (" << MIN_BLOCKLENGTH << " x " << MIN_BLOCKLENGTH << ")\n";
			//cout << fileID << "editmode: box was (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ")\n";
		}

		outlineTop.x = boxTopLeftX;
		outlineTop.y = boxTopLeftY;
		outlineTop.w = boxBottomRightX - boxTopLeftX;
		outlineTop.h = OUTLINE_THICKNESS;

................................................................................

		fixBoxCoords();
		
		//check for minimum size
		if ( boxBottomRightX - boxTopLeftX < MIN_BLOCKLENGTH || boxBottomRightY - boxTopLeftY < MIN_BLOCKLENGTH)
		{
			goodBox = false;
			//cout << fileID << "editmode: box doesn't meet minimum dimensions (" << MIN_BLOCKLENGTH << " x " << MIN_BLOCKLENGTH << ")\n";
			//cout << fileID << "editmode: box was (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ")\n";
		}

//		Block(int startX, int startY, int width, int height, int hp, bool soft, color_t c);
//	addObject( new Block(0, 0, 50, 100, 100, true, COLOR_RED) );
		if (goodBox)
		{
			cout << fileID << "editmode: creating a (" << boxBottomRightX - boxTopLeftX << " x " << boxBottomRightY - boxTopLeftY << ") box\n";