• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Lugie

Problem.

17 posts in this topic

sorry for having to start a new topic but im not getting any replies in my other one. i have the book "Multiplayer Game Programming" which taught me a few things, but some things i cant get to work and im still not real sharp on, due to some lack of explanation. of of these is the displaying of child windows. i THINK i have the code all right for it, but they just dont show in the window. here''s what i have.
  #include <windows.h>
#include <stdio.h>

#define IDC_hBU_STATIC 40001
#define IDC_hBU_EDIT 40002

HWND hBU_STATIC = NULL;
HWND hBU_EDIT = NULL;

LPCTSTR lpszApplicationName = "Sweet";
LPCTSTR lpszTitle = "Totally Sweet Flipped Out Ninjas";

LRESULT CALLBACK fnMessageProcessor (HWND, UINT, WPARAM, LPARAM);

int WINAPI WinMain (HINSTANCE hInstance, 
					HINSTANCE hPrevInstance, 
					PSTR szCmdLine, 
					int iCmdShow) {
						
	HWND hWnd;
	MSG msg;
	WNDCLASSEX wndclass;
	LOGBRUSH background;

	wndclass.cbSize = sizeof(wndclass);
	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = fnMessageProcessor;
	wndclass.cbClsExtra = 0;
	wndclass.cbWndExtra = 0;
	wndclass.hInstance = hInstance;
	wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
	wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
	wndclass.lpszMenuName = NULL;
	wndclass.lpszClassName = "Sweet";
	wndclass.hIconSm = LoadIcon( NULL, IDI_APPLICATION );
	background.lbStyle = BS_PATTERN;
	background.lbHatch = (long) LoadImage( hInstance, "loginbg.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); 
	wndclass.hbrBackground = CreateBrushIndirect(&background);

if( ( RegisterClassEx( &wndclass ) == 0 ) ) {
	exit(1);
}


hWnd = CreateWindow("SWEET",
					"Totally Sweet Flipped Out Ninjas",
					WS_EX_TRANSPARENT | WS_EX_CLIENTEDGE,
					CW_USEDEFAULT,
					CW_USEDEFAULT,
					400,
					200,
					NULL,
					NULL,
					hInstance,
					NULL );

hBU_STATIC = CreateWindow( "account",
						"Account:",
						WS_CHILD | WS_VISIBLE,
						80,
						72,
						120,
						28,
						hWnd,
						NULL,
						hInstance,
						NULL );

hBU_EDIT = CreateWindow( "accountfield",
						"!",
						WS_CHILD | WS_VISIBLE | SS_CENTER,
						80,
						72,
						120,
						28,
						hWnd,
						NULL,
						hInstance,
						NULL );

ShowWindow( hWnd, iCmdShow );
UpdateWindow( hWnd );


while( TRUE ) {

	if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
		if (!GetMessage(&msg, NULL, 0, 0))
		break;
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}
}

return ( msg.wParam );
}

LRESULT CALLBACK fnMessageProcessor ( HWND hWnd, UINT iMsg,
WPARAM wParam, LPARAM lParam )
{

switch( iMsg )
	{
		case WM_CREATE:
			return( 0 );
		case WM_PAINT:
			return( 0 );
		case WM_DESTROY:
			PostQuitMessage( 0 );
			return( 0 );
}

return DefWindowProc( hWnd, iMsg, wParam, lParam );

}  
0

Share this post


Link to post
Share on other sites
I din''t read all your code, but you need to
ShowWindow( hWnd, iCmdShow );
UpdateWindow( hWnd );

for every window, i guess.

0

Share this post


Link to post
Share on other sites
You realize it''s only been a few hours (a day at the most) since you last posted to the other thread? The proper thing to do is to "bump" your thread up by posting follow-up questions at the end - "Anyone?", "I really need some insight on this", etc.

Since this is a beginners forum, we''re very careful to be extra nice and keep the flamers away, but that''s what you should do in the future. Personally, I saw the post but was (and am) tired. Maybe when I wake up from my nap...?

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
0

Share this post


Link to post
Share on other sites
Each time you create a window you specify which window-class it should belong to (the first parameter in the call to CreateWindow). This window class must have been defined before creating the window. As far as I can see you do not define the "account" and "accountfield" classes.

Judging from the names of the HWND-variables you may simply want to use the pre-defined classes "STATIC" and "EDIT".
0

Share this post


Link to post
Share on other sites
that worked, thanks.

now i have one last problem: how do i modify the static text to look different? or isnt that possible?
0

Share this post


Link to post
Share on other sites
? i need to make the background of my static text transparent, maybe change the font if thats possible, and make the text white. does static text support this or do i have to use something else?
0

Share this post


Link to post
Share on other sites
i have searched various places and i cant come up with a way to edit static text. ive read my book through, i cant find it. any help is appreciated... or at least point me to a tutorial or something on it.
0

Share this post


Link to post
Share on other sites
SetWindowText(LPCTSTR lpszString)

Search for SetWindowText at msdn.microsoft.com, and you''ll get a whole long list of child window functions
0

Share this post


Link to post
Share on other sites
You should not have your paint message like:

WM_PAINT:
return 0;

The window will not be repainted unless you call BeginPaint and
EndPaint or(validateRect). Windows will just send multiple paint messages!!! You should atleast declare WM_PAINT as:

WM_PAINT:
BeginPaint(hwnd,&ps);
EndPaint(hwnd, &ps);
return 0;


-----------------------------
"There are ones that say they can and there are those who actually do."

"...u can not learn programming in a class, you have to learn it on your own."

0

Share this post


Link to post
Share on other sites
You should not have your paint message like:

WM_PAINT:
return 0;

The window will not be repainted unless you call BeginPaint and
EndPaint or(validateRect). Windows will just send multiple paint messages!!! You should atleast declare WM_PAINT as:

WM_PAINT:
BeginPaint(hwnd,&ps);
EndPaint(hwnd, &ps);
return 0;


-----------------------------
"There are ones that say they can and there are those who actually do."

"...u can not learn programming in a class, you have to learn it on your own."

0

Share this post


Link to post
Share on other sites
hmph. static text troubles me. are there any other ways of putting text on a window? and so it isnt bold looking like static text is?
0

Share this post


Link to post
Share on other sites
i really cant get this to work. i put in the codes with all the right params set, and i keep getting these syntax errors. i dont know if im putting them in the wrong place, or what. could somebody please take me step through step how to accually set it so the background of the child window is transparent and how to change the font to something more appealing? ive "RTFM", its just that its not explained very well to a beginner how to use some of the functions really.
0

Share this post


Link to post
Share on other sites
la la la... ill just sit here and talk to myself then

so, how was you''re day?

well me, it blew dogs for quarters.

oh, whys that?

well everybody hates me on the gamedev.net forums and they wont help me out with my static text problems/questions!

oh that sucks.

sure does!
0

Share this post


Link to post
Share on other sites