forked from len0rd/rockbox
renamed cpp extensions to c, started coding file functions
file functions not working yet git-svn-id: svn://svn.rockbox.org/rockbox/trunk@262 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a6ca085a35
commit
ffb9e3a5bd
7 changed files with 35 additions and 309 deletions
|
@ -28,14 +28,14 @@
|
||||||
|
|
||||||
// varaibles
|
// varaibles
|
||||||
unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; // the display
|
unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; // the display
|
||||||
char bitmap[LCD_WIDTH][LCD_HEIGHT]; // the ui display
|
char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
|
||||||
|
|
||||||
BITMAPINFO2 bmi =
|
BITMAPINFO2 bmi =
|
||||||
{
|
{
|
||||||
sizeof (BITMAPINFOHEADER),
|
sizeof (BITMAPINFOHEADER),
|
||||||
LCD_WIDTH, -LCD_HEIGHT, 1, 8,
|
LCD_WIDTH, -LCD_HEIGHT, 1, 8,
|
||||||
BI_RGB, 0, 0, 0, 2, 2,
|
BI_RGB, 0, 0, 0, 2, 2,
|
||||||
UI_LCD_COLOR, 0, // green background color
|
UI_LCD_BGCOLOR, 0, // green background color
|
||||||
UI_LCD_BLACK, 0 // black color
|
UI_LCD_BLACK, 0 // black color
|
||||||
}; // bitmap information
|
}; // bitmap information
|
||||||
|
|
||||||
|
@ -63,4 +63,24 @@ void lcd_update()
|
||||||
|
|
||||||
// natural sleep :)
|
// natural sleep :)
|
||||||
Sleep (50);
|
Sleep (50);
|
||||||
|
}
|
||||||
|
|
||||||
|
// lcd_backlight
|
||||||
|
// set backlight state of lcd
|
||||||
|
void lcd_backlight (
|
||||||
|
bool on // switch backlight on or off?
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
{
|
||||||
|
RGBQUAD blon = {UI_LCD_BGCOLORLIGHT, 0};
|
||||||
|
bmi.bmiColors[0] = blon;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RGBQUAD blon = {UI_LCD_BGCOLOR, 0};
|
||||||
|
bmi.bmiColors[0] = blon;
|
||||||
|
}
|
||||||
|
|
||||||
|
InvalidateRect (hGUIWnd, NULL, FALSE);
|
||||||
}
|
}
|
|
@ -39,7 +39,7 @@ extern unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; // the display
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern char bitmap[LCD_WIDTH][LCD_HEIGHT]; // the ui display
|
extern char bitmap[LCD_HEIGHT][LCD_WIDTH]; // the ui display
|
||||||
extern BITMAPINFO2 bmi; // bitmap information
|
extern BITMAPINFO2 bmi; // bitmap information
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#include "uisw32.h"
|
|
||||||
#include "lcd-win32.h"
|
|
||||||
|
|
||||||
#define FS 6
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
int x;
|
|
||||||
lcd_init ();
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
for (x = 0; x < 10; x++)
|
|
||||||
{
|
|
||||||
lcd_clear_display ();
|
|
||||||
lcd_position (x, 12, FS);
|
|
||||||
lcd_string ("Hello World!");
|
|
||||||
lcd_position (x, 32, FS);
|
|
||||||
lcd_string ("From the");
|
|
||||||
lcd_position (x, 40, FS);
|
|
||||||
lcd_string (" Open Source ");
|
|
||||||
lcd_position (x, 48, FS);
|
|
||||||
lcd_string ("Jukebox Project");
|
|
||||||
lcd_update ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,260 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
||||||
* \/ \/ \/ \/ \/
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Copyright (C) 2002 by Felix Arends
|
|
||||||
*
|
|
||||||
* All files in this archive are subject to the GNU General Public License.
|
|
||||||
* See the file COPYING in the source tree root for full license agreement.
|
|
||||||
*
|
|
||||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
||||||
* KIND, either express or implied.
|
|
||||||
*
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
#include <process.h>
|
|
||||||
#include "uisw32.h"
|
|
||||||
#include "resource.h"
|
|
||||||
|
|
||||||
// extern functions
|
|
||||||
extern void main (void *); // mod entry point
|
|
||||||
|
|
||||||
// variables
|
|
||||||
HWND hGUIWnd; // the GUI window handle
|
|
||||||
unsigned int uThreadID; // id of mod thread
|
|
||||||
PBYTE lpKeys;
|
|
||||||
|
|
||||||
// GUIWndProc
|
|
||||||
// window proc for GUI simulator
|
|
||||||
LRESULT GUIWndProc (
|
|
||||||
HWND hWnd,
|
|
||||||
UINT uMsg,
|
|
||||||
WPARAM wParam,
|
|
||||||
LPARAM lParam
|
|
||||||
)
|
|
||||||
{
|
|
||||||
static HBITMAP hBkgnd;
|
|
||||||
static lpBmp [UI_WIDTH * UI_HEIGHT * 3];
|
|
||||||
static HDC hMemDc;
|
|
||||||
|
|
||||||
switch (uMsg)
|
|
||||||
{
|
|
||||||
case WM_CREATE:
|
|
||||||
// load background image
|
|
||||||
hBkgnd = (HBITMAP)LoadImage (GetModuleHandle (NULL), MAKEINTRESOURCE(IDB_UI),
|
|
||||||
IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR);
|
|
||||||
hMemDc = CreateCompatibleDC (GetDC (hWnd));
|
|
||||||
SelectObject (hMemDc, hBkgnd);
|
|
||||||
return TRUE;
|
|
||||||
case WM_SIZING:
|
|
||||||
{
|
|
||||||
LPRECT r = (LPRECT)lParam;
|
|
||||||
RECT r2;
|
|
||||||
char s[256];
|
|
||||||
int v;
|
|
||||||
|
|
||||||
switch (wParam)
|
|
||||||
{
|
|
||||||
case WMSZ_BOTTOM:
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->bottom = r->top + v * UI_HEIGHT / 5;
|
|
||||||
r->right = r->left + v * UI_WIDTH / 5;
|
|
||||||
r->right += GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->bottom += GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_RIGHT:
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
r->bottom = r->top + v * UI_HEIGHT / 5;
|
|
||||||
r->right = r->left + v * UI_WIDTH / 5;
|
|
||||||
r->right += GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->bottom += GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_TOP:
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->top = r->bottom - v * UI_HEIGHT / 5;
|
|
||||||
r->right = r->left + v * UI_WIDTH / 5;
|
|
||||||
r->right += GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->top -= GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_LEFT:
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
r->bottom = r->top + v * UI_HEIGHT / 5;
|
|
||||||
r->left = r->right - v * UI_WIDTH / 5;
|
|
||||||
r->left -= GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->bottom += GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_BOTTOMRIGHT:
|
|
||||||
GetWindowRect (hWnd, &r2);
|
|
||||||
if (abs(r2.right - r->right) > abs(r2.bottom - r->bottom))
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
else
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->bottom = r->top + v * UI_HEIGHT / 5;
|
|
||||||
r->right = r->left + v * UI_WIDTH / 5;
|
|
||||||
r->right += GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->bottom += GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_BOTTOMLEFT:
|
|
||||||
GetWindowRect (hWnd, &r2);
|
|
||||||
if (abs(r2.left - r->left) > abs(r2.bottom - r->bottom))
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
else
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->bottom = r->top + v * UI_HEIGHT / 5;
|
|
||||||
r->left = r->right - v * UI_WIDTH / 5;
|
|
||||||
r->left -= GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->bottom += GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_TOPRIGHT:
|
|
||||||
GetWindowRect (hWnd, &r2);
|
|
||||||
if (abs(r2.right - r->right) > abs(r2.top - r->top))
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
else
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->top = r->bottom - v * UI_HEIGHT / 5;
|
|
||||||
r->right = r->left + v * UI_WIDTH / 5;
|
|
||||||
r->right += GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->top -= GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
case WMSZ_TOPLEFT:
|
|
||||||
GetWindowRect (hWnd, &r2);
|
|
||||||
if (abs(r2.left - r->left) > abs(r2.top - r->top))
|
|
||||||
v = (r->right - r->left) / (UI_WIDTH / 5);
|
|
||||||
else
|
|
||||||
v = (r->bottom - r->top) / (UI_HEIGHT / 5);
|
|
||||||
r->top = r->bottom - v * UI_HEIGHT / 5;
|
|
||||||
r->left = r->right - v * UI_WIDTH / 5;
|
|
||||||
r->left -= GetSystemMetrics (SM_CXSIZEFRAME) * 2;
|
|
||||||
r->top -= GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wsprintf (s, "RockBox Simulator @%d%%",
|
|
||||||
(r->right - r->left - GetSystemMetrics (SM_CXSIZEFRAME) * 2)
|
|
||||||
* 100 / UI_WIDTH);
|
|
||||||
SetWindowText (hWnd, s);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
case WM_ERASEBKGND:
|
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
HDC hDc = BeginPaint (hWnd, &ps);
|
|
||||||
RECT r;
|
|
||||||
|
|
||||||
GetClientRect (hWnd, &r);
|
|
||||||
// blit to screen
|
|
||||||
StretchBlt (hDc, 0, 0, r.right, r.bottom,
|
|
||||||
hMemDc, 0, 0, UI_WIDTH, UI_HEIGHT, SRCCOPY);
|
|
||||||
EndPaint (hWnd, &ps);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
case WM_PAINT:
|
|
||||||
{
|
|
||||||
PAINTSTRUCT ps;
|
|
||||||
RECT r;
|
|
||||||
HDC hDc = BeginPaint (hWnd, &ps);
|
|
||||||
|
|
||||||
GetClientRect (hWnd, &r);
|
|
||||||
// draw lcd screen
|
|
||||||
StretchDIBits (hDc,
|
|
||||||
UI_LCD_POSX * r.right / UI_WIDTH, UI_LCD_POSY * r.bottom / UI_HEIGHT,
|
|
||||||
LCD_WIDTH * r.right / UI_WIDTH, LCD_HEIGHT * r.bottom / UI_HEIGHT,
|
|
||||||
0, 0, LCD_WIDTH, LCD_HEIGHT,
|
|
||||||
bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, SRCCOPY);
|
|
||||||
|
|
||||||
EndPaint (hWnd, &ps);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
case WM_CLOSE:
|
|
||||||
// close simulator
|
|
||||||
hGUIWnd = NULL;
|
|
||||||
PostQuitMessage (0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return DefWindowProc (hWnd, uMsg, wParam, lParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
// GUIStartup
|
|
||||||
// register window class, show window, init GUI
|
|
||||||
BOOL GUIStartup ()
|
|
||||||
{
|
|
||||||
WNDCLASS wc;
|
|
||||||
|
|
||||||
// create window class
|
|
||||||
ZeroMemory (&wc, sizeof(wc));
|
|
||||||
wc.hbrBackground = GetSysColorBrush (COLOR_WINDOW);
|
|
||||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
||||||
wc.hInstance = GetModuleHandle (NULL);
|
|
||||||
wc.lpfnWndProc = (WNDPROC)GUIWndProc;
|
|
||||||
wc.lpszClassName = "RockBoxUISimulator";
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
|
|
||||||
if (RegisterClass (&wc) == 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
// create window
|
|
||||||
hGUIWnd = CreateWindowEx (
|
|
||||||
WS_EX_TOOLWINDOW | WS_EX_PALETTEWINDOW,
|
|
||||||
"RockBoxUISimulator", "ARCHOS JukeBox",
|
|
||||||
WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPEDWINDOW,
|
|
||||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
||||||
UI_WIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2,
|
|
||||||
UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION),
|
|
||||||
NULL, NULL, GetModuleHandle (NULL), NULL);
|
|
||||||
|
|
||||||
if (hGUIWnd == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GUIDown
|
|
||||||
// destroy window, unregister window class
|
|
||||||
int GUIDown ()
|
|
||||||
{
|
|
||||||
DestroyWindow (hGUIWnd);
|
|
||||||
_endthreadex (uThreadID);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// GUIMessageLoop
|
|
||||||
// standard message loop for GUI window
|
|
||||||
void GUIMessageLoop ()
|
|
||||||
{
|
|
||||||
MSG msg;
|
|
||||||
while (GetMessage (&msg, hGUIWnd, 0, 0) && hGUIWnd != NULL)
|
|
||||||
{
|
|
||||||
TranslateMessage (&msg);
|
|
||||||
DispatchMessage (&msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// WinMain
|
|
||||||
// program entry point
|
|
||||||
int WINAPI WinMain (
|
|
||||||
HINSTANCE hInstance, // current instance
|
|
||||||
HINSTANCE hPrevInstance, // previous instance
|
|
||||||
LPSTR lpCmd, // command line
|
|
||||||
int nShowCmd // show command
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (!GUIStartup ())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
uThreadID = _beginthread (main, 0, NULL);
|
|
||||||
if (uThreadID == -0L)
|
|
||||||
return MessageBox (NULL, "Error creating mod thread!", "Error", MB_OK);
|
|
||||||
|
|
||||||
GUIMessageLoop ();
|
|
||||||
|
|
||||||
return GUIDown ();
|
|
||||||
}
|
|
|
@ -25,7 +25,8 @@
|
||||||
|
|
||||||
#define UI_WIDTH 240 // width of GUI window
|
#define UI_WIDTH 240 // width of GUI window
|
||||||
#define UI_HEIGHT 360 // height of GUI window
|
#define UI_HEIGHT 360 // height of GUI window
|
||||||
#define UI_LCD_COLOR 46, 67, 49 // bkgnd color of LCD
|
#define UI_LCD_BGCOLOR 46, 67, 49 // bkgnd color of LCD (no backlight)
|
||||||
|
#define UI_LCD_BGCOLORLIGHT 56, 77, 59 // bkgnd color of LCD (backlight)
|
||||||
#define UI_LCD_BLACK 0, 0, 0 // black
|
#define UI_LCD_BLACK 0, 0, 0 // black
|
||||||
#define UI_LCD_POSX 59 // x position of lcd
|
#define UI_LCD_POSX 59 // x position of lcd
|
||||||
#define UI_LCD_POSY 95 // y position of lcd
|
#define UI_LCD_POSY 95 // y position of lcd
|
||||||
|
|
Binary file not shown.
|
@ -65,8 +65,8 @@
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="1"
|
||||||
OmitFramePointers="TRUE"
|
OmitFramePointers="TRUE"
|
||||||
AdditionalIncludeDirectories=""C:\Programming\CVS Checkout\RockBox\firmware\drivers";"C:\Programming\CVS Checkout\RockBox\firmware""
|
AdditionalIncludeDirectories=""C:\Programming\CVS Checkout\RockBox\firmware\drivers";"C:\Programming\CVS Checkout\RockBox\firmware";"C:\Programming\CVS Checkout\RockBox\firmware\common""
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ARCHOS_RECORDER;SIMULATOR"
|
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ARCHOS_RECORDER;SIMULATOR;WIN32"
|
||||||
StringPooling="TRUE"
|
StringPooling="TRUE"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
EnableFunctionLevelLinking="TRUE"
|
EnableFunctionLevelLinking="TRUE"
|
||||||
|
@ -112,6 +112,9 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\firmware\chartables.c">
|
RelativePath="..\..\firmware\chartables.c">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="file-win32.c">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="kernel.c">
|
RelativePath="kernel.c">
|
||||||
</File>
|
</File>
|
||||||
|
@ -120,29 +123,20 @@
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\firmware\drivers\lcd.c">
|
RelativePath="..\..\firmware\drivers\lcd.c">
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="tetris.c">
|
RelativePath="main.c">
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="uisw32.cpp">
|
RelativePath="uisw32.c">
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
Filter="h;hpp;hxx;hm;inl;inc">
|
Filter="h;hpp;hxx;hm;inl;inc">
|
||||||
|
<File
|
||||||
|
RelativePath="file-win32.h">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="lcd-win32.h">
|
RelativePath="lcd-win32.h">
|
||||||
</File>
|
</File>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue