Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Trading Journey
by howardR. 04/24/24 20:04
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (wandaluciaia, AndrewAMD, 1 invisible), 765 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
windows functions? #300714
12/04/09 17:06
12/04/09 17:06
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hi there..

i wanted to ask if someone knows a way/tutorial/help for my problem:

I want to create editor menüs. At the moment, i do this with bitmaps, panels and buttons. but isn´t there a way to use the windows bordes, frames, tooltip windows, menüs ...etc... inside the A7 window?

Last edited by Espér; 12/04/09 17:10.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: windows functions? [Re: Espér] #300719
12/04/09 18:03
12/04/09 18:03
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
yes there is but not very easy.

best practice for that would be using c# wrapper and c# itself.


3333333333
Re: windows functions? [Re: Quad] #300724
12/04/09 18:13
12/04/09 18:13
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hmm.. Sylar gave me the following code...
Can someone explain me how to ask wich menüpoint was selected??? Means - How to ask if new, end, open ...ect is selected.

Code:
#include <windows.h>

long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam);

function test()
{
    long menu;
    long hSubMenu;
    long hSubMenu2;
    
    HWND hwnd=hWnd;

    menu=CreateMenu();
    hSubMenu=CreateMenu();
    hSubMenu2=CreateMenu();

    InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"Neu");
    InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Öffnen");
    InsertMenu(hSubMenu,3,MF_BYPOSITION|MF_STRING,3,"Speichern");
    InsertMenu(hSubMenu,4,MF_BYPOSITION|MF_STRING,4,"Beenden");
    
    InsertMenu(hSubMenu2,1,MF_BYPOSITION|MF_STRING,5,"Test1");
    InsertMenu(hSubMenu2,2,MF_BYPOSITION|MF_STRING,6,"Test2");

    InsertMenu(menu,0,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu,"Datei");
    InsertMenu(menu,1,MF_BYPOSITION|MF_STRING|MF_POPUP,hSubMenu2,"Bearbeiten");
    
    SetMenu(hwnd,menu);
}


void main()
{
    video_set(800,600,32,2);
    
    level_load(NULL);
    wait(2);
    test();
    
  on_scanmessage = ScanMessage;
}

long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (WM_COMMAND) {
            case message:
                switch (wParam) {
                    case 1:
                        printf("Es wurde auf 'neu' geklickt");
                        return(1);
                        
                    case 2:
                        printf("Es wurde auf 'öffnen' geklickt");
                        return(1);

                    // USW:
                    
                    default:
                        break;
                }
                
                break;
            default:
                break;
        }
}



Sylar won´t help me, because he misunderstood a message from me..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: windows functions? [Re: Quad] #300726
12/04/09 18:21
12/04/09 18:21
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
It's possible with WINAAPI functions to do this like you would in C/C++. You can see an example for this in mandelbrot_legacy.c. It can be made work in pure mode, I think I tried that once. But you have to consider that it makes your "window" in which your game is rendered smaller, so it's squeezed a bit, so you have to enlarge your window by the same size.

You can see that this works in the Visual level editor by Alexey Rozhkov (=Shadow969), which should be available at AU Resources as it won the GS contest one or two years ago.


EDIT (I didn't see your new post): I don't know so much about WINAPI functions but according to the code I see, it looks like wParam tells you which button was clicked.

Last edited by Lukas; 12/04/09 18:24.
Re: windows functions? [Re: Lukas] #300731
12/04/09 18:48
12/04/09 18:48
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
yes
InsertMenu(hSubMenu,1,MF_BYPOSITION|MF_STRING,1,"Neu");
InsertMenu(hSubMenu,2,MF_BYPOSITION|MF_STRING,2,"Öffnen");

this numbers are passed as wparam, so you know which is which


3333333333
Re: windows functions? [Re: Quad] #300747
12/04/09 20:18
12/04/09 20:18
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
ah..ok...

what is this:
on_scanmessage = ScanMessage;


Do i need this 1:1 in my Project?


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: windows functions? [Re: Espér] #300753
12/04/09 21:26
12/04/09 21:26
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
on_scanmassage is the function that listens/catches messages that have been sent to lite-c window. you need to write this function yourself(which is ScanMessage in the script you posted) and process messages. ie WM_COMMAND is a message. when such messages sent on_scanmessage function is triggered. You check which message came in and act respectively.

Last edited by Quadraxas; 12/04/09 21:26.

3333333333
Re: windows functions? [Re: Quad] #300799
12/05/09 12:36
12/05/09 12:36
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
ok.. i wrote this code now:
Code:
//-------------------------------------------------------------------------------------------------
// • Einbinden der Scripts
//-------------------------------------------------------------------------------------------------
#include <acknex.h>
#include <default.c>
#include <windows.h>

//-------------------------------------------------------------------------------------------------
// • Einbinden der Pfade
//-------------------------------------------------------------------------------------------------

//-------------------------------------------------------------------------------------------------
// • Funktionen
//-------------------------------------------------------------------------------------------------
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam);

function menucreate()
{
	long menuheader;
	long submenu1;
	long submenu12;
	
	HWND hwnd=hWnd;
	
	//	CreateMenu(); ist der Befehl dazu, der gibt ein Handle auf das neue Menü zurück
	menuheader = CreateMenu();
	submenu1 = CreateMenu();
	submenu12 = CreateMenu();
	
	//	InsertMenu(); ist der Befehl der Menüpunkte erstellt
	// InsertMenu(longpointer, Position, Flags, sublongpointer / id, "Anzeigestring");
	InsertMenu(submenu1, 1, MF_BYPOSITION|MF_STRING|MF_POPUP, submenu12, "Neu");
	InsertMenu(submenu1, 2, MF_BYPOSITION|MF_STRING, 2, "Öffnen");
	InsertMenu(submenu1, 3, MF_BYPOSITION|MF_STRING, 3, "Beenden");
	
	InsertMenu(submenu12, 4, MF_BYPOSITION|MF_STRING, 4, "Karte");
	InsertMenu(submenu12, 5, MF_BYPOSITION|MF_STRING, 5, "Map");
	InsertMenu(submenu12, 6, MF_BYPOSITION|MF_STRING, 6, "Quest");
	
	InsertMenu(menuheader, 0, MF_BYPOSITION|MF_STRING|MF_POPUP, submenu1, "Datei");
	
	
	SetMenu(hwnd,menuheader);
}

//-------------------------------------------------------------------------------------------------
// • Mainscripts
//-------------------------------------------------------------------------------------------------
function main()
{
	fps_max= 60;
	video_mode = 8;
	video_aspect = 1.777;
	level_load(NULL);
	wait(3);
	
	menucreate();
	on_scanmessage = ScanMessage;
}

//-------------------------------------------------------------------------------------------------
// • Longs
//-------------------------------------------------------------------------------------------------
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (WM_COMMAND) {
		case message:
		switch (wParam) {
			case 2:
			printf("Es wurde auf 'Öffnen' geklickt");
			return(1);
			
			case 3:
			printf("Es wurde auf 'Beenden' geklickt");
			return(1);
			
			case 4:
			printf("Es wurde auf 'Neue Karte' geklickt");
			return(1);
			
			case 5:
			printf("Es wurde auf 'Neue Map' geklickt");
			return(1);
			
			case 6:
			printf("Es wurde auf 'Neue Quest' geklickt");
			return(1);

			
			default:
			break;
		}
		
		break;
		default:
		break;
	}
}



But now nothing reacts when the project is started.. i need to end the process via the task manager. What´s wrong?

Last edited by Espér; 12/05/09 12:37.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: windows functions? [Re: Espér] #300830
12/05/09 17:45
12/05/09 17:45
Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
Quad Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,210
Ä°stanbul, Turkey
hey 2 problems,

1.
Code:
long ScanMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (WM_COMMAND) {
		case message:


should be

switch (message) {
case WM_COMMAND:

because the variable here is the message, WM_COMMAND is only a #defined constant

2. you are only handling WM_COMMAND message, there are alot of other possible messages could be goind around, so you should return a value fot hem. make the last default return 0;

that's all i guess.

Last edited by Quadraxas; 12/05/09 17:45.

3333333333
Re: windows functions? [Re: Quad] #300832
12/05/09 17:52
12/05/09 17:52
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
IT WORKS

Great.. thanks Quadraxas.. my hero ^^


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Page 1 of 3 1 2 3

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