Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Paint Pixels #293342
10/10/09 19:36
10/10/09 19:36
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Hi there iīm currently not know how to continue my project cause i want to let the user draw a black pixel on the screen as long as he holds mouse left. But how can i realize that? I used draw_line draw_box and bmap_create but nothing works.

I donīt load a level its a pure 2d game with one picture in the background.

Greets

sry this for lite_c posted in wrong section.

Last edited by Rasch; 10/10/09 19:38.
Re: Paint Pixels [Re: Rasch] #293344
10/10/09 19:43
10/10/09 19:43
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
ermm i was going to suggest using 'draw_point3d' but then i realised you were only after a 2D solution.

Ermm I guess you could dynamically create a BMAP* that is 1x1 and fill it with a colour using 'bmap_fill'. Then you can display the BMAP* in a PANEL*.

You can use 'while(mouse_left==1)' to make sure it is only created when the mouse button is held. You can use either 'mouse_pos.x/y or mouse_cursor.x/y' to get the current position of the mouse.

Re: Paint Pixels [Re: DJBMASTER] #293345
10/10/09 19:44
10/10/09 19:44
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Alright i will try this solution now

thanks

Re: Paint Pixels [Re: Rasch] #293347
10/10/09 19:57
10/10/09 19:57
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Here is my quick go...
Code:
#include <acknex.h>
#include <default.c>

BMAP* pixel_bmap = "#1x1x16"; 
var temp_mouse_posx = 0;
var temp_mouse_posy = 0;

void main()
{	
	mouse_mode = 4;
	vec_set(screen_color,vector(255,255,255));
	wait(1);
	bmap_fill(pixel_bmap,vector(0,0,0),100);
	
	while(1)
	{
		mouse_pos.x = mouse_cursor.x;
		mouse_pos.y = mouse_cursor.y;
		if(mouse_left==1)
		{
			
			if(temp_mouse_posx != mouse_pos.x && temp_mouse_posy != mouse_pos.y)
			{
				
				PANEL* temp_panel = pan_create("bmap = pixel_bmap;",1);
				temp_panel.pos_x = mouse_pos.x;
				temp_panel.pos_y = mouse_pos.y;
				set(temp_panel,SHOW);
				temp_mouse_posx = mouse_pos.x;
				temp_mouse_posx = mouse_pos.y;
			}	
		}
		wait(1);
	}
}



Last edited by DJBMASTER; 10/10/09 20:04.
Re: Paint Pixels [Re: DJBMASTER] #293349
10/10/09 20:10
10/10/09 20:10
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Great that works but the problem is if i move to fast it creates single points is therer a way to convert this to a full line?

Re: Paint Pixels [Re: Rasch] #293353
10/10/09 20:48
10/10/09 20:48
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
um yeh, that is annoying, maybe 'mouse_sync' will help as it uses more computing power to syncronize the engine cursor with the windows one.

That's all I can think of at the moment.

Re: Paint Pixels [Re: DJBMASTER] #293374
10/11/09 03:19
10/11/09 03:19
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
treyd the set_pixel Api?


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1