Framework Mk III (Sound Effects)
Framework Mk III (Sound Effects)
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.
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 10107 times
Chili
-
- Posts: 115
- Joined: April 27th, 2012, 11:49 pm
Re: Framework Mk III (Sound Effects)
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.
By the way, you're missing the colon in the URL after "http" with the link from the blog.
Re: Framework Mk III (Sound Effects)
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
Window.h
windows.cpp
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.
}
}
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
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));}
Re: Framework Mk III (Sound Effects)
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
If I were to pretty it up, I would take an approach similar to what is done here:
http://rastertek.com/dx11tut02.html
Chili
- magusofmirrors
- Posts: 56
- Joined: May 12th, 2012, 10:03 pm
Re: Framework Mk III (Sound Effects)
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!!!
Re: Framework Mk III (Sound Effects)
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.
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.
- viruskiller
- Posts: 399
- Joined: June 14th, 2012, 5:07 pm
Re: Framework Mk III (Sound Effects)
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:)
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:)