Framework Mk III (Sound Effects)

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Framework Mk III (Sound Effects)

Post by chili » April 25th, 2012, 11:17 am

For the details of this release, check the blog kiddies.

NOTE: Do NOT use this version of the framework for the tutorials until lesson 16. Use the version that is meant for download at lesson 1.
Attachments
Chili DirectX Framework V12.04.24 (SFX).zip
(391.21 KiB) Downloaded 10106 times
Chili

KPence
Posts: 18
Joined: April 21st, 2012, 12:18 am

Re: Framework Mk III (Sound Effects)

Post by KPence » April 25th, 2012, 9:17 pm

You're amazing, thank you
Needs more foo

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Framework Mk III (Sound Effects)

Post by chili » April 26th, 2012, 3:33 am

No problem bro, I live to give. 8-)
Chili

nG Inverse
Posts: 115
Joined: April 27th, 2012, 11:49 pm

Re: Framework Mk III (Sound Effects)

Post by nG Inverse » April 29th, 2012, 5:01 pm

Nice, I'll get experimenting with it soon.

By the way, you're missing the colon in the URL after "http" with the link from the blog.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Framework Mk III (Sound Effects)

Post by chili » April 29th, 2012, 5:17 pm

Thanks for the heads up bro.
Chili

Itsme
Posts: 1
Joined: June 10th, 2012, 4:41 pm

Re: Framework Mk III (Sound Effects)

Post by Itsme » June 10th, 2012, 5:08 pm

May I tell you this is not a really user friendly code. You can optimize it by ordering the classes differently. For example you don't need WinMain. This makes it possible that the user starts in the main class with an almost empty file. This will make it more user friendly and less messy. You may use it if you want to.
See:

main.cpp

Code: Select all

#include "Window.h"

int main(){
	Window a_window(400,400,"aye captain");
	
	while (a_window.isOpen()){
// you can do here the same stuff as in  Game::ComposeFrame() with a few small changes.

}
}
Window.h

Code: Select all

#ifndef WINDOW_H
#define WiNDOW_H
#include <Windows.h>
#include <string>
class Window{


private:
	const char* WINDOWTITLE;
	void CreateWWindow();
	void RegisterWClass();
	int width, height;
public:
	Window(unsigned int widht, unsigned int height, std::string);

	bool isOpen();
};

#endif
windows.cpp

Code: Select all

#include "Window.h"

HINSTANCE Ghinst;	// Global hinstance
HWND fWindow;	// Global handle
MSG msg;		// Global Message
int Wcount =0;	// prevents crash when creating more than one window
bool quit;		// fixes quit glich
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParan);	//calling result call back


/// registering WindowClass
void Window::RegisterWClass(){
	WNDCLASS wc;		
	wc.cbClsExtra	= 0;
	wc.cbWndExtra	= 0;
	wc.hbrBackground	= (HBRUSH) LTGRAY_BRUSH;
	wc.hCursor		= LoadCursor(Ghinst,IDC_ARROW);
	wc.hIcon		= LoadIcon(Ghinst,IDI_APPLICATION);
	wc.hInstance	= Ghinst;
	wc.lpfnWndProc	= WndProc;
	wc.lpszClassName	= "THIS";
	wc.lpszMenuName	= NULL;
	wc.style		= CS_VREDRAW | CS_HREDRAW | CS_DROPSHADOW;

	if(!RegisterClassA(&wc))throw "Could not register class!";
}
/// creating Window
void Window::CreateWWindow(){
	fWindow = CreateWindow("THIS", WINDOWTITLE,		// class name | Title
		WS_OVERLAPPEDWINDOW | WS_VISIBLE,			//style
		0,0,								//position
		width, height						//size
		,NULL, NULL,						// parent  | Menu
		Ghinst, NULL);						// HINSTANCE | lparam
	if (fWindow == NULL)throw "Could not create Window.";
}

/// constructor defines window width, window height, window title
Window::Window(unsigned int width, unsigned int height, std::string title){
	quit = false;
	if (Wcount == 0)	RegisterWClass();	// register class if first window
	// init
	WINDOWTITLE		= title.c_str();
	this->width		= width;
	this->height	= height;
	//creatingwindow
	CreateWWindow();
	Wcount++;
}

//handles messages and checks if window is open
bool Window::isOpen(){
	if (PeekMessage(&msg, NULL,0,0,PM_REMOVE)){
	if(msg.message == WM_QUIT) return false;
	TranslateMessage(&msg);
	DispatchMessage(&msg);
	}
	return !quit;
}

//LRESULT CALLBACK WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){switch (msg){
case WM_DESTROY: quit = true; break;


}return (DefWindowProc(hwnd,msg,wParam,lParam));}

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Framework Mk III (Sound Effects)

Post by chili » June 11th, 2012, 3:40 am

I don't worry about creating a wrapper for the Win32 stuff because it's mostly boilerplate and it's insignificant compared to rest of the code in any decent-sized project.

If I were to pretty it up, I would take an approach similar to what is done here:

http://rastertek.com/dx11tut02.html
Chili

User avatar
magusofmirrors
Posts: 56
Joined: May 12th, 2012, 10:03 pm

Re: Framework Mk III (Sound Effects)

Post by magusofmirrors » June 11th, 2012, 5:06 am

I finished that tutorial recently! It's funny seeing how I typed down all the example source instead of copy-pasting. I believe that was the old-fashioned way of learning things, right? (And before then was experimentation and development?)
The admins are coming!!!

Image

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: Framework Mk III (Sound Effects)

Post by cameron » July 28th, 2012, 11:42 pm

I put the program on my desktop and put my game into it i get 0 errors and pops this up.
Assertion failed!

Program: C:\Users\cameron\ShipGame2.exe
File: c:\users\cameron\desktop\shipgame2\D3DGraphics.cpp
Line: 73


Expression: x < 800

blah blah blah



Note this only pops up in debug configuration.
Computer too slow? Consider running a VM on your toaster.

User avatar
viruskiller
Posts: 399
Joined: June 14th, 2012, 5:07 pm

Re: Framework Mk III (Sound Effects)

Post by viruskiller » July 29th, 2012, 7:13 am

from what i saw in the framework so far i think most of the assertion errors are when your game code try'ts to access pixels off the screen.
so make sure u're not trying to draw anything outside the screen.
or if u'r drawing objects then make sure they all exist at the draw time,an empty object will have giberish in it's x,y coordinates and will tell the gfx.putpixel to draw somewhere like x -843424,y32342
and that will trigger the assertion check.
an assertion is a condition check that will trigger an error if the condition is not met,in your case x value of the pixel u drawing is no longer on the screen:)

Post Reply